diff --git a/BUILD.gn b/BUILD.gn index 3f503cae758e786b05151adcdae94037949e8065..c55e0184c48a068eed009c6ed1f4a5dff63b7187 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -65,9 +65,11 @@ if (!sdk_build_public) { template("ohos_declaration_template") { forward_variables_from(invoker, "*") + _module_info_target = "/ohos_declaration/${target_name}_info" action_with_pydeps(target_name) { script = "//interface/sdk-js/remove_internal.py" input_api_dir = "//interface/sdk-js/api" + inputs = [ "//interface/sdk-js/api" ] outputs = [ root_out_dir + "/ohos_declaration/$target_name" ] if (sdk_build_public) { script = "//out/sdk-public/public_interface/sdk-js/remove_internal.py" @@ -80,8 +82,12 @@ template("ohos_declaration_template") { rebase_path(root_out_dir + "/ohos_declaration/$target_name/", root_build_dir), ] + if (defined(deps)) { + deps += [ ":$_module_info_target" ] + } else { + deps = [ ":$_module_info_target" ] + } } - _module_info_target = "/ohos_declaration/${target_name}_info" _target_name = target_name generate_module_info(_module_info_target) { module_type = "jsdoc" diff --git a/README_zh.md b/README_zh.md index 21846d91b8adec8fa349e614fb8dd3fb7ddfc319..07a08fd8e211925e6fc25b6848daf595bf48e5c5 100644 --- a/README_zh.md +++ b/README_zh.md @@ -1,8 +1,31 @@ -# API声明文件公共仓 +# API声明文件公共仓 -- [简介](#section11660541593) +## 简介 -## 简介 +JS/TS API 公共仓,用来提交 API d.ts 声明文件以及API相关工具。 -JavaScript API 公共仓,用来提交 API d.ts 声明文件。 +## 目录 + +``` +├─api +| ├─@internal +│ | ├─component +│ | | └─ets #基于TS扩展的声明式开发范式组件声明文件 +| | └─ets +| ├─config #基于JS扩展的类Web范式 +| ├─form #JS服务卡片 +| ├─@ohos.×××.d.ts #API声明文件 +| └─@system.×××.d.ts #标记为停止维护的接口 +├─build-tools + ├─api_check_plugin #检查API规范的工具 + | ├─plugin + | ├─src + | └─test + └─collect_application_api #解析应用到的API的工具 + └─src +``` + +## 相关仓 + +[interface-sdk_js](https://gitee.com/openharmony/interface_sdk-js/tree/master) diff --git a/api/@internal/component/ets/alphabet_indexer.d.ts b/api/@internal/component/ets/alphabet_indexer.d.ts index 42a4b1694a04863d01bae5fc71a2ace9462f4fe4..55264f74fe6aec8b12ecbeeab853308d0d9860b6 100644 --- a/api/@internal/component/ets/alphabet_indexer.d.ts +++ b/api/@internal/component/ets/alphabet_indexer.d.ts @@ -53,6 +53,7 @@ declare class AlphabetIndexerAttribute extends CommonMethod void): AlphabetIndexerAttribute; diff --git a/api/@internal/component/ets/animator.d.ts b/api/@internal/component/ets/animator.d.ts index ff253c2ebaa90bfc339572b4c13555577ca65064..e83ece83d4224e45659545d35efbea4fda7ef766 100644 --- a/api/@internal/component/ets/animator.d.ts +++ b/api/@internal/component/ets/animator.d.ts @@ -70,7 +70,7 @@ declare class ScrollMotion { } /** - * Defines Animtor. + * Defines Animator. * @since 7 * @systemapi */ diff --git a/api/@internal/component/ets/badge.d.ts b/api/@internal/component/ets/badge.d.ts index 6c6ef7b5936c4e46a99a4a1cd8780479c6f19028..6e292e1e05fdc1208b4896f7cbe641eb508ce4d4 100644 --- a/api/@internal/component/ets/badge.d.ts +++ b/api/@internal/component/ets/badge.d.ts @@ -116,7 +116,7 @@ declare interface BadgeParamWithString extends BadgeParam { } /** - * Defines Badge Componrnt. + * Defines Badge Component. * @since 7 */ interface BadgeInterface { @@ -140,7 +140,7 @@ interface BadgeInterface { } /** - * Defines Badge Componrnt attribute. + * Defines Badge Component attribute. * @since 7 */ declare class BadgeAttribute extends CommonMethod {} diff --git a/api/@internal/component/ets/calendar.d.ts b/api/@internal/component/ets/calendar.d.ts index 63569d81073600b4718ce87c33e435a764bbde85..5b528afd21941c60b3dadfe24d32970a9fb40b35 100644 --- a/api/@internal/component/ets/calendar.d.ts +++ b/api/@internal/component/ets/calendar.d.ts @@ -283,7 +283,7 @@ interface CurrentDayStyle { scheduleMarkerRadius?: number; /** - * Bound dary row offset. + * Boundary row offset. * @since 7 * @systemapi */ diff --git a/api/@internal/component/ets/checkboxgroup.d.ts b/api/@internal/component/ets/checkboxgroup.d.ts index 16695f09d2ee68c454c758613e1fe8726dfe006c..32a3810ef51695548c7221249582c2cd10add6cd 100644 --- a/api/@internal/component/ets/checkboxgroup.d.ts +++ b/api/@internal/component/ets/checkboxgroup.d.ts @@ -19,7 +19,7 @@ */ declare enum SelectStatus { /** - * All checkboxs is selected. + * All checkboxes are selected. * @since 8 */ All, diff --git a/api/@internal/component/ets/common.d.ts b/api/@internal/component/ets/common.d.ts index d8623f93e04e119abb220a20d548d86cb680bbdc..f69d4928adcbacc25678d3772991c2858c074c5a 100644 --- a/api/@internal/component/ets/common.d.ts +++ b/api/@internal/component/ets/common.d.ts @@ -146,7 +146,17 @@ declare function getContext(component?: Object): Context; * @since 9 */ declare type Context = import('../api/application/Context').default; - + +/** + * Post Card Action. + * @param { Object } component - indicate the card entry component. + * @param { Object } action - indicate the router or message event. + * @StageModelOnly + * @systemapi + * @since 9 + */ + declare function postCardAction(component: Object, action: Object): void; + /** * Defines the data type of the interface restriction. * @since 7 @@ -629,7 +639,7 @@ declare namespace focusControl { * Request focus to the specific component by param: 'id/key'. * @since 9 */ - declare function requestFocus(value: string): boolean; + function requestFocus(value: string): boolean; } /** @@ -668,6 +678,28 @@ declare enum SourceType { TouchScreen, } +/** + * Defines the event tool type. + * @since 9 + */ +declare enum SourceTool { + /** + * Unknown type. + * @since 9 + */ + Unknown, + + /** + * The finger type. + */ + Finger, + + /** + * The pen type. + */ + Pen, +} + /** * Defines the Border Image Repeat Mode. * @since 9 @@ -747,6 +779,29 @@ declare interface BaseEvent { * @since 8 */ source: SourceType; + + /** + * Touch pressure. + * @since 9 + */ + pressure: number; + + /** + * The angle between pencil projection on plane-X-Y and axis-Z. + * @since 9 + */ + tiltX: number; + + /** + * The angle between pencil projection on plane-Y-Z and axis-Z. + * @since 9 + */ + tiltY: number; + + /** + * The event tool type info. + */ + sourceTool: SourceTool; } /** @@ -1035,7 +1090,7 @@ declare interface KeyEvent { } /** - * Component State Styels. + * Component State Styles. * @since 8 */ declare interface StateStyles { @@ -1249,7 +1304,8 @@ declare class CommonMethod { /** * Sets the touchable of the current component * @since 7 - * @deprecated since 9, instead of hitTestBehavior. + * @deprecated since 9 + * @useinstead hitTestBehavior */ touchable(value: boolean): T; @@ -1544,7 +1600,7 @@ declare class CommonMethod { sepia(value: number): T; /** - * Inverts the input image. Value defines the scale of the conversion. 100% of the value is a complete reversal. + * Invert the input image. Value defines the scale of the conversion. 100% of the value is a complete reversal. * A value of 0% does not change the image. (Percentage) * @since 7 */ @@ -1713,6 +1769,8 @@ declare class CommonMethod { /** * Sets the number of occupied columns and offset columns for a specific device width type. * @since 7 + * @deprecated since 9 + * @useinstead grid_col/[GridColColumnOption] and grid_row/[GridRowColumnOption] */ useSizeType(value: { xs?: number | { span: number; offset: number }; @@ -1818,7 +1876,7 @@ declare class CommonMethod { * path:Motion path for displacement animation, using the svg path string. * from:Start point of the motion path. The default value is 0.0. * to:End point of the motion path. The default value is 1.0. - * rotatble:Whether to follow the path for rotation. + * rotatable:Whether to follow the path for rotation. * @since 7 */ motionPath(value: MotionPathOptions): T; @@ -1892,7 +1950,7 @@ declare class CommonMethod { stateStyles(value: StateStyles): T; /** - * id for distrubte identification. + * id for distribute identification. * @since 8 */ restoreId(value: number): T; @@ -1944,7 +2002,7 @@ declare class CommonShapeMethod extends CommonMethod { /** * constructor. * @since 7 - * @syetemapi + * @systemapi */ constructor(); @@ -2020,26 +2078,17 @@ declare class CommonShapeMethod extends CommonMethod { * @since 9 */ declare interface LayoutBorderInfo { - borderWidth: number, + borderWidth: EdgeWidths, margin: Margin, padding: Padding, } -/** - * Sub component position info. - * @since 9 - */ -declare interface LayoutPosition { - x: number, - y: number, -} - /** * Sub component layout info. * @since 9 */ declare interface LayoutInfo { - position: LayoutPosition, + position: Position, constraint: ConstraintSizeOptions, } @@ -2076,7 +2125,7 @@ declare interface LayoutChild { * Sub component position. * @since 9 */ - position: LayoutPosition, + position: Position, /** * Call this measure method in onMeasure callback to supply sub component size. @@ -2148,6 +2197,13 @@ declare class CustomComponent extends CommonAttribute { * @since 7 */ onBackPress?(): void; + + /** + * PageTransition Method. + * Implement Animation when enter this page or move to other pages. + * @since 9 + */ + pageTransition?(): void; } /** @@ -2159,7 +2215,7 @@ declare class CustomComponent extends CommonAttribute { declare class View { /** * Just use for generate tsbundle - * @ignore ide should ignore this arrtibute + * @ignore ide should ignore this attribute * @systemapi * @since 7 */ diff --git a/api/@internal/component/ets/common_ts_ets_api.d.ts b/api/@internal/component/ets/common_ts_ets_api.d.ts index 446c40e25b2e6c7a5f7061b6e67194e0713498ef..2e33d8736dc0b52564bf4e07e49c5c7d72a1b5cb 100644 --- a/api/@internal/component/ets/common_ts_ets_api.d.ts +++ b/api/@internal/component/ets/common_ts_ets_api.d.ts @@ -81,9 +81,17 @@ declare class AppStorage { /** * Called when a cleanup occurs. * @since 7 + * @deprecated since 9 + * @useinstead AppStorage.Clear */ static staticClear(): boolean; + /** + * Called when a cleanup occurs. + * @since 9 + */ + static Clear(): boolean; + /** * Called when the data can be changed. * @since 7 @@ -360,14 +368,12 @@ interface ISinglePropertyChangeSubscriber extends IPropertySubscriber { * Defines the Subscribale base class. * @since 7 * @systemapi - * @hide */ declare abstract class SubscribaleAbstract { /** * Returns the ownership attribute set by the. * @since 7 * @systemapi - * @hide */ private owningProperties_: Set; @@ -375,7 +381,6 @@ declare abstract class SubscribaleAbstract { * Constructor. * @since 7 * @systemapi - * @hide */ constructor(); @@ -383,7 +388,6 @@ declare abstract class SubscribaleAbstract { * Called when the notification property has changed. * @since 7 * @systemapi - * @hide */ protected notifyPropertyHasChanged(propName: string, newValue: any): void; @@ -391,7 +395,6 @@ declare abstract class SubscribaleAbstract { * Called when adding an already owned property. * @since 7 * @systemapi - * @hide */ public addOwningProperty(subscriber: IPropertySubscriber): void; @@ -399,7 +402,6 @@ declare abstract class SubscribaleAbstract { * Called when an already owned property is deleted. * @since 7 * @systemapi - * @hide */ public removeOwningProperty(property: IPropertySubscriber): void; @@ -407,7 +409,6 @@ declare abstract class SubscribaleAbstract { * Called when an already owned property is deleted by ID * @since 7 * @systemapi - * @hide */ public removeOwningPropertyById(subscriberId: number): void; } @@ -421,7 +422,6 @@ declare class Environment { * Constructor. * @since 7 * @systemapi - * @hide */ constructor(); @@ -458,7 +458,6 @@ declare class PersistentStorage { * Constructor parameters. * @since 7 * @systemapi - * @hide */ constructor(appStorage: AppStorage, storage: Storage); @@ -496,7 +495,6 @@ declare class PersistentStorage { * Used for ide. * @since 7 * @systemapi - * @hide */ declare const appStorage: AppStorage; @@ -519,7 +517,7 @@ declare const appStorage: AppStorage; static GetShared(): LocalStorage; /** - * Return true if prooperty with given name exists + * Return true if property with given name exists * @since 9 */ has(propName: string): boolean; diff --git a/api/@internal/component/ets/custom_dialog_controller.d.ts b/api/@internal/component/ets/custom_dialog_controller.d.ts index c0686ea814e4b35b9b29656c644f81941aa2951e..ee5cca1718612d489520f4e10cc149abffc99c8a 100644 --- a/api/@internal/component/ets/custom_dialog_controller.d.ts +++ b/api/@internal/component/ets/custom_dialog_controller.d.ts @@ -50,7 +50,7 @@ declare interface CustomDialogControllerOptions { offset?: Offset; /** - * Defines if use costom style. + * Defines if use custom style. * @since 7 */ customStyle?: boolean; diff --git a/api/@internal/component/ets/enums.d.ts b/api/@internal/component/ets/enums.d.ts index 4485ed6929a68744047ec61af4e3feaa89f775ff..b97c00744261df8cd346502cabe3b3f0c852792f 100644 --- a/api/@internal/component/ets/enums.d.ts +++ b/api/@internal/component/ets/enums.d.ts @@ -361,7 +361,7 @@ declare enum Curve { LinearOutSlowIn, /** - * Fast OutL inear In. + * Fast Out Linear In. * @since 7 */ FastOutLinearIn, @@ -507,6 +507,7 @@ declare enum Edge { /** * Center horizontal and vertical. * @since 7 + * @deprecated since 9 */ Center, @@ -519,6 +520,7 @@ declare enum Edge { /** * Cross axis direction text baseline alignment. * @since 7 + * @deprecated since 9 */ Baseline, @@ -531,6 +533,7 @@ declare enum Edge { /** * Middle * @since 7 + * @deprecated since 9 */ Middle, @@ -1511,13 +1514,13 @@ declare enum HitTestMode { */ declare enum TitleHeight { /** - * Title height when only main title is avaliable. + * Title height when only main title is available. * @since 9 */ MainOnly, /** - * Title height when main title and subtitle are both avaliable. + * Title height when main title and subtitle are both available. * @since 9 */ MainWithSub, diff --git a/api/@internal/component/ets/flow_item.d.ts b/api/@internal/component/ets/flow_item.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..801acb1a9bcedfed26879927890ceb9837bbcb73 --- /dev/null +++ b/api/@internal/component/ets/flow_item.d.ts @@ -0,0 +1,34 @@ +/* + * 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. + */ + +/** + * Mesh container for static fixed-size layout scenarios. + * @since 9 + */ +interface FlowItemInterface { + /** + * Construct the flow item. + * @since 9 + */ + (): FlowItemAttribute; +} + +/** + * @since 9 + */ +declare class FlowItemAttribute extends CommonMethod {} + +declare const FlowItem: FlowItemInterface +declare const FlowItemInstance: FlowItemAttribute; diff --git a/api/@internal/component/ets/grid.d.ts b/api/@internal/component/ets/grid.d.ts index e58a4765bcee9799274ca04d52c879227b7de0d0..f65b792b931ad0e973629644f165da6ce5c668a3 100644 --- a/api/@internal/component/ets/grid.d.ts +++ b/api/@internal/component/ets/grid.d.ts @@ -53,7 +53,7 @@ declare enum GridDirection { } /** - * Defines the grid attibute functions. + * Defines the grid attribute functions. * @since 7 */ declare class GridAttribute extends CommonMethod { diff --git a/api/@internal/component/ets/grid_col.d.ts b/api/@internal/component/ets/grid_col.d.ts index cb493ec093033e36f73a172fd6722e372a6a935e..e9ddfe4aa3927b3d74555dc06a10c9b3d69dd051 100644 --- a/api/@internal/component/ets/grid_col.d.ts +++ b/api/@internal/component/ets/grid_col.d.ts @@ -89,7 +89,7 @@ interface GridColInterface { * Defines the constructor of GridContainer. * @since 9 */ - (optiion?: GridColOptions): GridColAttribute; + (option?: GridColOptions): GridColAttribute; } declare class GridColAttribute extends CommonMethod { diff --git a/api/@internal/component/ets/grid_container.d.ts b/api/@internal/component/ets/grid_container.d.ts index 28203fa47f53365ea30a523ac957abe7864e6577..1c9e0cd0f4d23a98a1cc18ff575f5a9c61d08d49 100644 --- a/api/@internal/component/ets/grid_container.d.ts +++ b/api/@internal/component/ets/grid_container.d.ts @@ -16,6 +16,8 @@ /** * Defines the size type. * @since 7 + * @deprecated since 9 + * @useinstead grid_col/[GridColColumnOption] and grid_row/[GridRowColumnOption] */ declare enum SizeType { /** @@ -52,29 +54,35 @@ declare enum SizeType { /** * Defines the options of GridContainer. * @since 7 + * @deprecated since 9 + * @useinstead grid_col/[GridColOptions] and grid_row/[GridRowOptions] */ declare interface GridContainerOptions { /** * Sets the total number of columns in the current layout. * @since 7 + * @deprecated since 9 */ columns?: number | "auto"; /** * Select the device width type. * @since 7 + * @deprecated since 9 */ sizeType?: SizeType; /** * Grid layout column spacing. * @since 7 + * @deprecated since 9 */ gutter?: number | string; /** * Spacing on both sides of the grid layout. * @since 7 + * @deprecated since 9 */ margin?: number | string; } @@ -82,11 +90,14 @@ declare interface GridContainerOptions { /** * Defines the GridContainer component. * @since 7 + * @deprecated since 9 + * @useinstead grid_col/[GridColInterface] and grid_row/[GridRowInterface] */ interface GridContainerInterface { /** * Defines the constructor of GridContainer. * @since 7 + * @deprecated since 9 */ (value?: GridContainerOptions): GridContainerAttribute; } @@ -94,6 +105,8 @@ interface GridContainerInterface { /** * Defines the grid container attribute from inheritance Column * @since 7 + * @deprecated since 9 + * @useinstead grid_col/[GridColAttribute] and grid_row/[GridRowAttribute] */ declare class GridContainerAttribute extends ColumnAttribute {} diff --git a/api/@internal/component/ets/hyperlink.d.ts b/api/@internal/component/ets/hyperlink.d.ts index 40751b2d28b0228f41b5266b250b72122e8cc0e6..07b7f981f34972e099524e25ac74df0f82ff0c0f 100644 --- a/api/@internal/component/ets/hyperlink.d.ts +++ b/api/@internal/component/ets/hyperlink.d.ts @@ -28,7 +28,7 @@ interface HyperlinkInterface { } /** - * Defines the hyperlink attibute functions + * Defines the hyperlink attribute functions * @since 7 */ declare class HyperlinkAttribute extends CommonMethod { diff --git a/api/@internal/component/ets/index-full.d.ts b/api/@internal/component/ets/index-full.d.ts index f536b164e2d62672de57043fec0dbaf780c78be7..fe915f8660f4115ef29dddc2e0d7078fc5e6e760 100644 --- a/api/@internal/component/ets/index-full.d.ts +++ b/api/@internal/component/ets/index-full.d.ts @@ -107,3 +107,5 @@ /// /// /// +/// +/// diff --git a/api/@internal/component/ets/inspector.d.ts b/api/@internal/component/ets/inspector.d.ts index c62f3802cf6cfc69b9c8ea99829073ebc6e02145..eae589afa588c53120a5c76ce27c46b0766a79a0 100644 --- a/api/@internal/component/ets/inspector.d.ts +++ b/api/@internal/component/ets/inspector.d.ts @@ -17,7 +17,8 @@ * Get inspector node infos. * @since 7 * @systemapi - * @deprecated + * @deprecated since 9 + * @useinstead getInspectorTree */ declare function getInspectorNodes(): object; @@ -25,7 +26,8 @@ declare function getInspectorNodes(): object; * Get inspector node info by node id. * @since 7 * @systemapi - * @deprecated + * @deprecated since 9 + * @useinstead getInspectorByKey */ declare function getInspectorNodeById(id: number): object; diff --git a/api/@internal/component/ets/lazy_for_each.d.ts b/api/@internal/component/ets/lazy_for_each.d.ts index a027eab8aff3963214cdccde22447144c5a0ea07..7e6c2da51fba3667489680f48cdfc239444cf57c 100644 --- a/api/@internal/component/ets/lazy_for_each.d.ts +++ b/api/@internal/component/ets/lazy_for_each.d.ts @@ -28,6 +28,7 @@ declare interface DataChangeListener { * Data added. * @since 7 * @deprecated since 8 + * @useinstead onDataAdd */ onDataAdded(index: number): void; @@ -41,6 +42,7 @@ declare interface DataChangeListener { * Data moved. * @since 7 * @deprecated since 8 + * @useinstead onDataMove */ onDataMoved(from: number, to: number): void; @@ -54,6 +56,7 @@ declare interface DataChangeListener { * Data deleted. * @since 7 * @deprecated since 8 + * @useinstead onDataDelete */ onDataDeleted(index: number): void; @@ -67,6 +70,7 @@ declare interface DataChangeListener { * Call when has data change. * @since 7 * @deprecated since 8 + * @useinstead onDataChange */ onDataChanged(index: number): void; diff --git a/api/@internal/component/ets/list_item.d.ts b/api/@internal/component/ets/list_item.d.ts index edfea632c956d112fc14f2bc06c99b6f49c7ec13..19eafad7eb344ca966e879854b098f6c0a509ed9 100644 --- a/api/@internal/component/ets/list_item.d.ts +++ b/api/@internal/component/ets/list_item.d.ts @@ -17,6 +17,8 @@ /** * Declare item ceiling attribute. * @since 7 + * @deprecated since 9 + * @useinstead list/StickyStyle */ declare enum Sticky { /** @@ -50,7 +52,7 @@ declare enum EditMode { None, /** - * Deleteable. + * Deletable. * @since 7 */ Deletable, @@ -128,6 +130,8 @@ declare class ListItemAttribute extends CommonMethod { /** * Called when setting whether item is ceiling effect. * @since 7 + * @deprecated since 9 + * @useinstead list/List#sticky */ sticky(value: Sticky): ListItemAttribute; diff --git a/api/@internal/component/ets/list_item_group.d.ts b/api/@internal/component/ets/list_item_group.d.ts index 6914c606ce942197b419d6794065efb632ad394b..28a580f94d90d163b3f3a4aaaf5dbb406eb65dbe 100644 --- a/api/@internal/component/ets/list_item_group.d.ts +++ b/api/@internal/component/ets/list_item_group.d.ts @@ -50,7 +50,7 @@ interface ListItemGroupInterface { } /** - * Defines the item group attibute functions. + * Defines the item group attribute functions. * @since 9 */ declare class ListItemGroupAttribute extends CommonMethod { diff --git a/api/@internal/component/ets/nav_destination.d.ts b/api/@internal/component/ets/nav_destination.d.ts index 3868d8de29e0bfedde5d06214ce59e6e25b5ccb0..ff5b52d3a3372aaec961772ab1b32c0040600b05 100644 --- a/api/@internal/component/ets/nav_destination.d.ts +++ b/api/@internal/component/ets/nav_destination.d.ts @@ -40,7 +40,7 @@ declare interface NavDestinationCustomTitle { * Sets the custom title builder. * @since 9 */ - builder: string; + builder: CustomBuilder; /** * Sets the custom title height. @@ -55,7 +55,7 @@ declare interface NavDestinationCustomTitle { */ declare interface NavDestinationInterface { /** - * constructor. + * Constructor. * @since 9 */ (): NavDestinationAttribute; diff --git a/api/@internal/component/ets/nav_router.d.ts b/api/@internal/component/ets/nav_router.d.ts index f6d6718aa13c1b892519e5219a5c2990a2728f8e..44ea2af9b8d3ef9ca14607b1d02c884f6bc6b72b 100644 --- a/api/@internal/component/ets/nav_router.d.ts +++ b/api/@internal/component/ets/nav_router.d.ts @@ -19,7 +19,7 @@ */ declare interface NavRouterInterface { /** - * constructor. + * Constructor. * @since 9 */ (): NavRouterAttribute; diff --git a/api/@internal/component/ets/navigation.d.ts b/api/@internal/component/ets/navigation.d.ts index 74d0480687986f96314cd1efe105e1a108112c4c..0d8ba46d4c6f3afaac1ee37f2391974ee94c73c5 100644 --- a/api/@internal/component/ets/navigation.d.ts +++ b/api/@internal/component/ets/navigation.d.ts @@ -40,7 +40,7 @@ declare interface NavigationCustomTitle { * Sets the custom title builder. * @since 9 */ - builder: string; + builder: CustomBuilder; /** * Sets the custom title height. @@ -50,7 +50,7 @@ declare interface NavigationCustomTitle { } /** - * Nativation mode + * Navigation mode * @since 9 */ declare enum NavigationMode { diff --git a/api/@internal/component/ets/plugin_component.d.ts b/api/@internal/component/ets/plugin_component.d.ts index 08ddae847e61272cd9d92d6692229872ed6711ef..c306f416b44b9281a15e5514189115a0f2f9cb8d 100644 --- a/api/@internal/component/ets/plugin_component.d.ts +++ b/api/@internal/component/ets/plugin_component.d.ts @@ -48,7 +48,7 @@ interface PluginComponentInterface { } /** - * Defines the plugin component attibute functions. + * Defines the plugin component attribute functions. * @since 9 * @systemapi */ diff --git a/api/@internal/component/ets/progress.d.ts b/api/@internal/component/ets/progress.d.ts index 76faf8e8a693123a150fb6c18bea118ee30144ba..1e35aa28c849c0795178e02f895dfa5131186cfd 100644 --- a/api/@internal/component/ets/progress.d.ts +++ b/api/@internal/component/ets/progress.d.ts @@ -34,6 +34,7 @@ * Sets the style of Progress. * @since 7 * @deprecated since 8 + * @useinstead type */ style?: ProgressStyle @@ -92,7 +93,7 @@ declare interface ProgressStyleOptions { strokeWidth?: Length; /** - * Defines the scaleCoun property. + * Defines the scaleCount property. * @since 8 */ scaleCount?: number; @@ -153,7 +154,7 @@ interface ProgressInterface { } /** - * Defines the progress attibute functions. + * Defines the progress attribute functions. * @since 7 */ declare class ProgressAttribute extends CommonMethod { diff --git a/api/@internal/component/ets/qrcode.d.ts b/api/@internal/component/ets/qrcode.d.ts index ecae91dc558eae0032bdb9fcbeb1284cf5dcfbb8..9f28e680fc10675fb14d7598d7247d9f5d88607a 100644 --- a/api/@internal/component/ets/qrcode.d.ts +++ b/api/@internal/component/ets/qrcode.d.ts @@ -26,7 +26,7 @@ interface QRCodeInterface { } /** - * Defines the qrcode attibute functions. + * Defines the qrcode attribute functions. * @since 7 */ declare class QRCodeAttribute extends CommonMethod { diff --git a/api/@internal/component/ets/rating.d.ts b/api/@internal/component/ets/rating.d.ts index 7dc8bac49645fcf78bcf7f39fad4be33bcf5fff7..555806118bf82c0a218828047470f56ff95c11a2 100644 --- a/api/@internal/component/ets/rating.d.ts +++ b/api/@internal/component/ets/rating.d.ts @@ -26,7 +26,7 @@ interface RatingInterface { } /** - * Defines the rating attibute functions. + * Defines the rating attribute functions. * @since 7 */ declare class RatingAttribute extends CommonMethod { diff --git a/api/@internal/component/ets/rect.d.ts b/api/@internal/component/ets/rect.d.ts index 3bc5bdab97d8d3629a058ed6d2aa7fcde94cb5aa..05cdcd37badcfd59d2f6a280a1652981bdc0db60 100644 --- a/api/@internal/component/ets/rect.d.ts +++ b/api/@internal/component/ets/rect.d.ts @@ -81,4 +81,13 @@ declare class RectAttribute extends CommonShapeMethod { } declare const Rect: RectInterface; + +/** + * @deprecated since 9 + */ declare const RectInStance: RectAttribute; + +/** + * @since 9 + */ +declare const RectInstance: RectAttribute; diff --git a/api/@internal/component/ets/refresh.d.ts b/api/@internal/component/ets/refresh.d.ts index 2475dc5518269b153f000bc91d96f73b576f7316..43bcf23f7a86e9416a70b07b66f5e43b04e1bc3a 100644 --- a/api/@internal/component/ets/refresh.d.ts +++ b/api/@internal/component/ets/refresh.d.ts @@ -62,7 +62,7 @@ interface RefreshInterface { } /** - * Defines the refresh attibute functions. + * Defines the refresh attribute functions. * @since 8 */ declare class RefreshAttribute extends CommonMethod { diff --git a/api/@internal/component/ets/scroll.d.ts b/api/@internal/component/ets/scroll.d.ts index 47334f21c69678cece28301cf5c176e763107f5b..23dfb16e7d0e24d7137361f634a050e94007d054 100644 --- a/api/@internal/component/ets/scroll.d.ts +++ b/api/@internal/component/ets/scroll.d.ts @@ -33,6 +33,7 @@ declare enum ScrollDirection { /** * Free scrolling is supported. * @since 7 + * @deprecated since 9 */ Free, @@ -72,9 +73,16 @@ declare class Scroller { /** * Called when page turning mode is set. * @since 7 + * @deprecated since 9 */ scrollPage(value: { next: boolean; direction?: Axis }); + /** + * Called when page turning mode is set. + * @since 9 + */ + scrollPage(value: { next: boolean }); + /** * Called when viewing the scroll offset. * @since 7 @@ -107,7 +115,7 @@ interface ScrollInterface { } /** - * Defines the scroll attibute functions. + * Defines the scroll attribute functions. * @since 7 */ declare class ScrollAttribute extends CommonMethod { @@ -160,7 +168,7 @@ declare class ScrollAttribute extends CommonMethod { edgeEffect(edgeEffect: EdgeEffect): ScrollAttribute; /** - * Event called when sroll will scroll. + * Event called when Scroll will scroll. * @since 9 */ onScrollBegin(event: (dx: number, dy: number) => { dxRemain: number, dyRemain: number }): ScrollAttribute; diff --git a/api/@internal/component/ets/scroll_bar.d.ts b/api/@internal/component/ets/scroll_bar.d.ts index d8089e23b40238ad29c651a0e52c65f13cfd184e..5e33db841dd8ee976fe2b7df3ed90574b5075aed 100644 --- a/api/@internal/component/ets/scroll_bar.d.ts +++ b/api/@internal/component/ets/scroll_bar.d.ts @@ -68,7 +68,7 @@ interface ScrollBarInterface { } /** - * Defines the scrollbar attibute functions. + * Defines the scrollbar attribute functions. * @since 8 */ declare class ScrollBarAttribute extends CommonMethod {} diff --git a/api/@internal/component/ets/select.d.ts b/api/@internal/component/ets/select.d.ts index 0c03c35b06461598cfb0e71970cdb808bfd1108e..09ad5034badcce9e72fa66fb464f1c4651bbbf3f 100644 --- a/api/@internal/component/ets/select.d.ts +++ b/api/@internal/component/ets/select.d.ts @@ -14,7 +14,7 @@ */ /** - * The declare of slectOption. + * The declare of selectOption. * @since 8 */ declare interface SelectOption { diff --git a/api/@internal/component/ets/sidebar.d.ts b/api/@internal/component/ets/sidebar.d.ts index 55e73273e394c8822b4b865e610897bc57fecafd..e7bd37665309c76b140da55425d302b1b3ff4764 100644 --- a/api/@internal/component/ets/sidebar.d.ts +++ b/api/@internal/component/ets/sidebar.d.ts @@ -69,7 +69,7 @@ declare interface ButtonStyle { width?: number; /** - * Set the heigth of control button + * Set the height of control button * @since 8 */ height?: number; diff --git a/api/@internal/component/ets/stepper_item.d.ts b/api/@internal/component/ets/stepper_item.d.ts index c7e0976f37ad4b64da3ca52491c2b25d1f359978..3a407266a40fd4519035ca283a4de1c84d550b5c 100644 --- a/api/@internal/component/ets/stepper_item.d.ts +++ b/api/@internal/component/ets/stepper_item.d.ts @@ -56,7 +56,7 @@ interface StepperItemInterface { } /** - * Defines the stepper item attrbute functions. + * Defines the stepper item attribute functions. * @since 8 */ declare class StepperItemAttribute extends CommonMethod { diff --git a/api/@internal/component/ets/swiper.d.ts b/api/@internal/component/ets/swiper.d.ts index 1a3f7ad21e13266ac548d3837f5493a408c2b669..f584d9047acc4caf27cad0ae01cb68bfcc3c744d 100644 --- a/api/@internal/component/ets/swiper.d.ts +++ b/api/@internal/component/ets/swiper.d.ts @@ -128,7 +128,7 @@ declare interface IndicatorStyle { } /** - * Defines the swiper attibute functions. + * Defines the swiper attribute functions. * @since 7 */ declare class SwiperAttribute extends CommonMethod { diff --git a/api/@internal/component/ets/text_input.d.ts b/api/@internal/component/ets/text_input.d.ts index 8b8db8f2c94d235c9c8a29cac54354916a8c4ad5..125bf7dca040bcfa0abc640e27b3b821d28d6264 100644 --- a/api/@internal/component/ets/text_input.d.ts +++ b/api/@internal/component/ets/text_input.d.ts @@ -195,6 +195,7 @@ declare class TextInputAttribute extends CommonMethod { * Called when judging whether the text editing change finished. * @since 7 * @deprecated since 8 + * @useinstead onEditChange */ onEditChanged(callback: (isEditing: boolean) => void): TextInputAttribute; diff --git a/api/@internal/component/ets/toggle.d.ts b/api/@internal/component/ets/toggle.d.ts index b51b5b490ee4ce8f25d7959d29425192be4fb33c..287e86e8c8ab7feedc89ba727d4a68754762aba0 100644 --- a/api/@internal/component/ets/toggle.d.ts +++ b/api/@internal/component/ets/toggle.d.ts @@ -50,7 +50,7 @@ interface ToggleInterface { } /** - * Defines the toggle attibute functions + * Defines the toggle attribute functions * @since 8 */ declare class ToggleAttribute extends CommonMethod { diff --git a/api/@internal/component/ets/water_flow.d.ts b/api/@internal/component/ets/water_flow.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c5387a22c519dbdf727348abd181932a23efa40b --- /dev/null +++ b/api/@internal/component/ets/water_flow.d.ts @@ -0,0 +1,100 @@ +/* + * 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 the water flow options. +* @since 9 +*/ +declare interface WaterFlowOptions { + /** + * Describes the water flow footer. + * @since 9 + */ + footer?: CustomBuilder; + + /** + * Describes the water flow scroller. + * @since 9 + */ + scroller?: Scroller; +} + + +/** + * @since 9 + */ +interface WaterFlowInterface { + /** + * WaterFlow is returned when the parameter is transferred. Only support api: scrollToIndex + * @since 9 + */ + (options?: WaterFlowOptions): WaterFlowAttribute; +} + +/** + * @since 9 + */ +declare class WaterFlowAttribute extends CommonMethod { + /** + * This parameter specifies the number of columns in the current waterflow. + * @since 9 + */ + columnsTemplate(value: string): WaterFlowAttribute; + + /** + * This parameter specifies the min or max size of each item. + * @since 9 + */ + itemConstraintSize(value: ConstraintSizeOptions): WaterFlowAttribute; + + /** + * Set the number of rows in the current waterflow. + * @since 9 + */ + rowsTemplate(value: string): WaterFlowAttribute; + + /** + * Set the spacing between columns. + * @since 9 + */ + columnsGap(value: Length): WaterFlowAttribute; + + /** + * Set the spacing between rows. + * @since 9 + */ + rowsGap(value: Length): WaterFlowAttribute; + + /** + * Control layout direction of the WaterFlow. + * @since 9 + */ + layoutDirection(value: FlexDirection): WaterFlowAttribute; + + /** + * Called when the water flow begins to arrive. + * @since 9 + */ + onReachStart(event: () => void): WaterFlowAttribute; + + /** + * Called when the water flow reaches the end. + * @since 9 + */ + onReachEnd(event: () => void): WaterFlowAttribute; +} + +declare const WaterFlow: WaterFlowInterface; +declare const WaterFlowInstance: WaterFlowAttribute; diff --git a/api/@internal/component/ets/web.d.ts b/api/@internal/component/ets/web.d.ts index 75c3663bbfee391a471319d139b217e70b5d39a2..7de600559a32b98dd65567b1fa34067e2da92c2a 100644 --- a/api/@internal/component/ets/web.d.ts +++ b/api/@internal/component/ets/web.d.ts @@ -353,7 +353,7 @@ declare class FileSelectorParam { /** * Gets the title of this file selector. - * @return Return the title of this file selector. + * @returns Return the title of this file selector. * * @since 9 */ @@ -361,7 +361,7 @@ declare class FileSelectorParam { /** * Gets the FileSelectorMode of this file selector. - * @return Return the FileSelectorMode of this file selector. + * @returns Return the FileSelectorMode of this file selector. * * @since 9 */ @@ -369,7 +369,7 @@ declare class FileSelectorParam { /** * Gets an array of acceptable MMIE type. - * @return Return an array of acceptable MMIE type. + * @returns Return an array of acceptable MMIE type. * * @since 9 */ @@ -377,7 +377,7 @@ declare class FileSelectorParam { /** * Gets whether this file selector use a live media captured value. - * @return Return {@code true} if captured media; return {@code false} otherwise. + * @returns Return {@code true} if captured media; return {@code false} otherwise. * @since 9 */ isCapture(): boolean; @@ -621,7 +621,7 @@ declare class WebContextMenuParam { /** * Horizontal offset coordinates of the menu within the Web component. - * @return The context menu x coordinate. + * @returns The context menu x coordinate. * * @since 9 */ @@ -629,7 +629,7 @@ declare class WebContextMenuParam { /** * Vertical offset coordinates for the menu within the Web component. - * @return The context menu y coordinate. + * @returns The context menu y coordinate. * * @since 9 */ @@ -637,7 +637,7 @@ declare class WebContextMenuParam { /** * If the long-press location is the link returns the link's security-checked URL. - * @return If relate to a link return link url, else return null. + * @returns If relate to a link return link url, else return null. * * @since 9 */ @@ -645,7 +645,7 @@ declare class WebContextMenuParam { /** * If the long-press location is the link returns the link's original URL. - * @return If relate to a link return unfilterend link url, else return null. + * @returns If relate to a link return unfiltered link url, else return null. * * @since 9 */ @@ -653,7 +653,7 @@ declare class WebContextMenuParam { /** * Returns the SRC URL if the selected element has a SRC attribute. - * @return If this context menu is "src" attribute, return link url, else return null. + * @returns If this context menu is "src" attribute, return link url, else return null. * * @since 9 */ @@ -661,7 +661,7 @@ declare class WebContextMenuParam { /** * Long press menu location has image content. - * @return Return whether this context menu has image content. + * @returns Return whether this context menu has image content. * * @since 9 */ @@ -688,7 +688,7 @@ declare class WebContextMenuResult { closeContextMenu(): void; /** - * If WebContextMenuParam has image content, this function will copy image ralated to this context menu. + * If WebContextMenuParam has image content, this function will copy image related to this context menu. * If WebContextMenuParam has no image content, this function will do nothing. * * @since 9 @@ -722,7 +722,7 @@ declare class ConsoleMessage { /** * Gets the message of a console message. - * @return Return the message of a console message. + * @returns Return the message of a console message. * * @since 8 */ @@ -730,7 +730,7 @@ declare class ConsoleMessage { /** * Gets the Web source file's path and name of a console message. - * @return Return the Web source file's path and name of a console message. + * @returns Return the Web source file's path and name of a console message. * * @since 8 */ @@ -738,7 +738,7 @@ declare class ConsoleMessage { /** * Gets the line number of a console message. - * @return Return the line number of a console message. + * @returns Return the line number of a console message. * * @since 8 */ @@ -746,7 +746,7 @@ declare class ConsoleMessage { /** * Gets the message level of a console message. - * @return Return the message level of a console message, which can be {@link MessageLevel}. + * @returns Return the message level of a console message, which can be {@link MessageLevel}. * * @since 8 */ @@ -771,7 +771,7 @@ declare class WebResourceRequest { /** * Gets request headers. - * @return Return the request headers + * @returns Return the request headers * * @since 8 */ @@ -779,7 +779,7 @@ declare class WebResourceRequest { /** * Gets the request URL. - * @return Return the request URL. + * @returns Return the request URL. * * @since 8 */ @@ -787,7 +787,7 @@ declare class WebResourceRequest { /** * Check whether the request is associated with gesture. - * @return Return {@code true} if the request is associated with gesture;return {@code false} otherwise. + * @returns Return {@code true} if the request is associated with gesture;return {@code false} otherwise. * * @since 8 */ @@ -795,7 +795,7 @@ declare class WebResourceRequest { /** * Check whether the request is for getting the main frame. - * @return Return {@code true} if the request is associated with gesture for getting the main frame; return {@code false} otherwise. + * @returns Return {@code true} if the request is associated with gesture for getting the main frame; return {@code false} otherwise. * * @since 8 */ @@ -803,7 +803,7 @@ declare class WebResourceRequest { /** * Check whether the request redirects. - * @return Return {@code true} if the request redirects; return {@code false} otherwise. + * @returns Return {@code true} if the request redirects; return {@code false} otherwise. * * @since 8 */ @@ -824,7 +824,7 @@ declare class WebResourceRequest { /** * Gets the response data. - * @return Return the response data. + * @returns Return the response data. * * @since 8 */ @@ -832,7 +832,7 @@ declare class WebResourceRequest { /** * Gets the response encoding. - * @return Return the response encoding. + * @returns Return the response encoding. * * @since 8 */ @@ -840,7 +840,7 @@ declare class WebResourceRequest { /** * Gets the response MIME type. - * @return Return the response MIME type. + * @returns Return the response MIME type. * * @since 8 */ @@ -848,7 +848,7 @@ declare class WebResourceRequest { /** * Gets the reason message. - * @return Return the reason message. + * @returns Return the reason message. * * @since 8 */ @@ -856,7 +856,7 @@ declare class WebResourceRequest { /** * Gets the response headers. - * @return Return the response headers. + * @returns Return the response headers. * * @since 8 */ @@ -864,7 +864,7 @@ declare class WebResourceRequest { /** * Gets the response code. - * @return Return the response code. + * @returns Return the response code. * * @since 8 */ @@ -950,7 +950,7 @@ declare class WebResourceError { /** * Gets the info of the Web resource error. - * @return Return the info of the Web resource error. + * @returns Return the info of the Web resource error. * * @since 8 */ @@ -958,7 +958,7 @@ declare class WebResourceError { /** * Gets the code of the Web resource error. - * @return Return the code of the Web resource error. + * @returns Return the code of the Web resource error. * * @since 8 */ @@ -1000,7 +1000,7 @@ declare class WebCookie { /** * Get whether cookies can be send or accepted. - * @return true if can send and accept cookies else false. + * @returns true if can send and accept cookies else false. * * @since 9 */ @@ -1008,7 +1008,7 @@ declare class WebCookie { /** * Get whether third party cookies can be send or accepted. - * @return true if can send and accept third party cookies else false. + * @returns true if can send and accept third party cookies else false. * * @since 9 */ @@ -1016,7 +1016,7 @@ declare class WebCookie { /** * Get whether file scheme cookies can be send or accepted. - * @return true if can send and accept else false. + * @returns true if can send and accept else false. * @since 9 */ isFileURICookieAllowed(): boolean; @@ -1077,7 +1077,7 @@ declare class WebCookie { * Gets all cookies for the given URL. * * @param url the URL for which the cookies are requested. - * @return the cookie value for the given URL. + * @returns the cookie value for the given URL. * * @since 9 */ @@ -1086,7 +1086,7 @@ declare class WebCookie { /** * Check whether exists any cookies. * - * @return true if exists cookies else false; + * @returns true if exists cookies else false; * @since 9 */ existCookie(): boolean; @@ -1389,7 +1389,7 @@ declare class WebCookie { /** * Gets the url of current Web page. - * @return the url of current Web page. + * @returns the url of current Web page. * @since 9 */ getUrl(): string; @@ -1563,6 +1563,7 @@ declare class WebAttribute extends CommonMethod { * * @since 8 * @deprecated since 9 + * @useinstead ohos.web.WebAttribute#textZoomRatio */ textZoomAtio(textZoomAtio: number): WebAttribute; @@ -1750,6 +1751,7 @@ declare class WebAttribute extends CommonMethod { * * @since 8 * @deprecated since 9 + * @useinstead ohos.web.WebAttribute#onSslErrorEventReceive */ onSslErrorReceive(callback: (event?: { handler: Function, error: object }) => void): WebAttribute; @@ -1776,6 +1778,7 @@ declare class WebAttribute extends CommonMethod { * * @since 8 * @deprecated since 9 + * @useinstead ohos.web.WebAttribute#onRenderExited */ onRenderExited(callback: (event?: { detail: object }) => boolean): WebAttribute; @@ -1785,6 +1788,7 @@ declare class WebAttribute extends CommonMethod { * * @since 8 * @deprecated since 9 + * @useinstead ohos.web.WebAttribute#onShowFileSelector */ onFileSelectorShow(callback: (event?: { callback: Function, fileSelector: object }) => void): WebAttribute; @@ -1829,10 +1833,10 @@ declare class WebAttribute extends CommonMethod { onHttpAuthRequest(callback: (event?: { handler: HttpAuthHandler, host: string, realm: string }) => boolean): WebAttribute; /** - * Triggered when the resouces loading is intercepted. - * @param callback The triggered callback when the resouces loading is intercepted. + * Triggered when the resources loading is intercepted. + * @param callback The triggered callback when the resources loading is intercepted. * - * @return If the response value is null, the Web will continue to load the resouces. Otherwise, the response value will be used + * @returns If the response value is null, the Web will continue to load the resources. Otherwise, the response value will be used * @since 9 */ onInterceptRequest(callback: (event?: { request: WebResourceRequest}) => WebResourceResponse): WebAttribute; @@ -1850,7 +1854,7 @@ declare class WebAttribute extends CommonMethod { * Triggered when called to allow custom display of the context menu. * @param callback The triggered callback when called to allow custom display of the context menu. * - * @return If custom display return true.Otherwise, default display return false. + * @returns If custom display return true.Otherwise, default display return false. * @since 9 */ onContextMenuShow(callback: (event?: { param: WebContextMenuParam, result: WebContextMenuResult }) => boolean): WebAttribute; @@ -1924,4 +1928,4 @@ declare class WebAttribute extends CommonMethod { } declare const Web: WebInterface; -declare const WebInstance: WebAttribute; +declare const WebInstance: WebAttribute; \ No newline at end of file diff --git a/api/@internal/component/ets/xcomponent.d.ts b/api/@internal/component/ets/xcomponent.d.ts index 522fc23bb96e0961b41f5adc36153b84c5006119..27b9e77e4f3e3a2b7d5d0d494873eea05c0571f6 100644 --- a/api/@internal/component/ets/xcomponent.d.ts +++ b/api/@internal/component/ets/xcomponent.d.ts @@ -33,13 +33,13 @@ declare class XComponentController { * Get the id of surface created by XComponent. * @since 9 */ - getXComponentSurfaceId(); + getXComponentSurfaceId(): string; /** * Get the context of native XComponent. * @since 8 */ - getXComponentContext(); + getXComponentContext(): Object; /** * Set the surface size created by XComponent. @@ -53,7 +53,7 @@ declare class XComponentController { setXComponentSurfaceSize(value: { surfaceWidth: number; surfaceHeight: number; - }); + }): void; } /** diff --git a/api/@internal/ets/global.d.ts b/api/@internal/ets/global.d.ts index 8040d61a9866e0ba3f9787ae224eb5cd1a140096..ac16fd7e2d217c38cdabbcb440b730a9858d97d3 100644 --- a/api/@internal/ets/global.d.ts +++ b/api/@internal/ets/global.d.ts @@ -82,7 +82,7 @@ export declare function setInterval(handler: Function | string, delay: number, . export declare function setTimeout(handler: Function | string, delay?: number, ...arguments: any[]): number; /** - * Cancels the interval set by " setInterval()". + * Cancel the interval set by " setInterval()". * @syscap SystemCapability.ArkUI.ArkUI.Full * @param intervalID Indicates the timer ID returned by "setInterval()". * @since 7 @@ -90,7 +90,7 @@ export declare function setTimeout(handler: Function | string, delay?: number, . export declare function clearInterval(intervalID?: number): void; /** - * Cancels the timer set by "setTimeout()". + * Cancel the timer set by "setTimeout()". * @syscap SystemCapability.ArkUI.ArkUI.Full * @param timeoutID Indicates the timer ID returned by "setTimeout()". * @since 7 diff --git a/api/@internal/ets/lifecycle.d.ts b/api/@internal/ets/lifecycle.d.ts index 88a0bce3ec0759de5aaf5797f4e2ba0c3f38de34..5f7160a4e51436ba2c2604c10419232fd4c62345 100644 --- a/api/@internal/ets/lifecycle.d.ts +++ b/api/@internal/ets/lifecycle.d.ts @@ -14,7 +14,7 @@ */ import Want from "../../@ohos.application.Want"; -import ResultSet from "../../data/rdb/resultSet"; +import { ResultSet } from "../../data/rdb/resultSet"; import { AbilityInfo } from "../../bundle/abilityInfo"; import { DataAbilityResult } from "../../ability/dataAbilityResult"; import { DataAbilityOperation } from "../../ability/dataAbilityOperation"; @@ -47,7 +47,7 @@ export declare interface LifecycleForm { * {@link formInfo#FormParam#NAME_KEY}, and {@link formInfo#FormParam#DIMENSION_KEY}, * respectively. Such form information must be managed as persistent data for further form * acquisition, update, and deletion. - * @return Returns the created {@link formBindingData#FormBindingData} object. + * @returns Returns the created {@link formBindingData#FormBindingData} object. * @FAModelOnly */ onCreate?(want: Want): formBindingData.FormBindingData; @@ -58,7 +58,7 @@ export declare interface LifecycleForm { * @since 8 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param formId Indicates the ID of the form. - * @return - + * @returns - * @FAModelOnly */ onCastToNormal?(formId: string): void; @@ -69,7 +69,7 @@ export declare interface LifecycleForm { * @since 8 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param formId Indicates the ID of the form to update. - * @return - + * @returns - * @FAModelOnly */ onUpdate?(formId: string): void; @@ -84,7 +84,7 @@ export declare interface LifecycleForm { * 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 - + * @returns - * @FAModelOnly */ onVisibilityChange?(newStatus: { [key: string]: number }): void; @@ -99,7 +99,7 @@ export declare interface LifecycleForm { * 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 - + * @returns - * @FAModelOnly */ onEvent?(formId: string, message: string): void; @@ -111,7 +111,7 @@ export declare interface LifecycleForm { * @since 8 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param formId Indicates the ID of the deleted form. - * @return - + * @returns - * @FAModelOnly */ onDestroy?(formId: string): void; @@ -126,7 +126,7 @@ export declare interface LifecycleForm { * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param want Indicates the description of the form for which the {@link formInfo#FormState} is obtained. * The description covers the bundle name, ability name, module name, form name, and form dimensions. - * @return Returns the {@link formInfo#FormState} object. + * @returns Returns the {@link formInfo#FormState} object. * @FAModelOnly */ onAcquireFormState?(want: Want): formInfo.FormState; @@ -138,7 +138,7 @@ export declare interface LifecycleForm { * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param formId Indicates the ID of the deleted form. * @systemapi hide for inner use. - * @return Returns the wantParams object. + * @returns Returns the wantParams object. * @FAModelOnly */ onShare?(formId: string): {[key: string]: any}; @@ -158,7 +158,7 @@ export declare interface LifecycleApp { * * @since 7 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @return - + * @returns - * @FAModelOnly */ onShow?(): void; @@ -168,7 +168,7 @@ export declare interface LifecycleApp { * * @since 7 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @return - + * @returns - * @FAModelOnly */ onHide?(): void; @@ -178,7 +178,7 @@ export declare interface LifecycleApp { * * @since 7 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @return - + * @returns - * @FAModelOnly */ onDestroy?(): void; @@ -188,7 +188,7 @@ export declare interface LifecycleApp { * * @since 7 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @return - + * @returns - * @FAModelOnly */ onCreate?(): void; @@ -202,7 +202,7 @@ export declare interface LifecycleApp { * @param isShownInMultiWindow Specifies whether this ability is currently in multi-window mode. * The value {@code true} indicates the multi-window mode, and {@code false} indicates another mode. * @param newConfig Indicates the new configuration information about this Page ability. - * @return - + * @returns - * @systemapi hide for inner use. * @FAModelOnly */ @@ -213,7 +213,7 @@ export declare interface LifecycleApp { * * @since 7 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @return Returns {@code true} if the user allows the migration; returns {@code false} otherwise. + * @returns Returns {@code true} if the user allows the migration; returns {@code false} otherwise. * @FAModelOnly */ onStartContinuation?(): boolean; @@ -226,7 +226,7 @@ export declare interface LifecycleApp { * @since 7 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param data Indicates the user data to save. - * @return Returns {@code true} if the data is successfully saved; returns {@code false} otherwise. + * @returns Returns {@code true} if the data is successfully saved; returns {@code false} otherwise. * @FAModelOnly */ onSaveData?(data: Object): boolean; @@ -241,7 +241,7 @@ export declare interface LifecycleApp { * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param result Indicates the migration result code. The value {@code 0} indicates that the migration is * successful, and {@code -1} indicates that the migration fails. - * @return - + * @returns - * @FAModelOnly */ onCompleteContinuation?(result: number): void; @@ -254,7 +254,7 @@ export declare interface LifecycleApp { * @since 7 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param data Indicates the user data to restore. - * @return - + * @returns - * @FAModelOnly */ onRestoreData?(data: Object): void; @@ -265,7 +265,7 @@ export declare interface LifecycleApp { * * @since 7 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @return - + * @returns - * @FAModelOnly */ onRemoteTerminated?(): void; @@ -279,7 +279,7 @@ export declare interface LifecycleApp { * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param outState Indicates the {@code PacMap} object used for storing user data and states. This * parameter cannot be null. - * @return - + * @returns - * @FAModelOnly */ onSaveAbilityState?(outState: PacMap): void; @@ -293,7 +293,7 @@ export declare interface LifecycleApp { * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param inState Indicates the {@code PacMap} object used for storing data and states. This * parameter can not be null. - * @return - + * @returns - * @FAModelOnly */ onRestoreAbilityState?(inState: PacMap): void; @@ -304,7 +304,7 @@ export declare interface LifecycleApp { * * @since 7 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @return - + * @returns - * @FAModelOnly */ onInactive?(): void; @@ -314,7 +314,7 @@ export declare interface LifecycleApp { * * @since 7 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @return - + * @returns - * @FAModelOnly */ onActive?(): void; @@ -325,7 +325,7 @@ export declare interface LifecycleApp { * @since 7 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param want Indicates the new {@code want} containing information about the ability. - * @return - + * @returns - * @FAModelOnly */ onNewWant?(want: Want): void; @@ -337,7 +337,7 @@ export declare interface LifecycleApp { * @since 7 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param level Indicates the memory trim level, which shows the current memory usage status. - * @return - + * @returns - * @FAModelOnly */ onMemoryLevel?(level: number): void; @@ -358,7 +358,7 @@ export declare interface LifecycleService { * * @since 7 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @return - + * @returns - * @FAModelOnly */ onStart?(): void; @@ -372,7 +372,7 @@ export declare interface LifecycleService { * @param startId Indicates the number of times the Service ability has been started. The {@code startId} is * incremented by 1 every time the ability is started. For example, if the ability has been started * for six times. - * @return - + * @returns - * @FAModelOnly */ onCommand?(want: Want, startId: number): void; @@ -382,7 +382,7 @@ export declare interface LifecycleService { * * @since 7 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @return - + * @returns - * @FAModelOnly */ onStop?(): void; @@ -393,7 +393,7 @@ export declare interface LifecycleService { * @since 7 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param want Indicates connection information about the Service ability. - * @return Returns the proxy of the Service ability. + * @returns Returns the proxy of the Service ability. * @FAModelOnly */ onConnect?(want: Want): rpc.RemoteObject; @@ -404,7 +404,7 @@ export declare interface LifecycleService { * @since 7 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param want Indicates disconnection information about the Service ability. - * @return - + * @returns - * @FAModelOnly */ onDisconnect?(want: Want): void; @@ -419,7 +419,7 @@ export declare interface LifecycleService { * @since 7 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param want Indicates the want of the Service ability being connected. - * @return - + * @returns - * @FAModelOnly */ onReconnect?(want: Want): void; @@ -445,7 +445,7 @@ export declare interface LifecycleData { * default. * @param callback function specified by framework to receive the result, developer should call this function to * return the result to framework. - * @return - + * @returns - * @FAModelOnly */ update?(uri: string, valueBucket: rdb.ValuesBucket, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback): void; @@ -462,7 +462,7 @@ export declare interface LifecycleData { * default. * @param callback function specified by framework to receive the result, developer should call this function to * return the result to framework. - * @return - + * @returns - * @FAModelOnly */ query?(uri: string, columns: Array, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback): void; @@ -477,7 +477,7 @@ export declare interface LifecycleData { * default. * @param callback function specified by framework to receive the result, developer should call this function to * return the result to framework. - * @return - + * @returns - * @FAModelOnly */ delete?(uri: string, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback): void; @@ -492,7 +492,7 @@ export declare interface LifecycleData { * @param uri Indicates the uri to normalize. * @param callback function specified by framework to receive the result, developer should call this function to * return the result to framework. - * @return - + * @returns - * @FAModelOnly */ normalizeUri?(uri: string, callback: AsyncCallback): void; @@ -506,7 +506,7 @@ export declare interface LifecycleData { * @param valueBuckets Indicates the data to insert. * @param callback function specified by framework to receive the result, developer should call this function to * return the result to framework. - * @return - + * @returns - * @FAModelOnly */ batchInsert?(uri: string, valueBuckets: Array, callback: AsyncCallback): void; @@ -520,7 +520,7 @@ export declare interface LifecycleData { * @param uri Indicates the uri to denormalize. * @param callback function specified by framework to receive the result, developer should call this function to * return the result to framework. - * @return - + * @returns - * @FAModelOnly */ denormalizeUri?(uri: string, callback: AsyncCallback): void; @@ -534,7 +534,7 @@ export declare interface LifecycleData { * @param valueBucket Indicates the data to insert. * @param callback function specified by framework to receive the result, developer should call this function to * return the result to framework. - * @return - + * @returns - * @FAModelOnly */ insert?(uri: string, valueBucket: rdb.ValuesBucket, callback: AsyncCallback): void; @@ -551,7 +551,7 @@ export declare interface LifecycleData { * existing data, or "rwt" for read and write access that truncates any existing file. * @param callback function specified by framework to receive the result, developer should call this function to * return the result to framework. - * @return - + * @returns - * @FAModelOnly */ openFile?(uri: string, mode: string, callback: AsyncCallback): void; @@ -569,7 +569,7 @@ export declare interface LifecycleData { *

3. "*/jpg": Obtains files whose subtype is JPG of any main type. * @param callback function specified by framework to receive the result, developer should call this function to * return the result to framework. - * @return - + * @returns - * @FAModelOnly */ getFileTypes?(uri: string, mimeTypeFilter: string, callback: AsyncCallback>): void; @@ -580,7 +580,7 @@ export declare interface LifecycleData { * @since 7 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param info Indicates the {@code AbilityInfo} object containing information about this ability. - * @return - + * @returns - * @FAModelOnly */ onInitialized?(info: AbilityInfo): void; @@ -596,7 +596,7 @@ export declare interface LifecycleData { * @param uri Indicates the uri of the data. * @param callback function specified by framework to receive the result, developer should call this function to * return the result to framework. - * @return - + * @returns - * @FAModelOnly */ getType?(uri: string, callback: AsyncCallback): void; @@ -609,7 +609,7 @@ export declare interface LifecycleData { * @param ops Indicates the data operation list, which can contain multiple operations on the database. * @param callback function specified by framework to receive the result, developer should call this function to * return the result to framework. - * @return - + * @returns - * @FAModelOnly */ executeBatch?(ops: Array, callback: AsyncCallback>): void; @@ -624,7 +624,7 @@ export declare interface LifecycleData { * @param extras Indicates the parameter transferred by the method. * @param callback function specified by framework to receive the result, developer should call this function to * return the result to framework. - * @return - + * @returns - * @FAModelOnly */ call?(method: string, arg: string, extras: PacMap, callback: AsyncCallback): void; diff --git a/api/@ohos.Stationary.d.ts b/api/@ohos.Stationary.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9412317be75d7887f513b5d59e7902fa3ecf2266 --- /dev/null +++ b/api/@ohos.Stationary.d.ts @@ -0,0 +1,118 @@ +/* + * 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 { Callback } from "./basic"; + +/** + * Declares a namespace that provides APIs to report the device status. + * + * @since 9 + * @syscap SystemCapability.Msdp.DeviceStatus.Stationary + */ +declare namespace Stationary { + /** + * Declares a response interface to receive the device status. + * + * @syscap SystemCapability.Msdp.DeviceStatus.Stationary + * @since 9 + */ + interface ActivityResponse { + state: ActivityState; + } + + /** + * Declares the device status type. + * + * @syscap SystemCapability.Msdp.DeviceStatus.Stationary + * @since 9 + */ + type ActivityType = 'still' | 'relativeStill'; + + /** + * Enumerates the device status events. + * + * @syscap SystemCapability.Msdp.DeviceStatus.Stationary + * @since 9 + */ + enum ActivityEvent { + /** + * Event indicating entering device status. + */ + ENTER = 1, + + /** + * Event indicating exiting device status. + */ + EXIT = 2, + + /** + * Event indicating entering and exiting device status. + */ + ENTER_EXIT = 3 + } + + /** + * Declares a response interface to receive the device status. + * + * @syscap SystemCapability.Msdp.DeviceStatus.Stationary + * @since 9 + */ + enum ActivityState { + /** + * Entering device status. + */ + ENTER = 1, + + /** + * Exiting device status. + */ + EXIT = 2 + } + + /** + * Subscribes to the device status. + * + * @param activity Indicates the device status type. For details, see {@code type: ActivityType}. + * @param event Indicates the device status event. + * @param reportLatencyNs Indicates the event reporting period. + * @param callback Indicates the callback for receiving reported data. + * @syscap SystemCapability.Msdp.DeviceStatus.Stationary + * @since 9 + */ + function on(activity: ActivityType, event: ActivityEvent, reportLatencyNs: number, callback: Callback): void; + + /** + * Obtains the device status. + * + * @param activity Indicates the device status type. For details, see {@code type: ActivityType}. + * @param callback Indicates the callback for receiving reported data. + * @syscap SystemCapability.Msdp.DeviceStatus.Stationary + * @since 9 + */ + function once(activity: ActivityType, callback: Callback): void; + + /** + * Unsubscribes from the device status. + * + * @param activity Indicates the device status type. For details, see {@code type: ActivityType}. + * @param event Indicates the device status event. + * @param callback Indicates the callback for receiving reported data. + * @syscap SystemCapability.Msdp.DeviceStatus.Stationary + * @since 9 + */ + function off(activity: ActivityType, event: ActivityEvent, callback?: Callback): void; +} + +export default deviceStatus; diff --git a/api/@ohos.WorkSchedulerExtensionAbility.d.ts b/api/@ohos.WorkSchedulerExtensionAbility.d.ts index df30bd831e426edec007243471ac505d27209e50..e84ee214c257927a1d5e2aa2b3af5e6167f671f4 100644 --- a/api/@ohos.WorkSchedulerExtensionAbility.d.ts +++ b/api/@ohos.WorkSchedulerExtensionAbility.d.ts @@ -13,7 +13,7 @@ * limitations under the License. */ -import workScheduler from "./@ohos.workScheduler"; +import workScheduler from "./@ohos.resourceschedule.workScheduler"; /** * Class of the work scheduler extension ability. diff --git a/api/@ohos.ability.ability.d.ts b/api/@ohos.ability.ability.d.ts index 44be58f12e8b9ef4cb8065dcefc71c68003f576b..dde29080261399f4c2f9b1ff815d44b17855456e 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 { @@ -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.ability.featureAbility.d.ts b/api/@ohos.ability.featureAbility.d.ts index 944d6d321bf4df658cc2725939bf90ecf744ea0c..1e5ad97bdd522e746d87579f337857477d9009cb 100644 --- a/api/@ohos.ability.featureAbility.d.ts +++ b/api/@ohos.ability.featureAbility.d.ts @@ -35,12 +35,12 @@ import window from './@ohos.window'; */ declare namespace featureAbility { /** - * Obtain the want sended from the source ability. + * Obtain the want sent from the source ability. * * @since 6 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param parameter Indicates the ability to start. - * @return - + * @returns - * @FAModelOnly */ function getWant(callback: AsyncCallback): void; @@ -52,7 +52,7 @@ declare namespace featureAbility { * @since 6 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param parameter Indicates the ability to start. - * @return - + * @returns - * @FAModelOnly */ function startAbility(parameter: StartAbilityParameter, callback: AsyncCallback): void; @@ -62,7 +62,7 @@ declare namespace featureAbility { * Obtains the application context. * * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @return Returns the application context. + * @returns Returns the application context. * @since 6 * @FAModelOnly */ @@ -74,7 +74,7 @@ declare namespace featureAbility { * @since 7 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param parameter Indicates the ability to start. - * @return Returns the {@link AbilityResult}. + * @returns Returns the {@link AbilityResult}. * @FAModelOnly */ function startAbilityForResult(parameter: StartAbilityParameter, callback: AsyncCallback): void; @@ -87,7 +87,7 @@ declare namespace featureAbility { * @since 7 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param parameter Indicates the result to return. - * @return - + * @returns - * @FAModelOnly */ function terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback): void; @@ -98,7 +98,7 @@ declare namespace featureAbility { * * @since 7 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @return - + * @returns - * @FAModelOnly */ function terminateSelf(callback: AsyncCallback): void; @@ -110,7 +110,7 @@ declare namespace featureAbility { * @since 7 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param uri Indicates the path of the file to open. - * @return Returns the dataAbilityHelper. + * @returns Returns the dataAbilityHelper. * @FAModelOnly */ function acquireDataAbilityHelper(uri: string): DataAbilityHelper; @@ -120,7 +120,7 @@ declare namespace featureAbility { * * @since 7 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @return Returns {@code true} if this ability currently has window focus; returns {@code false} otherwise. + * @returns Returns {@code true} if this ability currently has window focus; returns {@code false} otherwise. * @FAModelOnly */ function hasWindowFocus(callback: AsyncCallback): void; @@ -133,7 +133,7 @@ declare namespace featureAbility { * @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 + * @returns Returns the number code of the ability connected * @FAModelOnly */ function connectAbility(request: Want, options:ConnectOptions ): number; @@ -154,7 +154,7 @@ declare namespace featureAbility { * * @since 7 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @return Returns the window corresponding to the current ability. + * @returns Returns the window corresponding to the current ability. * @FAModelOnly */ function getWindow(callback: AsyncCallback): void; @@ -223,7 +223,6 @@ declare namespace featureAbility { * * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @import import abilityManager from 'app/context' * @FAModelOnly */ export type Context = _Context @@ -239,7 +238,6 @@ declare namespace featureAbility { * @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 } diff --git a/api/@ohos.ability.particleAbility.d.ts b/api/@ohos.ability.particleAbility.d.ts index 04321ffcd7a9455510aa33a4ccfaa8ab1c040658..9c02954c621e37b40b1c42e6c89e626050ad6536 100644 --- a/api/@ohos.ability.particleAbility.d.ts +++ b/api/@ohos.ability.particleAbility.d.ts @@ -35,7 +35,7 @@ declare namespace particleAbility { * @since 7 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param parameter Indicates the ability to start. - * @return - + * @returns - * @FAModelOnly */ function startAbility(parameter: StartAbilityParameter, callback: AsyncCallback): void; @@ -46,7 +46,7 @@ declare namespace particleAbility { * * @since 7 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel - * @return - + * @returns - * @FAModelOnly */ function terminateSelf(callback: AsyncCallback): void; @@ -58,7 +58,7 @@ declare namespace particleAbility { * @since 7 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel * @param uri Indicates the path of the file to open. - * @return Returns the dataAbilityHelper. + * @returns Returns the dataAbilityHelper. * @FAModelOnly */ function acquireDataAbilityHelper(uri: string): DataAbilityHelper; @@ -72,7 +72,8 @@ declare namespace particleAbility { * @param id Identifies the notification bar information. * @param request Indicates the notificationRequest instance containing information for displaying a notification bar. * @FAModelOnly - * @deprecated + * @deprecated since 9 + * @useinstead ohos.resourceschedule.backgroundTaskManager.startBackgroundRunning */ function startBackgroundRunning(id: number, request: NotificationRequest, callback: AsyncCallback): void; function startBackgroundRunning(id: number, request: NotificationRequest): Promise; @@ -83,7 +84,8 @@ declare namespace particleAbility { * @since 7 * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask * @FAModelOnly - * @deprecated + * @deprecated since 9 + * @useinstead ohos.resourceschedule.backgroundTaskManager.stopBackgroundRunning */ function cancelBackgroundRunning(callback: AsyncCallback): void; function cancelBackgroundRunning(): Promise; @@ -95,7 +97,7 @@ declare namespace particleAbility { * @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. + * @returns unique identifier of the connection between the client and the service side. * @FAModelOnly */ function connectAbility(request: Want, options:ConnectOptions): number; diff --git a/api/@ohos.ability.wantConstant.d.ts b/api/@ohos.ability.wantConstant.d.ts index 15ce6b7a38b7e0742efabde7e282d361b7686d59..9947e21351944b18ae6d31b2cbae64c0d4ea35c9 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 { /** @@ -219,11 +221,11 @@ declare namespace wantConstant { ACTION_APP_ACCOUNT_OAUTH = "ohos.account.appAccount.action.oauth", /** - * Indicates the action of providing auth service. + * Indicates the action of providing the application account auth service. * * @since 9 */ - ACTION_APP_ACCOUNT_AUTH = "account.appAccount.action.auth", + ACTION_APP_ACCOUNT_AUTH = "ohos.appAccount.action.auth", /** * Indicates the action of an application downloaded from the application market. @@ -393,7 +395,7 @@ declare namespace wantConstant { FLAG_INSTALL_ON_DEMAND = 0x00000800, /** - * Install the specifiedi ability with background mode if it's not installed. + * Install the specified ability with background mode if it's not installed. */ FLAG_INSTALL_WITH_BACKGROUND_MODE = 0x80000000, diff --git a/api/@ohos.abilityAccessCtrl.d.ts b/api/@ohos.abilityAccessCtrl.d.ts index a8c7a3a08ec7f0037f93a8df44c47a3ffef57c30..23474f7e6ff67c939e779ee0c6a074513fe765d5 100644 --- a/api/@ohos.abilityAccessCtrl.d.ts +++ b/api/@ohos.abilityAccessCtrl.d.ts @@ -42,6 +42,14 @@ import { Permissions } from './permissions'; * @useinstead ohos.abilityAccessCtrl.AtManager#checkAccessToken */ verifyAccessToken(tokenID: number, permissionName: string): Promise; + + /** + * Checks whether a specified application has been granted the given permission. + * @param tokenID The tokenId of specified application. + * @param permissionName The permission name to be verified. Permissions type only support the valid permission name. + * @return Returns permission verify result. + * @since 9 + */ verifyAccessToken(tokenID: number, permissionName: Permissions): Promise; /** diff --git a/api/@ohos.accessibility.config.d.ts b/api/@ohos.accessibility.config.d.ts index 2dfac6d56a12e8b0f7d6f5389a8e05bf6d719822..690c702cff722a9bcc8a12bc1cba09c778ec90e4 100644 --- a/api/@ohos.accessibility.config.d.ts +++ b/api/@ohos.accessibility.config.d.ts @@ -77,6 +77,10 @@ declare namespace config { * Enable the accessibility extension ability. * @param name Indicates the accessibility extension name, in "bundleName/abilityName" format. * @param capability Indicates the ability. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Input parameter error. + * @throws { BusinessError } 9300001 - Invalid bundle name or ability name. + * @throws { BusinessError } 9300002 - Target ability already enabled. */ function enableAbility(name: string, capability: Array): Promise; function enableAbility(name: string, capability: Array, callback: AsyncCallback): void; @@ -84,23 +88,28 @@ declare namespace config { /** * Disable the accessibility extension ability. * @param name Indicates the accessibility extension name, in "bundleName/abilityName" format. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Input parameter error. + * @throws { BusinessError } 9300001 - Invalid bundle name or ability name. */ function disableAbility(name: string): Promise; function disableAbility(name: string, callback: AsyncCallback): void; /** * Register the listener that watches for changes in the enabled status of accessibility extensions. - * @param type Indicates the enableAbilityListsStateChanged type. + * @param type Indicates the type of event. * @param callback Indicates the listener. + * @throws { BusinessError } 401 - Input parameter error. */ - function on(type: 'enableAbilityListsStateChanged', callback: Callback): void; + function on(type: 'enabledAccessibilityExtensionListChange', callback: Callback): void; /** - * Deregister listener that watches for changes in the enabled status of accessibility extensions. - * @param type Indicates the enableAbilityListsStateChanged type. + * Unregister listener that watches for changes in the enabled status of accessibility extensions. + * @param type Indicates the type of event. * @param callback Indicates the listener. + * @throws { BusinessError } 401 - Input parameter error. */ - function off(type: 'enableAbilityListsStateChanged', callback?: Callback): void; + function off(type: 'enabledAccessibilityExtensionListChange', callback?: Callback): void; /** * Indicates setting, getting, and listening to changes in configuration. @@ -109,6 +118,8 @@ declare namespace config { /** * Setting configuration value. * @param value Indicates the value. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Input parameter error. */ set(value: T): Promise; set(value: T, callback: AsyncCallback): void; @@ -122,11 +133,12 @@ declare namespace config { /** * Register the listener to listen for configuration changes. * @param callback Indicates the listener. + * @throws { BusinessError } 401 - Input parameter error. */ on(callback: Callback): void; /** - * Deregister the listener to listen for configuration changes. + * Unregister the listener to listen for configuration changes. * @param callback Indicates the listener. */ off(callback?: Callback): void; diff --git a/api/@ohos.accessibility.d.ts b/api/@ohos.accessibility.d.ts index 50f45c02511d3221390c5f66ef819796005be0cf..597532bead60ef1044c29d7a2511495dacfca073 100644 --- a/api/@ohos.accessibility.d.ts +++ b/api/@ohos.accessibility.d.ts @@ -21,16 +21,21 @@ import { Callback } from './basic'; * @name Accessibility * @since 7 * @syscap SystemCapability.BarrierFree.Accessibility.Core - * @import basic,abilityInfo */ declare namespace accessibility { - /** * The type of the Ability app. + * @type { 'audible' | 'generic' | 'haptic' | 'spoken' | 'visual' } * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 7 */ - type AbilityType = 'audible' | 'generic' | 'haptic' | 'spoken' | 'visual'; + /** + * The type of the Ability app. + * @type { 'audible' | 'generic' | 'haptic' | 'spoken' | 'visual' | 'all' } + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @since 9 + */ + type AbilityType = 'audible' | 'generic' | 'haptic' | 'spoken' | 'visual' | 'all'; /** * The action that the ability can execute. @@ -43,12 +48,6 @@ declare namespace accessibility { /** * The type of the accessibility event. - * @note windowsChange - * @note windowContentChange - * @note windowStateChange - * @note announcement - * @note notificationChange - * @note textTraversedAtMove * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 7 */ @@ -58,7 +57,6 @@ declare namespace accessibility { /** * The change type of the windowsChange event. - * @note It's used when received the {@code windowsChange} event. * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 7 */ @@ -73,12 +71,6 @@ declare namespace accessibility { /** * The ability that accessibility subsystem support. - * @note touchExplorer: Describes the capability to talkback. - * magnification: Describes the capability to request to control the display magnification. - * gesturesSimulation: Describes the capability to request to simulate the gesture. - * windowContent: Describes the capability to search for the content of the active window. - * filterKeyEvents: Describes the capability to request to filter key events. - * fingerprintGesture: Describes the capability to request to fingerprint gesture. * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 7 */ @@ -86,7 +78,6 @@ declare namespace accessibility { /** * The granularity of text move. - * @note The granularity of text move. * @syscap SystemCapability.BarrierFree.Accessibility.Core * @since 7 */ @@ -97,8 +88,8 @@ declare namespace accessibility { * @since 7 * @param callback Asynchronous callback interface. * @syscap SystemCapability.BarrierFree.Accessibility.Core - * @return Returns {@code true} if the accessibility is enabled; returns {@code false} otherwise. - */ + * @returns Returns {@code true} if the accessibility is enabled; returns {@code false} otherwise. + */ function isOpenAccessibility(callback: AsyncCallback): void; function isOpenAccessibility(): Promise; @@ -107,8 +98,8 @@ declare namespace accessibility { * @since 7 * @param callback Asynchronous callback interface. * @syscap SystemCapability.BarrierFree.Accessibility.Vision - * @return Returns {@code true} if the touch browser is enabled; returns {@code false} otherwise. - */ + * @returns Returns {@code true} if the touch browser is enabled; returns {@code false} otherwise. + */ function isOpenTouchGuide(callback: AsyncCallback): void; function isOpenTouchGuide(): Promise; @@ -118,25 +109,27 @@ declare namespace accessibility { * @param abilityType The type of the accessibility ability. {@code AbilityType} eg.spoken * @param stateType The state of the accessibility ability. {@code AbilityState} eg.installed * @syscap SystemCapability.BarrierFree.Accessibility.Core - * @return Returns the list of abilityInfos. - */ + * @returns Returns the list of abilityInfos. + * @deprecated since 9 + * @useinstead ohos.accessibility#getAccessibilityExtensionList + */ function getAbilityLists(abilityType: AbilityType, stateType: AbilityState, callback: AsyncCallback>): void; function getAbilityLists(abilityType: AbilityType, stateType: AbilityState): Promise>; + /** * Queries the list of accessibility abilities. * @since 9 - * @param abilityType The all type of the accessibility ability. + * @param abilityType The type of the accessibility ability. {@code AbilityType} eg.spoken * @param stateType The state of the accessibility ability. {@code AbilityState} eg.installed * @syscap SystemCapability.BarrierFree.Accessibility.Core - * @return Returns the list of abilityInfos. - */ - function getAbilityLists(abilityType: 'all', stateType: AbilityState, - callback: AsyncCallback>): void; - function getAbilityLists(abilityType: 'all', - stateType: AbilityState): Promise>; + * @returns Returns the list of abilityInfos. + * @throws { BusinessError } 401 - Input parameter error. + */ + function getAccessibilityExtensionList(abilityType: AbilityType, stateType: AbilityState): Promise>; + function getAccessibilityExtensionList(abilityType: AbilityType, stateType: AbilityState, callback: AsyncCallback>): void; /** * Send accessibility Event. @@ -144,47 +137,65 @@ declare namespace accessibility { * @param event The object of the accessibility {@code EventInfo} . * @param callback Asynchronous callback interface. * @syscap SystemCapability.BarrierFree.Accessibility.Core - * @return Returns {@code true} if success ; returns {@code false} otherwise. + * @returns Returns {@code true} if success ; returns {@code false} otherwise. + * @deprecated since 9 + * @useinstead ohos.accessibility#sendAccessibilityEvent */ function sendEvent(event: EventInfo, callback: AsyncCallback): void; function sendEvent(event: EventInfo): Promise; /** - * Register the observe of the accessibility state changed. + * Send accessibility event. + * @since 9 + * @param event The object of the accessibility {@code EventInfo} . + * @param callback Asynchronous callback interface. + * @syscap SystemCapability.BarrierFree.Accessibility.Core + * @returns Returns {@code true} if success ; returns {@code false} otherwise. + * @throws { BusinessError } 401 - Input parameter error. + */ + function sendAccessibilityEvent(event: EventInfo, callback: AsyncCallback): void; + function sendAccessibilityEvent(event: EventInfo): Promise; + + /** + * Register the observer of the accessibility state changed. * @since 7 * @param type state event type. * @param callback Asynchronous callback interface. * @syscap SystemCapability.BarrierFree.Accessibility.Core - * @return Returns {@code true} if the register is success ; returns {@code false} otherwise. + * @returns Returns {@code true} if the register is success ; returns {@code false} otherwise. + * @throws { BusinessError } 401 - Input parameter error. */ function on(type: 'accessibilityStateChange', callback: Callback): void; /** - * Register the observe of the touchGuide state changed. + * Register the observer of the touchGuide state changed. * @since 7 * @param type state event type. * @param callback Asynchronous callback interface. * @syscap SystemCapability.BarrierFree.Accessibility.Vision - * @return Returns {@code true} if the register is success ; returns {@code false} otherwise. + * @returns Returns {@code true} if the register is success ; returns {@code false} otherwise. + * @throws { BusinessError } 401 - Input parameter error. */ function on(type: 'touchGuideStateChange', callback: Callback): void; /** - * Deregister the observe of the accessibility state changed. + * Unregister the observer of the accessibility state changed. * @since 7 * @param type state event type * @param callback Asynchronous callback interface. * @syscap SystemCapability.BarrierFree.Accessibility.Core - * @return Returns {@code true} if the deregister is success ; returns {@code false} otherwise. + * @returns Returns {@code true} if the Unregister is success ; returns {@code false} otherwise. + * @throws { BusinessError } 401 - Input parameter error. */ function off(type: 'accessibilityStateChange', callback?: Callback): void; /** - * Deregister the observe of the touchGuide state changed. + * Unregister the observer of the touchGuide state changed. * @since 7 * @param type state event type * @param callback Asynchronous callback interface. - * @return Returns {@code true} if the deregister is success ; returns {@code false} otherwise. + * @returns Returns {@code true} if the Unregister is success ; returns {@code false} otherwise. + * @throws { BusinessError } 401 - Input parameter error. */ function off(type: 'touchGuideStateChange', callback?: Callback): void; @@ -192,7 +203,7 @@ declare namespace accessibility { * Get the captions manager. * @syscap SystemCapability.BarrierFree.Accessibility.Hearing * @since 8 - * @return Returns the captions manager. + * @returns Returns the captions manager. */ function getCaptionsManager(): CaptionsManager; @@ -212,19 +223,26 @@ declare namespace accessibility { style: CaptionsStyle; /** - * Register the observe of the enable state. + * Register the observer of the enable state. + * @throws { BusinessError } 401 - Input parameter error. */ on(type: 'enableChange', callback: Callback): void; + /** * Register the observer of the style. + * @throws { BusinessError } 401 - Input parameter error. */ on(type: 'styleChange', callback: Callback): void; + /** - * Deregister the observe of the enable state. + * Unregister the observer of the enable state. + * @throws { BusinessError } 401 - Input parameter error. */ off(type: 'enableChange', callback?: Callback): void; + /** - * Deregister the observer of the style. + * Unregister the observer of the style. + * @throws { BusinessError } 401 - Input parameter error. */ off(type: 'styleChange', callback?: Callback): void; } @@ -383,7 +401,6 @@ declare namespace accessibility { /** * The content list. - * @note * @since 7 */ contents?: Array; @@ -414,7 +431,6 @@ declare namespace accessibility { /** * The total of the items. - * @note talkback used it when scroll. * @since 7 */ itemCount?: number; diff --git a/api/@ohos.account.appAccount.d.ts b/api/@ohos.account.appAccount.d.ts index c1c808ad92bd76176f2a1a85d9a7947be5cdde77..2d4f53cb3673bc15786d47426c787e0249d0b214 100644 --- a/api/@ohos.account.appAccount.d.ts +++ b/api/@ohos.account.appAccount.d.ts @@ -65,8 +65,8 @@ declare namespace appAccount { * @throws {BusinessError} 401 - the parameter check failed. * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid name or options. - * @throws {BusinessError} 12300008 - the account indicated by name already exist. - * @throws {BusinessError} 12300011 - the account number has reached the upper limit. + * @throws {BusinessError} 12300004 - the account indicated by name already exist. + * @throws {BusinessError} 12300007 - the account number has reached the upper limit. * @since 9 */ createAccount(name: string, callback: AsyncCallback): void; @@ -95,8 +95,10 @@ declare namespace appAccount { * @throws {BusinessError} 401 - the parameter check failed. * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid owner or options. - * @throws {BusinessError} 12300011 - the account number has reached the upper limit. - * @throws {BusinessError} 12400002 - the account authenticator service does not exist. + * @throws {BusinessError} 12300007 - the account number has reached the upper limit. + * @throws {BusinessError} 12300010 - account service busy. + * @throws {BusinessError} 12300113 - the account authenticator service does not exist. + * @throws {BusinessError} 12300114 - authenticator service exception. * @since 9 */ createAccountImplicitly(owner: string, callback: AuthCallback): void; @@ -166,7 +168,7 @@ declare namespace appAccount { * @returns void. * @throws {BusinessError} 401 - the parameter check failed. * @throws {BusinessError} 12300001 - system service exception. - * @throws {BusinessError} 12300002 - invalid name or bundlename. + * @throws {BusinessError} 12300002 - invalid name or bundle name. * @throws {BusinessError} 12300003 - the account indicated by localId dose not exist. * @throws {BusinessError} 12400001 - the application indicated by bundlename does not exist. * @since 9 @@ -182,9 +184,8 @@ declare namespace appAccount { * @returns void. * @throws {BusinessError} 401 - the parameter check failed. * @throws {BusinessError} 12300001 - system service exception. - * @throws {BusinessError} 12300002 - invalid name or bundlename. + * @throws {BusinessError} 12300002 - invalid name or bundle name. * @throws {BusinessError} 12300003 - the account indicated by localId dose not exist. - * @throws {BusinessError} 12400001 - the application indicated by bundlename does not exist. * @since 9 */ checkAppAccess(name: string, bundleName: string, callback: AsyncCallback): void; @@ -197,7 +198,7 @@ declare namespace appAccount { * through the distributed networking. On the connected devices, you can call this method to check * whether application data can be synchronized. *

- * @permission ohos.permission.DISTRIBUTED_DATASYNC. + * @permission ohos.permission.DISTRIBUTED_DATASYNC * @param name Indicates the name of the application account. * @returns Returns {@code true} if application data synchronization is allowed; returns {@code false} otherwise. * @since 7 @@ -214,7 +215,7 @@ declare namespace appAccount { * through the distributed networking. On the connected devices, you can call this method to check * whether application data can be synchronized. *

- * @permission ohos.permission.DISTRIBUTED_DATASYNC. + * @permission ohos.permission.DISTRIBUTED_DATASYNC * @param name Indicates the name of the application account. * @returns Returns {@code true} if application data synchronization is allowed; returns {@code false} otherwise. * @throws {BusinessError} 201 - permission denied. @@ -249,7 +250,7 @@ declare namespace appAccount { * @returns void. * @throws {BusinessError} 401 - the parameter check failed. * @throws {BusinessError} 12300001 - system service exception. - * @throws {BusinessError} 12300002 - invalid name or credentialType. + * @throws {BusinessError} 12300002 - invalid name, credentialType or credential. * @throws {BusinessError} 12300003 - the account indicated by localId dose not exist. * @since 9 */ @@ -267,6 +268,7 @@ declare namespace appAccount { * @returns void. * @since 7 * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#setCustomData */ setAccountExtraInfo(name: string, extraInfo: string, callback: AsyncCallback): void; setAccountExtraInfo(name: string, extraInfo: string): Promise; @@ -275,7 +277,7 @@ declare namespace appAccount { * Sets whether a specified application account allows application data synchronization. *

* If the same OHOS account has logged in to multiple devices, these devices constitute a super device - * through the distributed networking. On the networked devices, you can call this method to set whether to + * through the distributed networking. On the connected devices, you can call this method to set whether to * allow cross-device data synchronization. If synchronization is allowed, application data can be synchronized * among these devices in the event of any changes related to the application account. * If synchronization is not allowed, the application data is stored only on the local device. @@ -286,7 +288,7 @@ declare namespace appAccount { * Application data that can be synchronized: application account name, token, * and data associated with this application account *

- * @permission ohos.permission.DISTRIBUTED_DATASYNC. + * @permission ohos.permission.DISTRIBUTED_DATASYNC * @param name Indicates the name of the application account. * @param isEnable Specifies whether to allow application data synchronization. * @returns void. @@ -301,7 +303,7 @@ declare namespace appAccount { * Sets whether a specified application account enables application data synchronization. *

* If the same OHOS account has logged in to multiple devices, these devices constitute a super device - * through the distributed networking. On the networked devices, you can call this method to set whether to + * through the distributed networking. On the connected devices, you can call this method to set whether to * enable cross-device data synchronization. If synchronization is enabled, application data can be synchronized * among these devices in the event of any changes related to the application account. * If synchronization is not enabled, the application data is stored only on the local device. @@ -312,7 +314,7 @@ declare namespace appAccount { * Application data that can be synchronized: application account name, token, * and data associated with this application account *

- * @permission ohos.permission.DISTRIBUTED_DATASYNC. + * @permission ohos.permission.DISTRIBUTED_DATASYNC * @param name Indicates the name of the application account. * @param isEnabled Specifies whether to enable application data synchronization. * @returns void. @@ -349,7 +351,7 @@ declare namespace appAccount { * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid name, key or value. * @throws {BusinessError} 12300003 - the account indicated by name dose not exist. - * @throws {BusinessError} 12400008 - the number of customized data has reached the upper limit. + * @throws {BusinessError} 12400003 - the number of customized data has reached the upper limit. * @since 9 */ setCustomData(name: string, key: string, value: string, callback: AsyncCallback): void; @@ -364,7 +366,7 @@ declare namespace appAccount { *

  • Accounts of third-party applications. To obtain such information, * your application must have gained authorization from the third-party applications.
  • * - * @permission ohos.permission.GET_ALL_APP_ACCOUNTS. + * @permission ohos.permission.GET_ALL_APP_ACCOUNTS * @returns Returns a list of application accounts. * @since 7 * @deprecated since 9 @@ -382,7 +384,7 @@ declare namespace appAccount { *
  • Accounts of third-party applications. To obtain such information, * your application must have gained authorization from the third-party applications.
  • * - * @permission ohos.permission.GET_ALL_APP_ACCOUNTS. + * @permission ohos.permission.GET_ALL_APP_ACCOUNTS * @returns Returns a list of application accounts. * @throws {BusinessError} 201 - permission denied. * @throws {BusinessError} 401 - the parameter check failed. @@ -401,7 +403,7 @@ declare namespace appAccount { *
  • Accounts of third-party applications. To obtain such information, * your application must have gained authorization from the third-party applications.
  • * - * @permission ohos.permission.GET_ALL_APP_ACCOUNTS. + * @permission ohos.permission.GET_ALL_APP_ACCOUNTS * @param owner Indicates the account owner of your application or third-party applications. * @returns Returns a list of application accounts. * @since 7 @@ -420,14 +422,14 @@ declare namespace appAccount { *
  • Accounts of third-party applications. To obtain such information, * your application must have gained authorization from the third-party applications.
  • * - * @permission ohos.permission.GET_ALL_APP_ACCOUNTS. + * @permission ohos.permission.GET_ALL_APP_ACCOUNTS * @param owner Indicates the account owner of your application or third-party applications. * @returns Returns a list of application accounts. * @throws {BusinessError} 201 - permission denied. * @throws {BusinessError} 401 - the parameter check failed. * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid owner. - * @throws {BusinessError} 12300003 - the account indicated by owner dose not exist. + * @throws {BusinessError} 12400001 - the application indicated by bundle name does not exist. * @since 9 */ getAccountsByOwner(owner: string, callback: AsyncCallback>): void; @@ -454,7 +456,7 @@ declare namespace appAccount { * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid name or credentialType. * @throws {BusinessError} 12300003 - the account indicated by name dose not exist. - * @throws {BusinessError} 12300019 - credential does not exist. + * @throws {BusinessError} 12300102 - credential does not exist. * @since 9 */ getCredential(name: string, credentialType: string, callback: AsyncCallback): void; @@ -467,6 +469,7 @@ declare namespace appAccount { * for example, if the account does not exist. * @since 7 * @deprecated since 9 + * @useinstead appAccount.AppAccountManager#getCustomData */ getAccountExtraInfo(name: string, callback: AsyncCallback): void; getAccountExtraInfo(name: string): Promise; @@ -492,7 +495,7 @@ declare namespace appAccount { * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid name or key. * @throws {BusinessError} 12300003 - the account indicated by name dose not exist. - * @throws {BusinessError} 12400009 - the customData does not exist. + * @throws {BusinessError} 12400002 - the customData does not exist. * @since 9 */ getCustomData(name: string, key: string, callback: AsyncCallback): void; @@ -507,6 +510,7 @@ declare namespace appAccount { * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid name or key. * @throws {BusinessError} 12300003 - the account indicated by name dose not exist. + * @throws {BusinessError} 12400002 - the customData does not exist. * @since 9 */ getCustomDataSync(name: string, key: string): string; @@ -536,8 +540,8 @@ declare namespace appAccount { * @throws {BusinessError} 401 - the parameter check failed. * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid type or owners. - * @throws {BusinessError} 12300003 - the account indicated by owners dose not exist. - * @throws {BusinessError} 12300005 - the listener has been registered. + * @throws {BusinessError} 12300011 - the callback has been registered. + * @throws {BusinessError} 12400001 - the application indicated by owner does not exist. * @since 9 */ on(type: 'accountChange', owners: Array, callback: Callback>): void; @@ -557,7 +561,7 @@ declare namespace appAccount { * @throws {BusinessError} 401 - the parameter check failed. * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid type. - * @throws {BusinessError} 12300005 - the listener has been registered. + * @throws {BusinessError} 12300012 - the callback has not been registered. * @since 9 */ off(type: 'accountChange', callback?: Callback>): void; @@ -588,10 +592,9 @@ declare namespace appAccount { * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid name, owner, authType or options. * @throws {BusinessError} 12300003 - the account indicated by owner dose not exist. - * @throws {BusinessError} 12300016 - authentication timeout. - * @throws {BusinessError} 12300017 - authentication service is busy. - * @throws {BusinessError} 12300018 - authentication service is locked. - * @throws {BusinessError} 12400001 - the application indicated by name does not exist. + * @throws {BusinessError} 12300010 - account service busy. + * @throws {BusinessError} 12300113 - the account authenticator service does not exist. + * @throws {BusinessError} 12300114 - authenticator service exception. * @since 9 */ auth(name: string, owner: string, authType: string, callback: AuthCallback): void; @@ -620,8 +623,7 @@ declare namespace appAccount { * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid name, owner or authType. * @throws {BusinessError} 12300003 - the account indicated by owner dose not exist. - * @throws {BusinessError} 12300015 - the authType is not supported on current device. - * @throws {BusinessError} 12400001 - the application indicated by name does not exist. + * @throws {BusinessError} 12300107 - the authType is not found. * @since 9 */ getAuthToken(name: string, owner: string, authType: string, callback: AsyncCallback): void; @@ -654,9 +656,7 @@ declare namespace appAccount { * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid name, owner, authType or token. * @throws {BusinessError} 12300003 - the account indicated by name dose not exist. - * @throws {BusinessError} 12300015 - the authType is not supported on current device. - * @throws {BusinessError} 12300019 - credential does not exist. - * @throws {BusinessError} 12400007 - the number of token has reached the upper limit. + * @throws {BusinessError} 12400004 - the number of token has reached the upper limit. * @since 9 */ setAuthToken(name: string, authType: string, token: string, callback: AsyncCallback): void; @@ -691,8 +691,7 @@ declare namespace appAccount { * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid name, owner, authType or token. * @throws {BusinessError} 12300003 - the account indicated by name dose not exist. - * @throws {BusinessError} 12300015 - the authType is not supported on current device. - * @throws {BusinessError} 12300019 - credential does not exist. + * @throws {BusinessError} 12300107 - the authType is not found. * @since 9 */ deleteAuthToken(name: string, owner: string, authType: string, token: string, callback: AsyncCallback): void; @@ -727,8 +726,9 @@ declare namespace appAccount { * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid name, authType or bundleName. * @throws {BusinessError} 12300003 - the account indicated by name dose not exist. - * @throws {BusinessError} 12300015 - the authType is not supported on current device. - * @throws {BusinessError} 12300019 - credential does not exist. + * @throws {BusinessError} 12300107 - the authType is not found. + * @throws {BusinessError} 12400001 - the application indicated by name does not exist. + * @throws {BusinessError} 12400005 - the size of authorization list reaches the upper limit. * @since 9 */ setAuthTokenVisibility(name: string, authType: string, bundleName: string, isVisible: boolean, callback: AsyncCallback): void; @@ -761,8 +761,7 @@ declare namespace appAccount { * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid name, authType or bundleName. * @throws {BusinessError} 12300003 - the account indicated by name dose not exist. - * @throws {BusinessError} 12300015 - the authType is not supported on current device. - * @throws {BusinessError} 12300019 - credential does not exist. + * @throws {BusinessError} 12300107 - the authType is not found. * @since 9 */ checkAuthTokenVisibility(name: string, authType: string, bundleName: string, callback: AsyncCallback): void; @@ -795,7 +794,7 @@ declare namespace appAccount { getAllAuthTokens(name: string, owner: string): Promise>; /** - * Gets the open authorization list with a specified authentication type for a paticular application account. + * Gets the open authorization list with a specified authentication type for a particular application account. *

    * Only the owner of the application account has the permission to call this method. * @param name Indicates the account name of your application. @@ -809,7 +808,7 @@ declare namespace appAccount { getOAuthList(name: string, authType: string): Promise>; /** - * Gets the open authorization list with a specified authentication type for a paticular application account. + * Gets the open authorization list with a specified authentication type for a particular application account. *

    * Only the owner of the application account has the permission to call this method. * @param name Indicates the account name of your application. @@ -819,8 +818,7 @@ declare namespace appAccount { * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid name or authType. * @throws {BusinessError} 12300003 - the account indicated by name dose not exist. - * @throws {BusinessError} 12300015 - the authType is not supported on current device. - * @throws {BusinessError} 12300019 - credential does not exist. + * @throws {BusinessError} 12300107 - the authType is not found. * @since 9 */ getAuthList(name: string, authType: string, callback: AsyncCallback>): void; @@ -847,7 +845,8 @@ declare namespace appAccount { * @returns Returns the authenticator callback related to the session id. * @throws {BusinessError} 401 - the parameter check failed. * @throws {BusinessError} 12300001 - system service exception. - * @throws {BusinessError} 12400005 - the session indicated by sessionId does not exist. + * @throws {BusinessError} 12300002 - invalid session id. + * @throws {BusinessError} 12300108 - the session indicated by sessionId does not exist. * @since 9 */ getAuthCallback(sessionId: string, callback: AsyncCallback): void; @@ -871,23 +870,25 @@ declare namespace appAccount { * @throws {BusinessError} 401 - the parameter check failed. * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid owner. - * @throws {BusinessError} 12300003 - the account indicated by owner dose not exist. + * @throws {BusinessError} 12300113 - the account authenticator service does not exist. * @since 9 */ queryAuthenticatorInfo(owner: string, callback: AsyncCallback): void; queryAuthenticatorInfo(owner: string): Promise; /** - * Checks whether a paticular account has all specified labels. + * Checks whether a particular account has all specified labels. * @param name Indicates the account name. * @param owner Indicates the account owner. * @param labels Indicates an array of labels to check. * @returns boolean * @throws {BusinessError} 401 - the parameter check failed. * @throws {BusinessError} 12300001 - system service exception. - * @throws {BusinessError} 12300002 - invalid name or owner. + * @throws {BusinessError} 12300002 - invalid name, owner or labels. * @throws {BusinessError} 12300003 - the account indicated by owner dose not exist. - * @throws {BusinessError} 12400001 - the application indicated by name does not exist. + * @throws {BusinessError} 12300010 - account service busy. + * @throws {BusinessError} 12300113 - the account authenticator service does not exist. + * @throws {BusinessError} 12300114 - authenticator service exception. * @since 9 */ checkAccountLabels(name: string, owner: string, labels: Array, callback: AsyncCallback): void; @@ -901,9 +902,9 @@ declare namespace appAccount { * @throws {BusinessError} 401 - the parameter check failed. * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid name or credentialType. - * @throws {BusinessError} 12300019 - credential does not exist. - * @throws {BusinessError} 12400001 - the application indicated by name does not exist. - * since 9 + * @throws {BusinessError} 12300003 - the account indicated by name dose not exist. + * @throws {BusinessError} 12300102 - credential does not exist. + * @since 9 */ deleteCredential(name: string, credentialType: string, callback: AsyncCallback): void; deleteCredential(name: string, credentialType: string): Promise; @@ -915,6 +916,8 @@ declare namespace appAccount { * @throws {BusinessError} 401 - the parameter check failed. * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid options. + * @throws {BusinessError} 12300010 - account service busy. + * @throws {BusinessError} 12300114 - authenticator service exception. * @since 9 */ selectAccountsByOptions(options: SelectAccountsOptions, callback: AsyncCallback>): void; @@ -931,8 +934,9 @@ declare namespace appAccount { * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid name, owner or options. * @throws {BusinessError} 12300003 - the account indicated by owner dose not exist. - * @throws {BusinessError} 12400001 - the application indicated by name does not exist. - * @throws {BusinessError} 12400002 - he account authenticator service does not exist. + * @throws {BusinessError} 12300010 - account service busy. + * @throws {BusinessError} 12300113 - the account authenticator service does not exist. + * @throws {BusinessError} 12300114 - authenticator service exception. * @since 9 */ verifyCredential(name: string, owner: string, callback: AuthCallback): void; @@ -949,8 +953,9 @@ declare namespace appAccount { * @throws {BusinessError} 401 - the parameter check failed. * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid owner or options. - * @throws {BusinessError} 12300003 - the account indicated by owner dose not exist. - * @throws {BusinessError} 12400002 - the account authenticator service does not exist. + * @throws {BusinessError} 12300010 - account service busy. + * @throws {BusinessError} 12300113 - the account authenticator service does not exist. + * @throws {BusinessError} 12300114 - authenticator service exception. * @since 9 */ setAuthenticatorProperties(owner: string, callback: AuthCallback): void; @@ -1063,7 +1068,7 @@ declare namespace appAccount { */ interface AuthResult { /** - * The account infomation. + * The account information. * @since 9 */ account?: AppAccountInfo; @@ -1154,7 +1159,7 @@ declare namespace appAccount { */ interface VerifyCredentialOptions { /** - * The credentail type to be verified. + * The credential type to be verified. * @since 9 */ credentialType?: string; @@ -1281,7 +1286,7 @@ declare namespace appAccount { KEY_ACTION = "action", /** - * Indicates the key of authentiaction type. + * Indicates the key of authentication type. * * @since 8 */ @@ -1441,6 +1446,8 @@ declare namespace appAccount { * @param callback Indicates the authenticator callback. * @returns void. * @since 8 + * @deprecated since 9 + * @useinstead appAccount.Authenticator#createAccountImplicitly */ addAccountImplicitly(authType: string, callerBundleName: string, options: {[key: string]: any}, callback: AuthenticatorCallback): void; @@ -1462,6 +1469,8 @@ declare namespace appAccount { * @param callback Indicates the authenticator callback. * @returns void. * @since 8 + * @deprecated since 9 + * @useinstead appAccount.Authenticator#auth */ authenticate(name: string, authType: string, callerBundleName: string, options: {[key: string]: any}, callback: AuthenticatorCallback): void; diff --git a/api/@ohos.account.distributedAccount.d.ts b/api/@ohos.account.distributedAccount.d.ts index 3e3b41439a0e946fb2ed98c435a39123283fd218..c5deff6f2bd92be14a5bd39595805bc29fc8b4bb 100644 --- a/api/@ohos.account.distributedAccount.d.ts +++ b/api/@ohos.account.distributedAccount.d.ts @@ -51,7 +51,7 @@ declare namespace distributedAccount { /** * Gets the distributed information of the current OS account. - * @permission ohos.permission.MANAGE_DISTRIBUTED_ACCOUNTS or ohos.permission.GET_DISTRIBUTED_ACCOUNTS or ohos.permission.DISTRIBUTED_DATASYNC. + * @permission ohos.permission.MANAGE_DISTRIBUTED_ACCOUNTS or ohos.permission.GET_DISTRIBUTED_ACCOUNTS or ohos.permission.DISTRIBUTED_DATASYNC * @returns The distributed information of the current OS account. * @throws {BusinessError} 201 - permission denied. * @throws {BusinessError} 401 - the parameter check failed. @@ -63,7 +63,7 @@ declare namespace distributedAccount { /** * Updates the distributed information of the OS account. - * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS. + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS * @param accountInfo Indicates the information of the OS account used for a distributed system. * @returns void * @since 7 @@ -75,13 +75,14 @@ declare namespace distributedAccount { /** * Sets the distributed information of the OS account. - * @permission ohos.permission.MANAGE_DISTRIBUTED_ACCOUNTS. + * @permission ohos.permission.MANAGE_DISTRIBUTED_ACCOUNTS * @param accountInfo Indicates the information of the OS account used for a distributed system. * @returns void * @throws {BusinessError} 201 - permission denied. * @throws {BusinessError} 401 - the parameter check failed. * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid accountInfo. + * @throws {BusinessError} 12300003 - the account indicated by accountInfo dose not exist. * @since 9 */ setOsAccountDistributedInfo(accountInfo: DistributedInfo, callback: AsyncCallback): void; diff --git a/api/@ohos.account.osAccount.d.ts b/api/@ohos.account.osAccount.d.ts index 92a81d4b44d572743e76639447886445cdae8e48..614155cce28ab942f8c7c62af6238e278fcbe23d 100644 --- a/api/@ohos.account.osAccount.d.ts +++ b/api/@ohos.account.osAccount.d.ts @@ -44,7 +44,7 @@ declare namespace osAccount { * to run in the foreground. Then, the OS account originally running in the foreground will be * switched to the background. *

    - * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION. + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION * @param localId Indicates the local ID of the OS account. * @returns void. * @throws {BusinessError} 201 - permission denied. @@ -52,8 +52,8 @@ declare namespace osAccount { * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid localId. * @throws {BusinessError} 12300003 - the account indicated by localId dose not exist. - * @throws {BusinessError} 12300003 - the account indicated by localId has been activated. - * @throws {BusinessError} 12300010 - account service is busy. + * @throws {BusinessError} 12300008 - the localId indicates restricted account. + * @throws {BusinessError} 12300009 - the account indicated by localId has been activated. * @systemapi Hide this for inner system use. * @since 7 */ @@ -94,7 +94,7 @@ declare namespace osAccount { /** * Checks whether an OS account is activated based on its local ID. - * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS. + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS * @param localId Indicates the local ID of the OS account. * @returns void * @throws {BusinessError} 201 - permission denied. @@ -109,7 +109,7 @@ declare namespace osAccount { /** * Checks whether a constraint has been enabled for an OS account based on its local ID. - * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS. + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS * @param localId Indicates the local ID of the OS account. * @param constraint Indicates the constraint to check. The value can be: *
      @@ -132,7 +132,7 @@ declare namespace osAccount { /** * Checks whether a constraint has been enabled for an OS account based on its local ID. - * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS. + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS * @param localId Indicates the local ID of the OS account. * @param constraint Indicates the constraint to check. The value can be: *
        @@ -151,7 +151,6 @@ declare namespace osAccount { * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid localId or constraint. * @throws {BusinessError} 12300003 - the account indicated by localId dose not exist. - * @throws {BusinessError} 12300004 - the localId indicates restricted account. * @since 9 */ checkConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback): void; @@ -179,7 +178,7 @@ declare namespace osAccount { /** * Checks whether an OS account has been verified based on its local ID. - * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS * @param localId Indicates the local ID of the OS account. * @returns Returns {@code true} if the OS account has been verified successfully; * returns {@code false} otherwise. @@ -194,7 +193,7 @@ declare namespace osAccount { /** * Checks whether an OS account has been verified based on its ID. - * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS * @param localId Indicates the local ID of the OS account. * @returns Returns {@code true} if the OS account has been verified successfully; * returns {@code false} otherwise. @@ -211,7 +210,7 @@ declare namespace osAccount { /** * Removes an OS account based on its local ID. - * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS. + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS * @param localId Indicates the local ID of the OS account. * @returns void. * @throws {BusinessError} 201 - permission denied. @@ -219,7 +218,7 @@ declare namespace osAccount { * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid localId. * @throws {BusinessError} 12300003 - the account indicated by localId dose not exist. - * @throws {BusinessError} 12300004 - the localId indicates restricted account. + * @throws {BusinessError} 12300008 - the localId indicates restricted account. * @systemapi Hide this for inner system use. * @since 7 */ @@ -228,7 +227,7 @@ declare namespace osAccount { /** * Sets constraints for an OS account based on its local ID. - * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS. + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS * @param localId Indicates the local ID of the OS account. * @param constraints Indicates the constraints to set for the OS account. The value can be: *
          @@ -247,7 +246,7 @@ declare namespace osAccount { * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid localId or constraints. * @throws {BusinessError} 12300003 - the account indicated by localId dose not exist. - * @throws {BusinessError} 12300004 - the localId indicates restricted account. + * @throws {BusinessError} 12300008 - the localId indicates restricted account. * @systemapi Hide this for inner system use. * @since 7 */ @@ -257,7 +256,7 @@ declare namespace osAccount { /** * Sets the local name for an OS account based on its local ID. - * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS. + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS * @param localId Indicates the local ID of the OS account. * @param localName Indicates the local name to set for the OS account. * @returns void. @@ -266,7 +265,7 @@ declare namespace osAccount { * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid localId or localName. * @throws {BusinessError} 12300003 - the account indicated by localId dose not exist. - * @throws {BusinessError} 12300004 - the localId indicates restricted account. + * @throws {BusinessError} 12300008 - the localId indicates restricted account. * @systemapi Hide this for inner system use. * @since 7 */ @@ -275,7 +274,7 @@ declare namespace osAccount { /** * Obtains the number of all OS accounts created on a device. - * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS. + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS * @returns Returns the number of created OS accounts. * @since 7 * @deprecated since 9 @@ -286,7 +285,7 @@ declare namespace osAccount { /** * Obtains the number of all OS accounts created on a device. - * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS. + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS * @returns Returns the number of created OS accounts. * @throws {BusinessError} 201 - permission denied. * @throws {BusinessError} 401 - the parameter check failed. @@ -341,7 +340,7 @@ declare namespace osAccount { /** * Queries the local ID of an OS account which is bound to the specified domain account - * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS. + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS * @param domainInfo Indicates the domain account info. * @returns Returns the local ID of the OS account. * @since 8 @@ -354,7 +353,7 @@ declare namespace osAccount { /** * Queries the ID of an account which is bound to the specified domain account * - * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS. + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS * @param domainInfo Indicates the domain account info. * @returns Returns the local ID of the OS account. * @throws {BusinessError} 201 - permission denied. @@ -379,7 +378,7 @@ declare namespace osAccount { /** * Obtains all constraints of an OS account based on its local ID. - * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS. + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS * @param localId Indicates the local ID of the OS account. * @returns Returns a list of constraints. * @since 7 @@ -391,7 +390,7 @@ declare namespace osAccount { /** * Obtains all constraints of an account based on its ID. - * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS. + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS * @param localId Indicates the local ID of the OS account. * @returns Returns a list of constraints. * @throws {BusinessError} 201 - permission denied. @@ -399,7 +398,6 @@ declare namespace osAccount { * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid localId. * @throws {BusinessError} 12300003 - the account indicated by localId dose not exist. - * @throws {BusinessError} 12300004 - the localId indicates restricted account. * @since 9 */ getOsAccountConstraints(localId: number, callback: AsyncCallback>): void; @@ -407,7 +405,7 @@ declare namespace osAccount { /** * Queries the list of all the OS accounts that have been created in the system. - * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS. + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS * @returns Returns a list of OS accounts. * @throws {BusinessError} 201 - permission denied. * @throws {BusinessError} 401 - the parameter check failed. @@ -440,7 +438,7 @@ declare namespace osAccount { /** * Creates an OS account using the local name and account type. - * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS. + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS * @param localName Indicates the local name of the OS account to create. * @param type Indicates the type of the OS account to create. * {@link OsAccountType} specifies the account types available in the system. @@ -449,7 +447,9 @@ declare namespace osAccount { * @throws {BusinessError} 401 - the parameter check failed. * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid localName. - * @throws {BusinessError} 12300003 - the account indicated by localId dose not exist. + * @throws {BusinessError} 12300005 - multi-user not supported. + * @throws {BusinessError} 12300006 - unsupported account type. + * @throws {BusinessError} 12300007 - the number of account reaches the upper limit. * @systemapi Hide this for inner system use. * @since 7 */ @@ -458,7 +458,7 @@ declare namespace osAccount { /** * Creates an OS account using the account type and domain account info. - * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS. + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS * @param type Indicates the type of the OS account to create. * {@link OsAccountType} specifies the account types available in the system. * @param domainInfo Indicates the domain account info. @@ -467,6 +467,9 @@ declare namespace osAccount { * @throws {BusinessError} 401 - the parameter check failed. * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid type or domainInfo. + * @throws {BusinessError} 12300005 - multi-user not supported. + * @throws {BusinessError} 12300006 - unsupported account type. + * @throws {BusinessError} 12300007 - the number of account reaches the upper limit. * @systemapi Hide this for inner system use. * @since 8 */ @@ -475,7 +478,7 @@ declare namespace osAccount { /** * Queries information about the current OS account. - * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS. + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS * @returns Returns information about the current OS account; returns {@code null} if the query fails. * @since 7 * @deprecated since 9 @@ -486,7 +489,7 @@ declare namespace osAccount { /** * Gets information about the current OS account. - * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS. + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS * @returns Returns information about the current OS account; returns {@code null} if the query fails. * @throws {BusinessError} 201 - permission denied. * @throws {BusinessError} 401 - the parameter check failed. @@ -494,12 +497,12 @@ declare namespace osAccount { * @since 9 */ getCurrentOsAccount(callback: AsyncCallback): void; - getCurrentOsAccount(): Promise; + getCurrentOsAccount(): Promise; /** * Queries OS account information based on the local ID. * - * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION. + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION * @param localId Indicates the local ID of the OS account. * @returns Returns the OS account information; returns {@code null} if the query fails. * @throws {BusinessError} 201 - permission denied. @@ -539,7 +542,7 @@ declare namespace osAccount { * Obtains the distributed virtual device ID (DVID). *

          * If the same OHOS account has logged in to multiple devices, these devices constitute a super device - * through the distributed networking. On the networked devices, you can call this method to obtain the DVIDs. + * through the distributed networking. On the connected devices, you can call this method to obtain the DVIDs. * The same application running on different devices obtains the same DVID, whereas different applications * obtain different DVIDs. *

          @@ -556,11 +559,11 @@ declare namespace osAccount { * Queries the distributed virtual device ID (DVID). *

          * If the same OHOS account has logged in to multiple devices, these devices constitute a super device - * through the distributed networking. On the networked devices, you can call this method to obtain the DVIDs. + * through the distributed networking. On the connected devices, you can call this method to obtain the DVIDs. * The same application running on different devices obtains the same DVID, whereas different applications * obtain different DVIDs. *

          - * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS. + * @permission ohos.permission.DISTRIBUTED_DATASYNC or ohos.permission.MANAGE_LOCAL_ACCOUNTS * @returns Returns the DVID if obtained; returns an empty string if no OHOS account has logged in. * @throws {BusinessError} 201 - permission denied. * @throws {BusinessError} 401 - the parameter check failed. @@ -572,7 +575,7 @@ declare namespace osAccount { /** * Obtains the profile photo of an OS account based on its local ID. - * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS. + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS * @param localId Indicates the local ID of the OS account. * @returns Returns the profile photo if obtained; * returns {@code null} if the profile photo fails to be obtained. @@ -589,7 +592,7 @@ declare namespace osAccount { /** * Sets the profile photo for an OS account based on its local ID. - * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS. + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS * @param localId Indicates the local ID of the OS account. * @param photo Indicates the profile photo to set for the OS account. * @returns void. @@ -598,6 +601,7 @@ declare namespace osAccount { * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid localId or photo. * @throws {BusinessError} 12300003 - the account indicated by localId dose not exist. + * @throws {BusinessError} 12300008 - the localId indicates restricted account. * @systemapi Hide this for inner system use. * @since 7 */ @@ -621,6 +625,8 @@ declare namespace osAccount { * @returns localId. * @throws {BusinessError} 401 - the parameter check failed. * @throws {BusinessError} 12300001 - system service exception. + * @throws {BusinessError} 12300002 - invalid serialNumber. + * @throws {BusinessError} 12300003 - the account indicated by serialNumber dose not exist. * @since 9 */ queryOsAccountLocalIdBySerialNumber(serialNumber: number, callback: AsyncCallback): void; @@ -662,7 +668,8 @@ declare namespace osAccount { * @throws {BusinessError} 201 - permission denied. * @throws {BusinessError} 401 - the parameter check failed. * @throws {BusinessError} 12300001 - system service exception. - * @throws {BusinessError} 12300005 - the listener has been registered. + * @throws {BusinessError} 12300002 - invalid type or name. + * @throws {BusinessError} 12300011 - the callback has been registered. * @systemapi Hide this for inner system use. * @since 7 */ @@ -677,7 +684,8 @@ declare namespace osAccount { * @throws {BusinessError} 201 - permission denied. * @throws {BusinessError} 401 - the parameter check failed. * @throws {BusinessError} 12300001 - system service exception. - * @throws {BusinessError} 12300006 - the listener has not been registered. + * @throws {BusinessError} 12300002 - invalid type or name. + * @throws {BusinessError} 12300012 - the callback has not been registered. * @systemapi Hide this for inner system use. * @since 7 */ @@ -698,7 +706,7 @@ declare namespace osAccount { /** * Check whether current process belongs to the main account. - * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS. + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS * @returns Returns {@code true} if current process belongs to the main os account; * returns {@code false} otherwise. * @throws {BusinessError} 201 - permission denied. @@ -712,7 +720,7 @@ declare namespace osAccount { /** * Query the constraint source type list of the OS account. - * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS. + * @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS * @returns Returns the constraint source type infos of the os account; * @throws {BusinessError} 201 - permission denied. * @throws {BusinessError} 401 - the parameter check failed. @@ -882,8 +890,6 @@ declare namespace osAccount { * @throws {BusinessError} 401 - the parameter check failed. * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid authType or authTrustLevel. - * @throws {BusinessError} 12300014 - the authTrustLevel is not supported on current device - * @throws {BusinessError} 12300015 - the authType is not supported on current device. * @systemapi Hide this for inner system use. * @since 8 */ @@ -908,7 +914,6 @@ declare namespace osAccount { * Sets property that can be used to initialize algorithms. * @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL * @param request Indicates the request information, including authentication type and the key-value to be set. - * @returns Returns a number value indicating whether the property setting was successful. * @throws {BusinessError} 201 - permission denied. * @throws {BusinessError} 401 - the parameter check failed. * @throws {BusinessError} 12300001 - system service exception. @@ -916,8 +921,8 @@ declare namespace osAccount { * @systemapi Hide this for inner system use. * @since 8 */ - setProperty(request: SetPropertyRequest, callback: AsyncCallback): void; - setProperty(request: SetPropertyRequest): Promise; + setProperty(request: SetPropertyRequest, callback: AsyncCallback): void; + setProperty(request: SetPropertyRequest): Promise; /** * Executes authentication. @@ -931,12 +936,12 @@ declare namespace osAccount { * @throws {BusinessError} 401 - the parameter check failed. * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid challenge, authType or authTrustLevel. - * @throws {BusinessError} 12300014 - the authTrustLevel is not supported on current device - * @throws {BusinessError} 12300015 - the authType is not supported on current device. - * @throws {BusinessError} 12300016 - authentication timeout. - * @throws {BusinessError} 12300017 - authentication service is busy. - * @throws {BusinessError} 12300018 - authentication service is locked. - * @throws {BusinessError} 12300019 - the credential does not exist. + * @throws {BusinessError} 12300101 - token is invalid. + * @throws {BusinessError} 12300105 - unsupported authTrustLevel. + * @throws {BusinessError} 12300106 - unsupported authType. + * @throws {BusinessError} 12300110 - authentication is locked. + * @throws {BusinessError} 12300111 - authentication timeout. + * @throws {BusinessError} 12300112 - authentication service is busy. * @systemapi Hide this for inner system use. * @since 8 */ @@ -955,13 +960,12 @@ declare namespace osAccount { * @throws {BusinessError} 401 - the parameter check failed. * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid userId, challenge, authType or authTrustLevel. - * @throws {BusinessError} 12300003 - the account indicated by userId dose not exist. - * @throws {BusinessError} 12300014 - the authTrustLevel is not supported on current device - * @throws {BusinessError} 12300015 - the authType is not supported on current device. - * @throws {BusinessError} 12300016 - authentication timeout. - * @throws {BusinessError} 12300017 - authentication service is busy. - * @throws {BusinessError} 12300018 - authentication service is locked. - * @throws {BusinessError} 12300019 - the credential does not exist. + * @throws {BusinessError} 12300101 - token is invalid. + * @throws {BusinessError} 12300105 - unsupported authTrustLevel. + * @throws {BusinessError} 12300106 - unsupported authType. + * @throws {BusinessError} 12300110 - authentication is locked. + * @throws {BusinessError} 12300111 - authentication timeout. + * @throws {BusinessError} 12300112 - authentication service is busy. * @systemapi Hide this for inner system use. * @since 8 */ @@ -974,7 +978,7 @@ declare namespace osAccount { * @throws {BusinessError} 201 - permission denied. * @throws {BusinessError} 401 - the parameter check failed. * @throws {BusinessError} 12300001 - system service exception. - * @throws {BusinessError} 12300002 - invalid contexId. + * @throws {BusinessError} 12300002 - invalid contextId. * @systemapi Hide this for inner system use. * @since 8 */ @@ -1003,7 +1007,7 @@ declare namespace osAccount { * @throws {BusinessError} 201 - permission denied. * @throws {BusinessError} 401 - the parameter check failed. * @throws {BusinessError} 12300001 - system service exception. - * @throws {BusinessError} 12300007 - PIN inputer has been registered. + * @throws {BusinessError} 12300103 - the credential inputer has been registered. * @systemapi Hide this for inner system use. * @since 8 */ @@ -1054,7 +1058,7 @@ declare namespace osAccount { *

          * Add user credential information, pass in credential addition method and credential information * (credential type, subclass, if adding user's non password credentials, pass in password authentication token), - * and get the result / acquireinfo callback. + * and get the result / acquireInfo callback. * @permission ohos.permission.MANAGE_USER_IDM * @param credentialInfo Indicates the credential information. * @param callback Indicates the callback to get results and acquireInfo. @@ -1062,6 +1066,8 @@ declare namespace osAccount { * @throws {BusinessError} 401 - the parameter check failed. * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid credentialInfo. + * @throws {BusinessError} 12300101 - token is invalid. + * @throws {BusinessError} 12300106 - unsupported authType. * @systemapi Hide this for inner system use. * @since 8 */ @@ -1076,6 +1082,8 @@ declare namespace osAccount { * @throws {BusinessError} 401 - the parameter check failed. * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid credentialInfo. + * @throws {BusinessError} 12300101 - token is invalid. + * @throws {BusinessError} 12300106 - unsupported authType. * @systemapi Hide this for inner system use. * @since 8 */ @@ -1112,7 +1120,7 @@ declare namespace osAccount { * @throws {BusinessError} 201 - permission denied. * @throws {BusinessError} 401 - the parameter check failed. * @throws {BusinessError} 12300001 - system service exception. - * @throws {BusinessError} 12300002 - invalid token. + * @throws {BusinessError} 12300101 - token is invalid. * @systemapi Hide this for inner system use. * @since 8 */ @@ -1127,7 +1135,9 @@ declare namespace osAccount { * @throws {BusinessError} 201 - permission denied. * @throws {BusinessError} 401 - the parameter check failed. * @throws {BusinessError} 12300001 - system service exception. - * @throws {BusinessError} 12300002 - invalid credentialId or token. + * @throws {BusinessError} 12300002 - invalid credentialId. + * @throws {BusinessError} 12300101 - token is invalid. + * @throws {BusinessError} 12300102 - credential not found. * @systemapi Hide this for inner system use. * @since 8 */ @@ -1143,11 +1153,7 @@ declare namespace osAccount { * @throws {BusinessError} 401 - the parameter check failed. * @throws {BusinessError} 12300001 - system service exception. * @throws {BusinessError} 12300002 - invalid authType. - * @throws {BusinessError} 12300015 - the authType is not supported on current device. - * @throws {BusinessError} 12300016 - authentication timeout. - * @throws {BusinessError} 12300017 - authentication service is busy. - * @throws {BusinessError} 12300018 - authentication service is locked. - * @throws {BusinessError} 12300019 - the credential does not exist. + * @throws {BusinessError} 12300102 - credential not found. * @systemapi Hide this for inner system use. * @since 8 */ @@ -1207,9 +1213,9 @@ declare namespace osAccount { * The authentication result code is returned through the callback. * @param result Indicates the authentication result code. * @param extraInfo Indicates the specific information for different situation. - * If the authentication is passed, the authentication token is returned in extrainfo, - * If the authentication fails, the remaining authentication times are returned in extrainfo, - * If the authentication executor is locked, the freezing time is returned in extrainfo. + * If the authentication is passed, the authentication token is returned in extraInfo, + * If the authentication fails, the remaining authentication times are returned in extraInfo, + * If the authentication executor is locked, the freezing time is returned in extraInfo. * @systemapi Hide this for inner system use. * @since 8 */ diff --git a/api/@ohos.app.ability.Ability.d.ts b/api/@ohos.app.ability.Ability.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4c0485909b39e2ec2d830a0cdb63e289e8f6c29e --- /dev/null +++ b/api/@ohos.app.ability.Ability.d.ts @@ -0,0 +1,56 @@ +/* + * 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.app.ability.AbilityConstant"; +import { Configuration } from './@ohos.app.ability.Configuration'; + +/** + * The class of an ability. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ +export default class Ability { + /** + * Called when the system configuration is updated. + * @param { Configuration } newConfig - Indicates the updated configuration. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + onConfigurationUpdate(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.AbilityCore + * @StageModelOnly + * @since 9 + */ + onMemoryLevel(level: AbilityConstant.MemoryLevel): void; + + /** + * Called back when an ability prepares to save. + * @param reason state type when save. + * @param wantParam Indicates the want parameter. + * @return 0 if ability agrees to save data successfully, otherwise errcode. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + onSaveState(reason: AbilityConstant.StateType, wantParam : {[key: string]: any}): AbilityConstant.OnSaveResult; +} diff --git a/api/@ohos.app.ability.AbilityConstant.d.ts b/api/@ohos.app.ability.AbilityConstant.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4237bb892ad73baa960c10483ebf5ffa07b9aa29 --- /dev/null +++ b/api/@ohos.app.ability.AbilityConstant.d.ts @@ -0,0 +1,147 @@ +/* + * 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. + * @namespace AbilityConstant + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ +declare namespace AbilityConstant { + /** + * Interface of launch param. + * @typedef LaunchParam + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + export interface LaunchParam { + /** + * Indicates launch reason. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + launchReason: LaunchReason; + + /** + * Indicates last exit reason. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + lastExitReason: LastExitReason; + } + + /** + * Type of launch reason. + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + export enum LaunchReason { + UNKNOWN = 0, + START_ABILITY = 1, + CALL = 2, + CONTINUATION = 3, + APP_RECOVERY = 4, + } + + /** + * Type of last exit reason. + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + export enum LastExitReason { + UNKNOWN = 0, + ABILITY_NOT_RESPONDING = 1, + NORMAL = 2, + } + + /** + * Type of onContinue result. + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + export enum OnContinueResult { + AGREE = 0, + REJECT = 1, + MISMATCH = 2, + } + + /** + * Type of memory level. + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + export enum MemoryLevel { + MEMORY_LEVEL_MODERATE = 0, + MEMORY_LEVEL_LOW = 1, + MEMORY_LEVEL_CRITICAL = 2, + } + + /** + * Type of window mode. + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + 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, + } + + /** + * Type of onSave result. + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + export enum OnSaveResult { + ALL_AGREE = 0, + CONTINUATION_REJECT = 1, + CONTINUATION_MISMATCH = 2, + RECOVERY_AGREE = 3, + RECOVERY_REJECT = 4, + ALL_REJECT, + } + + /** + * Type of save state. + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + export enum StateType { + CONTINUATION = 0, + APP_RECOVERY = 1, + } +} + +export default AbilityConstant; diff --git a/api/@ohos.app.ability.AbilityLifecycleCallback.d.ts b/api/@ohos.app.ability.AbilityLifecycleCallback.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e9ad0881470c1a4ea079e0ae3c6f08919e7ecb3f --- /dev/null +++ b/api/@ohos.app.ability.AbilityLifecycleCallback.d.ts @@ -0,0 +1,111 @@ +/* + * 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 UIAbility from "./@ohos.app.ability.UIAbility"; +import dataAbility from "./@ohos.data.dataAbility"; +import window from './@ohos.window'; + +/** + * The ability lifecycle callback. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ +export default class AbilityLifecycleCallback { + /** + * Called back when an ability is started for initialization. + * @param { Ability } ability - Indicates the ability to register for listening. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + onAbilityCreate(ability: UIAbility): void; + + /** + * Called back when a window stage is created. + * @param { Ability } ability - Indicates the ability to register for listening. + * @param { window.WindowStage } windowStage - window stage to create + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + onWindowStageCreate(ability: UIAbility, windowStage: window.WindowStage): void; + + /** + * Called back when a window stage is active. + * @param { Ability } ability - Indicates the ability to register for listening. + * @param { window.WindowStage } windowStage - window stage to active + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + onWindowStageActive(ability: UIAbility, windowStage: window.WindowStage): void; + + /** + * Called back when a window stage is inactive. + * @param { Ability } ability - Indicates the ability to register for listening. + * @param { window.WindowStage } windowStage - window stage to inactive + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + onWindowStageInactive(ability: UIAbility, windowStage: window.WindowStage): void; + + /** + * Called back when a window stage is destroyed. + * @param { Ability } ability - Indicates the ability to register for listening. + * @param { window.WindowStage } windowStage - window stage to destroy + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + onWindowStageDestroy(ability: UIAbility, windowStage: window.WindowStage): void; + + /** + * Called back when an ability is destroyed. + * @param { Ability } ability - Indicates the ability to register for listening. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + onAbilityDestroy(ability: UIAbility): void; + + /** + * Called back when the state of an ability changes to foreground. + * @param { Ability } ability - Indicates the ability to register for listening. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + onAbilityForeground(ability: UIAbility): void; + + /** + * Called back when the state of an ability changes to background. + * @param { Ability } ability - Indicates the ability to register for listening. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + onAbilityBackground(ability: UIAbility): void; + + /** + * Called back when an ability prepares to continue. + * @param { Ability } ability - Indicates the ability to register for listening. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + onAbilityContinue(ability: UIAbility): void; +} \ No newline at end of file diff --git a/api/@ohos.app.ability.AbilityStage.d.ts b/api/@ohos.app.ability.AbilityStage.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f0eb477e9dedc531bbad7bfd27aa4e968e7b8423 --- /dev/null +++ b/api/@ohos.app.ability.AbilityStage.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 AbilityConstant from "./@ohos.app.ability.AbilityConstant"; +import AbilityStageContext from "./application/AbilityStageContext"; +import Want from './@ohos.app.ability.Want'; +import { Configuration } from './@ohos.app.ability.Configuration'; + +/** + * The class of an ability stage. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ +export default class AbilityStage { + /** + * Indicates configuration information about context. + * @type { AbilityStageContext } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + context: AbilityStageContext; + + /** + * Called back when an ability stage is started for initialization. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + onCreate(): void; + + /** + * Called back when start specified ability. + * @param { Want } want - Indicates the want info of started 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. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + onAcceptWant(want: Want): string; + + /** + * Called when the system configuration is updated. + * @param { Configuration } newConfig - Indicates the updated configuration. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + onConfigurationUpdate(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; +} diff --git a/api/@ohos.app.ability.Configuration.d.ts b/api/@ohos.app.ability.Configuration.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b5f11c28d254a422316cb7a48353ad53dc13344f --- /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.app.ability.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.app.ability.ConfigurationConstant.d.ts b/api/@ohos.app.ability.ConfigurationConstant.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..303647c93b6833a7286bb4c86b5de53172822a13 --- /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.app.ability.EnvironmentCallback.d.ts b/api/@ohos.app.ability.EnvironmentCallback.d.ts new file mode 100755 index 0000000000000000000000000000000000000000..8490a059ac392dd3ac58e443ffb04e40bf0e4774 --- /dev/null +++ b/api/@ohos.app.ability.EnvironmentCallback.d.ts @@ -0,0 +1,32 @@ +/* + * 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.app.ability.Configuration'; + +/** + * The environment callback. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ +export default class EnvironmentCallback { + /** + * Called when the system configuration is updated. + * @param { Configuration } config - Indicates the updated configuration. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + onConfigurationUpdated(config: Configuration): void; +} diff --git a/api/@ohos.app.ability.ExtensionAbility.d.ts b/api/@ohos.app.ability.ExtensionAbility.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..13d3d3e7ed69a6a589c5adc31cab7cafc4170ffd --- /dev/null +++ b/api/@ohos.app.ability.ExtensionAbility.d.ts @@ -0,0 +1,25 @@ +/* + * 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.app.ability.Ability"; + +/** + * class of extension. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ +export default class ExtensionAbility extends Ability { +} diff --git a/api/@ohos.app.ability.ServiceExtensionAbility.d.ts b/api/@ohos.app.ability.ServiceExtensionAbility.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..18241e6abd218bd3cde6581bf2697a6d912ec9cd --- /dev/null +++ b/api/@ohos.app.ability.ServiceExtensionAbility.d.ts @@ -0,0 +1,122 @@ +/* + * 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 rpc from "./@ohos.rpc"; +import ServiceExtensionContext from "./application/ServiceExtensionContext"; +import Want from './@ohos.app.ability.Want'; +import { Configuration } from './@ohos.app.ability.Configuration'; + +/** + * class of service extension ability. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @StageModelOnly + * @since 9 + */ +export default class ServiceExtensionAbility { + /** + * Indicates service extension ability context. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @StageModelOnly + * @since 9 + */ + context: ServiceExtensionContext; + + /** + * Called back when a service extension is started for initialization. + * @param { Want } want - Indicates the want of created service extension. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @StageModelOnly + * @since 9 + */ + onCreate(want: Want): void; + + /** + * Called back before a service extension is destroyed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @StageModelOnly + * @since 9 + */ + onDestroy(): void; + + /** + * Called back when a service extension is started. + * @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 + * @systemapi + * @StageModelOnly + * @since 9 + */ + onRequest(want: Want, startId: number): void; + + /** + * Called back when a service extension is first connected to an ability. + * @param { Want } want - Indicates connection information about the Service ability. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @StageModelOnly + * @since 9 + */ + onConnect(want: Want): rpc.RemoteObject; + + /** + * Called back when all abilities connected to a service extension are disconnected. + * @param { Want } want - Indicates disconnection information about the service extension. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @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. + * @param { Want } want - Indicates the want of the service extension being connected. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @StageModelOnly + * @since 9 + */ + onReconnect(want: Want): void; + + /** + * Called when the system configuration is updated. + * @param { Configuration } newConfig - Indicates the updated configuration. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @StageModelOnly + * @since 9 + */ + onConfigurationUpdate(newConfig: 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 + */ + onDump(params: Array): Array; +} diff --git a/api/bundle/dispatchInfo.d.ts b/api/@ohos.app.ability.StartOptions.d.ts similarity index 59% rename from api/bundle/dispatchInfo.d.ts rename to api/@ohos.app.ability.StartOptions.d.ts index 2538eb4c831ea6986e6501eec53294e77820b8ba..e89e431242ad3048d404c6ba7b17a7c097b490e2 100644 --- a/api/bundle/dispatchInfo.d.ts +++ b/api/@ohos.app.ability.StartOptions.d.ts @@ -14,23 +14,25 @@ */ /** - * @name The dispatch info class. + * StartOptions is the basic communication component of the system. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @systemapi hide this for inner system use */ - export interface DispatchInfo { +export default class StartOptions { /** - * @default Indicates the dispatchInfo version + * windowMode + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework */ - readonly version: string; - + windowMode?: number; + /** - * @default Indicates the free install interface version number + * displayId + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework */ - readonly dispatchAPI: string; + displayId?: number; } \ No newline at end of file diff --git a/api/@ohos.app.ability.UIAbility.d.ts b/api/@ohos.app.ability.UIAbility.d.ts new file mode 100755 index 0000000000000000000000000000000000000000..0d3e8f9bd1dec53208ae1a4c0b5666d211f285ce --- /dev/null +++ b/api/@ohos.app.ability.UIAbility.d.ts @@ -0,0 +1,292 @@ +/* + * 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.app.ability.Ability"; +import AbilityConstant from "./@ohos.app.ability.AbilityConstant"; +import UIAbilityContext from "./application/UIAbilityContext"; +import rpc from './@ohos.rpc'; +import Want from './@ohos.app.ability.Want'; +import window from './@ohos.window'; + +/** + * The prototype of the listener function interface registered by the Caller. + * @typedef OnReleaseCallback + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ +export interface OnReleaseCallback { + (msg: string): void; +} + +/** + * The prototype of the message listener function interface registered by the Callee. + * @typedef CalleeCallback + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ +export interface CalleeCallback { + (indata: rpc.MessageParcel): rpc.Sequenceable; +} + +/** + * The interface of a Caller. + * @interface + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ +export interface Caller { + /** + * Notify the server of Sequenceable type data. + * @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 + * @StageModelOnly + * @since 9 + */ + call(method: string, data: rpc.Sequenceable): Promise; + + /** + * Notify the server of Sequenceable type data and return the notification result. + * @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 + * @StageModelOnly + * @since 9 + */ + callWithResult(method: string, data: rpc.Sequenceable): Promise; + + /** + * Clear service records. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + 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. + * @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; + + /** + * 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; +} + +/** + * The interface of a Callee. + * @interface + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ +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. + * @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; + + /** + * Unregister data listener callback. + * @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 + * @StageModelOnly + * @since 9 + */ + off(method: string): void; +} + +/** + * The class of a UI ability. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ +export default class UIAbility extends Ability { + /** + * Indicates configuration information about an ability context. + * @type { UIAbilityContext } + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + context: UIAbilityContext; + + /** + * Indicates ability launch want. + * @type { Want } + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + launchWant: Want; + + /** + * Indicates ability last request want. + * @type { Want } + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + lastRequestWant: Want; + + /** + * Call Service Stub Object. + * @type { Callee } + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + callee: Callee; + + /** + * Called back when an ability is started for initialization. + * @param { Want } want - Indicates the want info of the created ability. + * @param { AbilityConstant.LaunchParam } param - Indicates the launch param. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + onCreate(want: Want, param: AbilityConstant.LaunchParam): void; + + /** + * Called back when an ability window stage is created. + * @param { window.WindowStage } windowStage - Indicates the created WindowStage. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + onWindowStageCreate(windowStage: window.WindowStage): void; + + /** + * Called back when an ability window stage is destroyed. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + onWindowStageDestroy(): void; + + /** + * Called back when an ability window stage is restored. + * @param { window.WindowStage } windowStage - window stage to restore + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + onWindowStageRestore(windowStage: window.WindowStage): void; + + /** + * Called back before an ability is destroyed. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + onDestroy(): void; + + /** + * Called back when the state of an ability changes to foreground. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + onForeground(): void; + + /** + * Called back when the state of an ability changes to background. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + onBackground(): void; + + /** + * Called back when an ability prepares to continue. + * @param { {[key: string]: any} } wantParam - Indicates the want parameter. + * @returns { AbilityConstant.OnContinueResult } Return the result of onContinue. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + 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. + * @param { Want } want - Indicates the want info of ability. + * @param { AbilityConstant.LaunchParam } launchParams - Indicates the launch parameters. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): 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. + * @returns { Array } Return the dump info array. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + * @since 9 + */ + onDump(params: Array): Array; +} diff --git a/api/@ohos.app.ability.Want.d.ts b/api/@ohos.app.ability.Want.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..39f02017e5703848cbd06d7cd865bc758eea8d3e --- /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; +} diff --git a/api/@ohos.app.ability.abilityDelegatorRegistry.d.ts b/api/@ohos.app.ability.abilityDelegatorRegistry.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a3177d986c0fc589bbfc0769d8b6ec098d8c5206 --- /dev/null +++ b/api/@ohos.app.ability.abilityDelegatorRegistry.d.ts @@ -0,0 +1,89 @@ +/* + * 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 { 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. + * @namespace abilityDelegatorRegistry + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ +declare namespace abilityDelegatorRegistry { + /** + * Get the AbilityDelegator object of the application. + * @returns { AbilityDelegator } Return the AbilityDelegator object initialized when the application is started. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function getAbilityDelegator(): AbilityDelegator; + + /** + * Get unit test arguments stored in the AbilityDelegatorArgs object. + * @returns { AbilityDelegator } Return the previously registered AbilityDelegatorArgs object. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function getArguments(): AbilityDelegatorArgs; + + /** + * Describes all lifecycle states of an ability. + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + export enum AbilityLifecycleState { + UNINITIALIZED, + CREATE, + FOREGROUND, + BACKGROUND, + DESTROY, + } + + /** + * A global test utility interface used for adding AbilityMonitor objects and control lifecycle states of abilities. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + export type AbilityDelegator = _AbilityDelegator + + /** + * Store unit testing-related parameters, including test case names, and test runner name. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @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. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + export type AbilityMonitor = _AbilityMonitor + + /** + * A object that records the result of shell command executes. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + export type ShellCmdResult = _ShellCmdResult +} + +export default abilityDelegatorRegistry; \ No newline at end of file diff --git a/api/@ohos.app.ability.abilityManager.d.ts b/api/@ohos.app.ability.abilityManager.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b7775354d941dea6afb4fe6692f84056445ab1b8 --- /dev/null +++ b/api/@ohos.app.ability.abilityManager.d.ts @@ -0,0 +1,152 @@ +/* + * 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 { Configuration } from './@ohos.app.ability.Configuration'; +import { AbilityRunningInfo as _AbilityRunningInfo } from './application/AbilityRunningInfo'; +import { ExtensionRunningInfo as _ExtensionRunningInfo } from './application/ExtensionRunningInfo'; +import { ElementName } from './bundleManager/elementName'; + +/** + * The class of an ability manager. + * @namespace abilityManager + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ +declare namespace abilityManager { + /** + * Enum for the ability state + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + export enum AbilityState { + INITIAL = 0, + FOREGROUND = 9, + BACKGROUND = 10, + FOREGROUNDING = 11, + BACKGROUNDING = 12 + } + + /** + * Updates the configuration by modifying the configuration. + * @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; + + /** + * 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 + * @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 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. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + function getAbilityRunningInfos(callback: AsyncCallback>): void; + + /** + * Get information about running extensions + * @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. + * @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 + * @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. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + export type AbilityRunningInfo = _AbilityRunningInfo + + /** + * The class of an extension running information. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + export type ExtensionRunningInfo = _ExtensionRunningInfo +} + +export default abilityManager; \ No newline at end of file diff --git a/api/@ohos.app.ability.appManager.d.ts b/api/@ohos.app.ability.appManager.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ebc1872c806476003af7a702ab638aa3c065cb1a --- /dev/null +++ b/api/@ohos.app.ability.appManager.d.ts @@ -0,0 +1,325 @@ +/* + * 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. + * @namespace appManager + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + * + */ +declare namespace appManager { + /** + * Enum for the application state + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + export enum ApplicationState { + STATE_CREATE, + STATE_FOREGROUND, + STATE_ACTIVE, + STATE_BACKGROUND, + STATE_DESTROY + } + + /** + * Enum for the process state + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + export enum ProcessState { + STATE_CREATE, + STATE_FOREGROUND, + STATE_ACTIVE, + STATE_BACKGROUND, + STATE_DESTROY + } + + /** + * 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. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + 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. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + 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 off. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + 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. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + function off(type: "applicationState", observerId: number): Promise; + + /** + * getForegroundApplications. + * @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 + * @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(): 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. + * @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. + * @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 + * @since 9 + */ + function isRunningInStabilityTest(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 + * @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 + * @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, callback: AsyncCallback); + + /** + * Clear up application data by bundle name + * @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 + * @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, callback: AsyncCallback); + + /** + * Is it a ram-constrained device + * @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 + * @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 + * @returns { Promise } Returns the application memory size. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @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 + * @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. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + export type AbilityStateData = _AbilityStateData.default + + /** + * The application state data. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + export type AppStateData = _AppStateData.default + + /** + * The application state observer. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + export type ApplicationStateObserver = _ApplicationStateObserver.default + + /** + * The class of an process running information. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + export type ProcessRunningInfo = _ProcessRunningInfo + + /** + * The class of a process running information. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + export type ProcessRunningInformation = _ProcessRunningInformation +} + +export default appManager; diff --git a/api/@ohos.app.ability.appRecovery.d.ts b/api/@ohos.app.ability.appRecovery.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1416c6a89f1886911c71079915ff7a1dde4cabac --- /dev/null +++ b/api/@ohos.app.ability.appRecovery.d.ts @@ -0,0 +1,120 @@ +/* + * 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. + */ + +/** + * This module provides the capability to app receovery. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ +declare namespace appRecovery { + /** + * The type of no restart mode. + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + enum RestartFlag { + /** + * NONE: no restart restrictions + */ + ALWAYS_RESTART = 0, + + /** + * CPP_CRASH_NO_RESTART: Do not restart if process terminates due to cpp exception + */ + CPP_CRASH_NO_RESTART = 0x0001, + + /** + * JS_CRASH_NO_RESTART: Do not restart if process terminates due to js/ts/ets exception + */ + JS_CRASH_NO_RESTART = 0x0002, + + /** + * APP_FREEZE_NO_RESTART: Do not restart if process terminates due to appliction not respondong + */ + APP_FREEZE_NO_RESTART = 0x0004, + + /** + * NO_RESTART: Do not restart + */ + NO_RESTART = 0xFFFF, + } + + /** + * The type of when to save. + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + enum SaveOccasionFlag { + /** + * SAVE_WHEN_ERROR is saving when an error occurs. + */ + SAVE_WHEN_ERROR = 0x0001, + + /** + * SAVE_WHEN_CREATE is saving on background. + */ + SAVE_WHEN_BACKGROUND = 0x0002, + } + + /** + * The type of where to save. + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + enum SaveModeFlag { + /** + * SAVE_WITH_FILE is saving to file. + */ + SAVE_WITH_FILE = 0x0001, + + /** + * SAVE_WITH_SHARED_MEMORY is saving to shared memory. + */ + SAVE_WITH_SHARED_MEMORY = 0x0002, + } + + /** + * Enable appRecovery and app supports save and restore + * @param restart no restart mode + * @param saveOccasion The type of When to save + * @param saveMode The type of where to save + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + function enableAppRecovery(restart?: RestartFlag, saveOccasion?: SaveOccasionFlag, saveMode?: SaveModeFlag) : void; + + /** + * Restart App when called + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + function restartApp(): void; + + /** + * Save App state data when called + * @return true if save data successfully, otherwise false + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + function saveAppState(): boolean; +} + +export default appRecovery; \ No newline at end of file diff --git a/api/@ohos.app.ability.common.d.ts b/api/@ohos.app.ability.common.d.ts new file mode 100755 index 0000000000000000000000000000000000000000..0661aafb085f73cc58af79e159fd10a7bbcfec58 --- /dev/null +++ b/api/@ohos.app.ability.common.d.ts @@ -0,0 +1,152 @@ +/* + * 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 _UIAbilityContext from './application/UIAbilityContext'; +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 { 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. + * @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 UIAbilityContext = _UIAbilityContext.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 + + /** + * 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.uiAppearance.d.ts b/api/@ohos.app.ability.contextConstant.d.ts similarity index 40% rename from api/@ohos.uiAppearance.d.ts rename to api/@ohos.app.ability.contextConstant.d.ts index 5a65a569d5106e0c737b7aa6d57bfb22f4bfea58..fef30c258137c93aa886274469405968c2b1e884 100644 --- a/api/@ohos.uiAppearance.d.ts +++ b/api/@ohos.app.ability.contextConstant.d.ts @@ -13,45 +13,35 @@ * limitations under the License. */ -import { AsyncCallback, Callback } from './basic'; - /** - * Provide APIs to set system uiAppearance. - * @syscap SystemCapability.ArkUI.UiAppearance - * @import import uiAppearance from '@ohos.uiAppearance'; + * The context of an application. It allows access to application-specific resources. + * * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly */ -declare namespace uiAppearance { + declare namespace contextConstant { + /** - * Enumerates dark-mode. + * File area mode + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly */ - enum DarkMode { + export enum AreaMode { /** - * Always display with dark mode. + * System level device encryption area + * @syscap SystemCapability.Ability.AbilityRuntime.Core */ - ALWAYS_DARK = 0, + EL1 = 0, /** - * Always display with light mode. + * User credential encryption area + * @syscap SystemCapability.Ability.AbilityRuntime.Core */ - ALWAYS_LIGHT = 1 + EL2 = 1 } - - /** - * Set the system dark-mode. - * @param mode Indicates the dark-mode to set - * @permission ohos.permission.UPDATE_CONFIGURATION - * @systemapi Hide this for inner system use - */ - function setDarkMode(mode: DarkMode, callback: AsyncCallback): void; - function setDarkMode(mode: DarkMode): Promise; - - /** - * Acquire the current dark-mode. - * @return current dark-mode. - * @permission ohos.permission.UPDATE_CONFIGURATION - * @systemapi Hide this for inner system use - */ - function getDarkMode(): DarkMode; } -export default uiAppearance; \ No newline at end of file + +export default contextConstant; \ 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 0000000000000000000000000000000000000000..10573f876d2656e024b895b74ab3b8210e0b2bad --- /dev/null +++ b/api/@ohos.app.ability.errorManager.d.ts @@ -0,0 +1,67 @@ +/* + * 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. + * @namespace errorManager + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ +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 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 off. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + 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 off(type: "error", observerId: number): Promise; + + /** + * The observer will be called by system when an error occurs. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + 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 0000000000000000000000000000000000000000..898b5b42d1dd88cf27fb4467eba6ad01d7294382 --- /dev/null +++ b/api/@ohos.app.ability.missionManager.d.ts @@ -0,0 +1,287 @@ +/* + * 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 { MissionInfo as _MissionInfo } from './application/MissionInfo'; +import { MissionListener as _MissionListener } from './application/MissionListener'; +import { MissionSnapshot as _MissionSnapshot } from './application/MissionSnapshot'; +import StartOptions from "./@ohos.app.ability.StartOptions"; + +/** + * This module provides the capability to manage abilities and obtaining system task information. + * @permission ohos.permission.MANAGE_MISSIONS + * @namespace missionManager + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @systemapi + * @since 9 + */ +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 on(type: "mission", listener: MissionListener): number; + + /** + * Unregister the missionListener to ams. + * @param { string } type - mission. + * @param { number } listenerId - Indicates the listener id to be unregistered. + * @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 off(type: "mission", listenerId: number, callback: AsyncCallback): void; + + /** + * Unregister 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 off(type: "mission", listenerId: number): Promise; + + /** + * 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. + * @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 + * @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. + * @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 + * @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. + * @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 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 + * @since 9 + */ + function getLowResolutionMissionSnapShot(deviceId: string, missionId: number): Promise; + + /** + * Lock the mission. + * @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 + * @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. + * @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 + * @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. + * @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 + * @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. + * @param { AsyncCallback } callback - The callback of clearAllMissions. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @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. + * @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 + * @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. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @systemapi + * @since 9 + */ + export type MissionInfo = _MissionInfo + + /** + * MissionListener registered by app. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @systemapi + * @since 9 + */ + export type MissionListener = _MissionListener + + /** + * Mission snapshot corresponding to mission. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @systemapi + * @since 9 + */ + export type MissionSnapshot = _MissionSnapshot +} + +export default missionManager; \ No newline at end of file diff --git a/api/@ohos.application.quickFixManager.d.ts b/api/@ohos.app.ability.quickFixManager.d.ts similarity index 58% rename from api/@ohos.application.quickFixManager.d.ts rename to api/@ohos.app.ability.quickFixManager.d.ts index d30e16fe0359d8994441e76fc13321cff46eaf58..89cf51bc871e11911812bfe0513f681c01cf14f4 100644 --- a/api/@ohos.application.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.ability.wantAgent.d.ts b/api/@ohos.app.ability.wantAgent.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fa4f617f99c10381ab342e891d570f9c5a16ce48 --- /dev/null +++ b/api/@ohos.app.ability.wantAgent.d.ts @@ -0,0 +1,350 @@ +/* + * 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 , Callback} from './basic'; +import Want from './@ohos.app.ability.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. + * @namespace wantAgent + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ +declare namespace wantAgent { + /** + * Obtains the bundle name of a WantAgent. + * @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 } 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 { 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 { 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; + + /** + * Cancel a WantAgent. Only the application that creates the WantAgent can cancel it. + * @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; + + /** + * Cancel 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 } 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 + */ + function trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: AsyncCallback): void; + + /** + * Checks whether two WantAgent objects are equal. + * @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 { 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 + */ + 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 { + /** + * 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. + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + 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. + * @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 }; + } + + /** + * Provides the information required for triggering a WantAgent. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + export type TriggerInfo = _TriggerInfo + + /** + * Provides the information required for triggering a WantAgent. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + export type WantAgentInfo = _WantAgentInfo +} + +/** + * WantAgent object. + */ +export type WantAgent = object; + +export default wantAgent; diff --git a/api/@ohos.app.ability.wantConstant.d.ts b/api/@ohos.app.ability.wantConstant.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2bcb30051a9bf9ee152d5adec3167a4cceda3130 --- /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 the application account auth service. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_APP_ACCOUNT_AUTH = "ohos.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 specified 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; diff --git a/api/@ohos.app.form.FormExtensionAbility.d.ts b/api/@ohos.app.form.FormExtensionAbility.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a767413cb770b8ad1d3a2d7cf0142ad01095a64c --- /dev/null +++ b/api/@ohos.app.form.FormExtensionAbility.d.ts @@ -0,0 +1,138 @@ +/* + * 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.app.form.formInfo"; +import FormExtensionContext from "./application/FormExtensionContext"; +import Want from './@ohos.app.ability.Want'; +import { Configuration } from './@ohos.app.ability.Configuration'; + +/** + * class of form extension. + * @syscap SystemCapability.Ability.Form + * @StageModelOnly + * @since 9 + */ +export default class FormExtensionAbility { + /** + * Indicates form extension context. + * @type { FormExtensionContext } + * @syscap SystemCapability.Ability.Form + * @StageModelOnly + * @since 9 + */ + context: FormExtensionContext; + + /** + * Called to return a {@link formBindingData#FormBindingData} object. + * @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 + * @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. + * @param { string } formId - Indicates the ID of the form. + * @syscap SystemCapability.Ability.Form + * @StageModelOnly + * @since 9 + */ + onCastToNormalForm(formId: string): void; + + /** + * Called to notify the form provider to update a specified form. + * @param { string } formId - Indicates the ID of the form to update. + * @syscap SystemCapability.Ability.Form + * @StageModelOnly + * @since 9 + */ + onUpdateForm(formId: string): void; + + /** + * Called when the form provider receives form events from the system. + * @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 + * @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. + * @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 + * @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. + * @param { string } formId - Indicates the ID of the destroyed form. + * @syscap SystemCapability.Ability.Form + * @StageModelOnly + * @since 9 + */ + onRemoveForm(formId: string): void; + + /** + * Called when the system configuration is updated. + * @param { Configuration } newConfig - Indicates the system configuration, such as language and color mode. + * @syscap SystemCapability.Ability.Form + * @StageModelOnly + * @since 9 + */ + onConfigurationUpdate(newConfig: 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.

          + * @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 + * @StageModelOnly + * @since 9 + */ + onAcquireFormState?(want: Want): formInfo.FormState; + + /** + * Called when the system shares the form. + * @param { string } formId - Indicates the ID of the form. + * @return { { [key: string]: any } } Returns the wantParams object. + * @syscap SystemCapability.Ability.Form + * @systemapi + * @StageModelOnly + * @since 9 + */ + onShareForm?(formId: string): { [key: string]: any }; +} diff --git a/api/@ohos.app.form.formHost.d.ts b/api/@ohos.app.form.formHost.d.ts index 4e066920eb4431adadb9b56d4489e516ec58bee8..acc0981a47109ba4e1887aa344cb82614a886b77 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. @@ -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. @@ -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 diff --git a/api/@ohos.app.form.formInfo.d.ts b/api/@ohos.app.form.formInfo.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d075eb7b8980a1feeb320d6a3b4f259e9a5d8680 --- /dev/null +++ b/api/@ohos.app.form.formInfo.d.ts @@ -0,0 +1,486 @@ +/* + * 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.app.ability.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: "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.app.form.formProvider.d.ts b/api/@ohos.app.form.formProvider.d.ts index f2a87e039e76e711005d86f00afb4dffcad483b8..31b048c78337ba2b85652aae4e58552c11f906eb 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.Ability.d.ts b/api/@ohos.application.Ability.d.ts old mode 100755 new mode 100644 index 99cfd355610983da6d601b990f88caef60734b66..2a7fd56303250fe6aa36649340ffe327ef3b2b40 --- 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.UIAbility */ 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.UIAbility */ 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.UIAbility */ 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.UIAbility */ 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.UIAbility */ export default class Ability { /** @@ -314,4 +324,16 @@ export default class Ability { * @StageModelOnly */ onMemoryLevel(level: AbilityConstant.MemoryLevel): void; + + /** + * Called back when an ability prepares to save. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param reason state type when save. + * @param wantParam Indicates the want parameter. + * @return 0 if ability agrees to save data successfully, otherwise errcode. + * @StageModelOnly + */ + onSaveState(reason: AbilityConstant.StateType, wantParam : {[key: string]: any}): AbilityConstant.OnSaveResult; } diff --git a/api/@ohos.application.AbilityConstant.d.ts b/api/@ohos.application.AbilityConstant.d.ts index 2847a26649da5ad1cd18755a44126c049512fb47..de8f4b4979e1199a1b8a60a5228f62da27309d36 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 { /** @@ -61,6 +63,7 @@ declare namespace AbilityConstant { START_ABILITY = 1, CALL = 2, CONTINUATION = 3, + APP_RECOVERY = 4, } /** @@ -116,6 +119,34 @@ declare namespace AbilityConstant { WINDOW_MODE_SPLIT_SECONDARY = 101, WINDOW_MODE_FLOATING = 102, } + + /** + * Type of onSave result. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ + export enum OnSaveResult { + ALL_AGREE = 0, + CONTINUATION_REJECT = 1, + CONTINUATION_MISMATCH = 2, + RECOVERY_AGREE = 3, + RECOVERY_REJECT = 4, + ALL_REJECT, + } + + /** + * Type of save state. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ + export enum StateType { + CONTINUATION = 0, + APP_RECOVERY = 1, + } } export default AbilityConstant diff --git a/api/@ohos.application.AbilityLifecycleCallback.d.ts b/api/@ohos.application.AbilityLifecycleCallback.d.ts index 33db234da5362cd83e943d739ec29e5eb86d02dd..4e1f22ac9c3d3528091f2325a41d6da4514045c1 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 a0369329ced0b6fd370c0dba7f70721357ac2e33..7b452bb7479ea4ab7140b8ee45ed368bd15cf52a 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 { /** @@ -51,7 +53,7 @@ export default class AbilityStage { * * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the want info of startd ability. + * @param want Indicates the want info of started 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. diff --git a/api/@ohos.application.AccessibilityExtensionAbility.d.ts b/api/@ohos.application.AccessibilityExtensionAbility.d.ts index ad77b7399346f6d19a10f2192790a5deb4a27106..7a6c8527d3a6d491bb29c70dac013b4dcf0e450e 100644 --- a/api/@ohos.application.AccessibilityExtensionAbility.d.ts +++ b/api/@ohos.application.AccessibilityExtensionAbility.d.ts @@ -67,7 +67,7 @@ declare interface AccessibilityEvent { } /** - * Indicates the gusture type. + * Indicates the gesture type. * @since 9 * @syscap SystemCapability.BarrierFree.Accessibility.Core */ diff --git a/api/@ohos.application.Configuration.d.ts b/api/@ohos.application.Configuration.d.ts index b1c3861169ad7dcd36bd1e5e1940b4cfc8228cb6..2d339a39400374a1178cb4e08795ad856cd794c6 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 { /** diff --git a/api/@ohos.application.ConfigurationConstant.d.ts b/api/@ohos.application.ConfigurationConstant.d.ts index cdf3b32724869aa6705e85d53a58b7dddbff196f..7e3853aa5d8abc9dd362264bc2c0843a7eb48e20 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 { /** diff --git a/api/@ohos.application.DataShareExtensionAbility.d.ts b/api/@ohos.application.DataShareExtensionAbility.d.ts index c56abbdeb80e869e54c74922973de15f38983f3f..5af2f87aa3a8c48b8f0c9a2f8b3722ae9c4ac18c 100644 --- a/api/@ohos.application.DataShareExtensionAbility.d.ts +++ b/api/@ohos.application.DataShareExtensionAbility.d.ts @@ -45,7 +45,7 @@ export default class DataShareExtensionAbility { * @syscap SystemCapability.DistributedDataManager.DataShare.Provider * @param want Indicates connection information about the datashare extension ability. * @systemapi Hide this for inner system use. - * @return - + * @returns - * @StageModelOnly */ onCreate?(want: Want, callback: AsyncCallback): void; @@ -58,7 +58,7 @@ export default class DataShareExtensionAbility { * @param uri Indicates the position where the data is to insert. * @param valueBucket Indicates the data to insert. * @systemapi Hide this for inner system use. - * @return Returns the index of the newly inserted data record. + * @returns Returns the index of the newly inserted data record. * @StageModelOnly */ insert?(uri: string, valueBucket: ValuesBucket, callback: AsyncCallback): void; @@ -73,7 +73,7 @@ export default class DataShareExtensionAbility { * default. * @param valueBucket Indicates the data to update. This parameter can be null. * @systemapi Hide this for inner system use. - * @return Returns the number of data records updated. + * @returns Returns the number of data records updated. * @StageModelOnly */ update?(uri: string, predicates: dataSharePredicates.DataSharePredicates, valueBucket: ValuesBucket, @@ -88,15 +88,14 @@ export default class DataShareExtensionAbility { * @param predicates Indicates filter criteria. If this parameter is null, all data records will be deleted by * default. * @systemapi Hide this for inner system use. - * @return Returns the number of data records deleted. + * @returns Returns the number of data records deleted. * @StageModelOnly */ delete?(uri: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; /** * Queries one or more data records in the database. This method should be implemented by a data share. - * - * @note Only RDB and distributed KVDB resultsets are supported. The current version does not support custom resultsets. + * Only RDB and distributed KVDB resultsets are supported. The current version does not support custom resultsets. * @since 9 * @syscap SystemCapability.DistributedDataManager.DataShare.Provider * @param uri Indicates the database table storing the data to query. @@ -105,7 +104,7 @@ export default class DataShareExtensionAbility { * @param columns Indicates the columns to be queried, in array, for example, {"name","age"}. You should define * the processing logic when this parameter is null. * @systemapi Hide this for inner system use. - * @return Returns the queried data, only support result set of rdb or kvstore. + * @returns Returns the queried data, only support result set of rdb or kvstore. * @StageModelOnly */ query?(uri: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array, @@ -119,7 +118,7 @@ export default class DataShareExtensionAbility { * @param uri Indicates the position where the data is to insert. * @param valueBuckets Indicates the data to insert. * @systemapi Hide this for inner system use. - * @return Returns the number of data records inserted. + * @returns Returns the number of data records inserted. * @StageModelOnly */ batchInsert?(uri: string, valueBuckets: Array, callback: AsyncCallback): void; @@ -133,7 +132,7 @@ export default class DataShareExtensionAbility { * @syscap SystemCapability.DistributedDataManager.DataShare.Provider * @param uri Indicates the uri to normalize. * @systemapi Hide this for inner system use. - * @return Returns the normalized uri if the data share supports URI normalization; + * @returns Returns the normalized uri if the data share supports URI normalization; * @StageModelOnly */ normalizeUri?(uri: string, callback: AsyncCallback): void; @@ -146,7 +145,7 @@ export default class DataShareExtensionAbility { * @syscap SystemCapability.DistributedDataManager.DataShare.Provider * @param uri Indicates the uri to denormalize. * @systemapi Hide this for inner system use. - * @return Returns the denormalized {@code uri} object if the denormalization is successful; returns the original + * @returns Returns the denormalized {@code uri} object if the denormalization is successful; returns the original * {@code uri} passed to this method if there is nothing to do; returns {@code null} if the data identified by * the original {@code uri} cannot be found in the current environment. * @StageModelOnly diff --git a/api/@ohos.application.EnvironmentCallback.d.ts b/api/@ohos.application.EnvironmentCallback.d.ts index b19bd5792eff52fc21ea06e0d6501cf543ba9f7c..55f6504a703c7fb597ea521be36d6df177ab16d4 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 3cfd0d921354adae992e94462b2adb463e8b5dc4..eda81a8ac3c5ace16928b4a04e0072336177b684 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 4c52a8387e5b8fe5d5cde711b3f72c6d13f698cf..e3bbfc7fdc0aaba3789c923bb11e05214329e07e 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 9b7e74eb470afa71b6dad5910c8255d029a9c3a1..5b850b90f6fde5f4dd8e9c491e93e6e1161d96a7 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 { /** diff --git a/api/@ohos.application.StartOptions.d.ts b/api/@ohos.application.StartOptions.d.ts index b4cd41bbceab5748d8c933e5331f968ec393817e..0fc112e6d91d9097b515f98c4d9ebb8e760bfc79 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.Want.d.ts b/api/@ohos.application.Want.d.ts index 1a54ebefd9e6dd0cff0c86d9681044c0147318b1..b417aba928315badd9a3438d4c36c03f10c962e8 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 { /** diff --git a/api/@ohos.application.abilityDelegatorRegistry.d.ts b/api/@ohos.application.abilityDelegatorRegistry.d.ts index ad936320c56840c0517b6d5d55d041aab539644d..b5912a8143be066b95d9838231f87251a3f97788 100644 --- a/api/@ohos.application.abilityDelegatorRegistry.d.ts +++ b/api/@ohos.application.abilityDelegatorRegistry.d.ts @@ -24,8 +24,9 @@ import { ShellCmdResult as _ShellCmdResult } from './application/shellCmdResult' * * @since 8 * @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 { /** @@ -33,7 +34,7 @@ declare namespace abilityDelegatorRegistry { * * @since 8 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @return the AbilityDelegator object initialized when the application is started. + * @returns the AbilityDelegator object initialized when the application is started. */ function getAbilityDelegator(): AbilityDelegator; @@ -42,7 +43,7 @@ declare namespace abilityDelegatorRegistry { * * @since 8 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @return the previously registered AbilityDelegatorArgs object. + * @returns the previously registered AbilityDelegatorArgs object. */ function getArguments(): AbilityDelegatorArgs; @@ -65,7 +66,6 @@ declare namespace abilityDelegatorRegistry { * * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @import import AbilityDelegator from 'application/abilityDelegator.d' */ export type AbilityDelegator = _AbilityDelegator @@ -74,7 +74,6 @@ declare namespace abilityDelegatorRegistry { * * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @import import AbilityDelegatorArgs from 'application/abilityDelegatorArgs.d' */ export type AbilityDelegatorArgs = _AbilityDelegatorArgs @@ -84,7 +83,6 @@ declare namespace abilityDelegatorRegistry { * * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @import import AbilityMonitor from 'application/abilityMonitor.d' */ export type AbilityMonitor = _AbilityMonitor @@ -93,7 +91,6 @@ declare namespace abilityDelegatorRegistry { * * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @import import ShellCmdResult from 'application/shellCmdResult.d' */ export type ShellCmdResult = _ShellCmdResult } diff --git a/api/@ohos.application.abilityManager.d.ts b/api/@ohos.application.abilityManager.d.ts index a35eebd58311a8ce2ebcd8102ae9b4c09abf6649..e285752b751dd220a71cfa7a775e961ec95342a6 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 { /** @@ -50,19 +52,19 @@ declare namespace abilityManager { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @param config Indicates the new configuration. * @systemapi Hide this for inner system use. - * @return - + * @returns - * @permission ohos.permission.UPDATE_CONFIGURATION */ function updateConfiguration(config: Configuration, callback: AsyncCallback): void; function updateConfiguration(config: Configuration): Promise; /** - * Get information about running abilitys + * Get information about running abilities * * @since 8 * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi Hide this for inner system use. - * @return Returns the array of {@link AbilityRunningInfo}. + * @returns Returns the array of {@link AbilityRunningInfo}. * @permission ohos.permission.GET_RUNNING_INFO */ function getAbilityRunningInfos(): Promise>; @@ -75,7 +77,7 @@ declare namespace abilityManager { * @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}. + * @returns Returns the array of {@link ExtensionRunningInfo}. * @permission ohos.permission.GET_RUNNING_INFO */ function getExtensionRunningInfos(upperLimit: number): Promise>; @@ -87,7 +89,7 @@ declare namespace abilityManager { * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi Hide this for inner system use. - * @return Returns the {@link ElementName} info of the top ability. + * @returns Returns the {@link ElementName} info of the top ability. */ function getTopAbility(): Promise; function getTopAbility(callback: AsyncCallback): void; diff --git a/api/@ohos.application.appManager.d.ts b/api/@ohos.application.appManager.d.ts index 834a8ef58d767279399e56eec2936495cedce034..55a7bfcf71602d5edc264965e13aaea04657a50d 100644 --- a/api/@ohos.application.appManager.d.ts +++ b/api/@ohos.application.appManager.d.ts @@ -25,8 +25,9 @@ import { ProcessRunningInformation as _ProcessRunningInformation } from './appli * * @since 8 * @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 { /** @@ -68,7 +69,7 @@ declare namespace appManager { * @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. + * @returns Returns the number code of the observer. * @permission ohos.permission.RUNNING_STATE_OBSERVER */ function registerApplicationStateObserver(observer: ApplicationStateObserver): number; @@ -82,7 +83,7 @@ declare namespace appManager { * @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. + * @returns Returns the number code of the observer. * @permission ohos.permission.RUNNING_STATE_OBSERVER */ function registerApplicationStateObserver(observer: ApplicationStateObserver, bundleNameList: Array): number; @@ -94,7 +95,7 @@ declare namespace appManager { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @param observerId Indicates the number code of the observer. * @systemapi hide this for inner system use - * @return - + * @returns - * @permission ohos.permission.RUNNING_STATE_OBSERVER */ function unregisterApplicationStateObserver(observerId: number, callback: AsyncCallback): void; @@ -106,7 +107,7 @@ declare namespace appManager { * @since 8 * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi hide this for inner system use - * @return Returns the list of AppStateData. + * @returns Returns the list of AppStateData. * @permission ohos.permission.GET_RUNNING_INFO */ function getForegroundApplications(callback: AsyncCallback>): void; @@ -120,7 +121,7 @@ declare namespace appManager { * @param bundleName The process bundle name. * @param accountId The account id. * @systemapi hide this for inner system use - * @return - + * @returns - * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS and ohos.permission.CLEAN_BACKGROUND_PROCESSES */ function killProcessWithAccount(bundleName: string, accountId: number): Promise; @@ -131,7 +132,7 @@ declare namespace appManager { * * @since 8 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @return Returns true if user is running stability test. + * @returns Returns true if user is running stability test. */ function isRunningInStabilityTest(callback: AsyncCallback): void; function isRunningInStabilityTest(): Promise; @@ -141,7 +142,7 @@ declare namespace appManager { * * @since 8 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @return Returns the array of {@link ProcessRunningInfo}. + * @returns Returns the array of {@link ProcessRunningInfo}. * @permission ohos.permission.GET_RUNNING_INFO * @deprecated since 9 * @useinstead getProcessRunningInformation @@ -175,7 +176,7 @@ declare namespace appManager { * Is it a ram-constrained device * @since 7 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @return whether a ram-constrained device. + * @returns whether a ram-constrained device. */ function isRamConstrainedDevice(): Promise; function isRamConstrainedDevice(callback: AsyncCallback): void; @@ -184,7 +185,7 @@ declare namespace appManager { * Get the memory size of the application * @since 7 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @return application memory size. + * @returns application memory size. */ function getAppMemorySize(): Promise; function getAppMemorySize(callback: AsyncCallback): void; @@ -194,7 +195,7 @@ declare namespace appManager { * * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @return Returns the array of {@link ProcessRunningInformation}. + * @returns Returns the array of {@link ProcessRunningInformation}. * @permission ohos.permission.GET_RUNNING_INFO */ function getProcessRunningInformation(): Promise>; diff --git a/api/@ohos.application.context.d.ts b/api/@ohos.application.context.d.ts index cae84c127a276814734bf67b0dca81780e7a3d09..da1ee4f905a2d0e2319a4a3bd9c3d42f336f0c92 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 { @@ -97,24 +99,6 @@ declare namespace context { */ export type FormExtensionContext = _FormExtensionContext.default - /** - * 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 - } - /** * The event center of a context, support the subscription and publication of events. * diff --git a/api/@ohos.application.errorManager.d.ts b/api/@ohos.application.errorManager.d.ts index dda4361c792b435dc9a79088111180181cbd6216..57a490dc8b8ea03523b45eef80f25e3b7bd761ee 100644 --- a/api/@ohos.application.errorManager.d.ts +++ b/api/@ohos.application.errorManager.d.ts @@ -21,8 +21,9 @@ import * as _ErrorObserver from './application/ErrorObserver'; * * @since 9 * @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 { /** @@ -32,7 +33,7 @@ declare namespace errorManager { * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core * @param observer The error observer. - * @return Returns the number code of the observer. + * @returns Returns the number code of the observer. */ function registerErrorObserver(observer: ErrorObserver): number; @@ -42,7 +43,7 @@ declare namespace errorManager { * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core * @param observerId Indicates the number code of the observer. - * @return - + * @returns - */ function unregisterErrorObserver(observerId: number, callback: AsyncCallback): void; function unregisterErrorObserver(observerId: number): Promise; diff --git a/api/@ohos.application.formHost.d.ts b/api/@ohos.application.formHost.d.ts index 7f38585edabb70d8c6e2e0e0b99c3bc68bf2c797..90fb9445d1f23325fcf414651c1543a48673dc95 100644 --- a/api/@ohos.application.formHost.d.ts +++ b/api/@ohos.application.formHost.d.ts @@ -137,7 +137,7 @@ declare namespace formHost { function enableFormsUpdate(formIds: Array): Promise; /** - * Notifys the form framework to make the specified forms non updatable. + * Notify the form framework to make the specified forms non updatable. * *

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

          @@ -197,7 +197,7 @@ declare namespace formHost { * @syscap SystemCapability.Ability.Form * @param formIds Indicates the specify form id. * @return Returns the number of invalid forms deleted by the Form Manager Service - * @permission ohos.permission.REQUIRE_FORM. + * @permission ohos.permission.REQUIRE_FORM */ function deleteInvalidForms(formIds: Array, callback: AsyncCallback): void; function deleteInvalidForms(formIds: Array): Promise; @@ -211,7 +211,7 @@ declare namespace formHost { * @syscap SystemCapability.Ability.Form * @param want Indicates want of the form. * @return Returns form state {@link FormStateInfo} - * @permission ohos.permission.REQUIRE_FORM and ohos.permission.GET_BUNDLE_INFO_PRIVILEGED. + * @permission ohos.permission.REQUIRE_FORM and ohos.permission.GET_BUNDLE_INFO_PRIVILEGED */ function acquireFormState(want: Want, callback: AsyncCallback): void; function acquireFormState(want: Want): Promise; @@ -241,7 +241,7 @@ declare namespace formHost { function off(type: "formUninstall", callback?: Callback): void; /** - * notify form is Visible + * Notify form is Visible * *

          You can use this method to notify form visible state.

          * @@ -250,13 +250,13 @@ declare namespace formHost { * @param formIds Indicates the specify form id. * @param isVisible Indicates whether visible. * @return - - * @permission ohos.permission.REQUIRE_FORM. + * @permission ohos.permission.REQUIRE_FORM */ function notifyFormsVisible(formIds: Array, isVisible: boolean, callback: AsyncCallback): void; function notifyFormsVisible(formIds: Array, isVisible: boolean): Promise; /** - * notify form enable update state. + * Notify form enable update state. * *

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

          * @@ -265,7 +265,7 @@ declare namespace formHost { * @param formIds Indicates the specify form id. * @param isEnableUpdate Indicates whether enable update. * @return - - * @permission ohos.permission.REQUIRE_FORM. + * @permission ohos.permission.REQUIRE_FORM */ function notifyFormsEnableUpdate(formIds: Array, isEnableUpdate: boolean, callback: AsyncCallback): void; function notifyFormsEnableUpdate(formIds: Array, isEnableUpdate: boolean): Promise; @@ -285,7 +285,7 @@ declare namespace formHost { function shareForm(formId: string, deviceId: string): Promise; /** - * notify form that privacy wether need to be protected. + * Notify form that privacy wether need to be protected. * * @since 9 * @syscap SystemCapability.Ability.Form @@ -293,7 +293,7 @@ declare namespace formHost { * @param isProtected Indicates whether enable update. * @systemapi hide for inner use. * @return - - * @permission ohos.permission.REQUIRE_FORM. + * @permission ohos.permission.REQUIRE_FORM */ function notifyFormsPrivacyProtected(formIds: Array, isProtected: boolean, callback: AsyncCallback): void; function notifyFormsPrivacyProtected(formIds: Array, isProtected: boolean): Promise; diff --git a/api/@ohos.application.formInfo.d.ts b/api/@ohos.application.formInfo.d.ts index 46c60e52744dacff91de00ec1ec7d58cabe75a3b..c1fef018f8b77fa3ef12de1ac626b9a5312eeaab 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 { /** @@ -190,7 +192,15 @@ declare namespace formInfo { * @since 8 * @syscap SystemCapability.Ability.Form */ - JS = 1 + JS = 1, + + /** + * eTS form. + * + * @since 9 + * @syscap SystemCapability.Ability.Form + */ + eTS = 2 } /** @@ -501,21 +511,21 @@ declare namespace formInfo { * @since 9 * @syscap SystemCapability.Ability.Form */ - interface VisibilityType { + enum VisibilityType { /** * Indicates the type of the form is visible. - * Often used as a condition variable in function OnVisibilityChanged() to specify actions only on forms that are + * Often used as a condition variable in function OnVisibilityChange() to specify actions only on forms that are * changing to visible. * @since 9 */ - FORM_VISIBLE: number, + FORM_VISIBLE = 1, /** * Indicates the type of the form is invisible. - * Often used as a condition variable in function OnVisibilityChanged() to specify actions only on forms that are + * Often used as a condition variable in function OnVisibilityChange() to specify actions only on forms that are * changing to invisible. * @since 9 */ - FORM_INVISIBLE: number + FORM_INVISIBLE, } } export default formInfo; \ No newline at end of file diff --git a/api/@ohos.application.missionManager.d.ts b/api/@ohos.application.missionManager.d.ts index 3f43e85ddc99b2646f8bb7b1cb80c07b05a882f0..2ecb582a8e1f268a597ae9c1d468bfa465f3b50f 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 { /** @@ -40,7 +42,7 @@ declare namespace missionManager { function registerMissionListener(listener: MissionListener): number; /** - * Unrgister the missionListener to ams. + * Unregister the missionListener to ams. * * @since 8 * @syscap SystemCapability.Ability.AbilityRuntime.Mission diff --git a/api/@ohos.backgroundTaskManager.d.ts b/api/@ohos.backgroundTaskManager.d.ts index dc66d4f79d68e148c34118e041d5f82ac35b1042..f707324f0ea1b535281e6bbeae6222fbe2126175 100644 --- a/api/@ohos.backgroundTaskManager.d.ts +++ b/api/@ohos.backgroundTaskManager.d.ts @@ -22,6 +22,8 @@ import Context from './application/BaseContext'; * * @since 7 * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask + * @deprecated since 9 + * @useinstead ohos.resourceschedule.backgroundTaskManager */ declare namespace backgroundTaskManager { /** @@ -30,6 +32,8 @@ declare namespace backgroundTaskManager { * @name DelaySuspendInfo * @since 7 * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask + * @deprecated since 9 + * @useinstead ohos.resourceschedule.backgroundTaskManager.DelaySuspendInfo */ interface DelaySuspendInfo { /** @@ -48,6 +52,8 @@ declare namespace backgroundTaskManager { * @since 7 * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask * @param requestId Indicates the identifier of the delay request. + * @deprecated since 9 + * @useinstead ohos.resourceschedule.backgroundTaskManager.cancelSuspendDelay */ function cancelSuspendDelay(requestId: number): void; @@ -57,7 +63,9 @@ declare namespace backgroundTaskManager { * @since 7 * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask * @param requestId Indicates the identifier of the delay request. - * @return The remaining delay time + * @returns The remaining delay time + * @deprecated since 9 + * @useinstead ohos.resourceschedule.backgroundTaskManager.getRemainingDelayTime */ function getRemainingDelayTime(requestId: number, callback: AsyncCallback): void; function getRemainingDelayTime(requestId: number): Promise; @@ -69,7 +77,9 @@ declare namespace backgroundTaskManager { * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask * @param reason Indicates the reason for delayed transition to the suspended state. * @param callback The callback delay time expired. - * @return Info of delay request + * @returns Info of delay request + * @deprecated since 9 + * @useinstead ohos.resourceschedule.backgroundTaskManager.requestSuspendDelay */ function requestSuspendDelay(reason: string, callback: Callback): DelaySuspendInfo; @@ -83,6 +93,8 @@ declare namespace backgroundTaskManager { * @param context app running context. * @param bgMode Indicates which background mode to request. * @param wantAgent Indicates which ability to start when user click the notification bar. + * @deprecated since 9 + * @useinstead ohos.resourceschedule.backgroundTaskManager.startBackgroundRunning */ function startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: WantAgent, callback: AsyncCallback): void; function startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: WantAgent): Promise; @@ -93,34 +105,19 @@ declare namespace backgroundTaskManager { * @since 8 * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask * @param context app running context. + * @deprecated since 9 + * @useinstead ohos.resourceschedule.backgroundTaskManager.stopBackgroundRunning */ function stopBackgroundRunning(context: Context, callback: AsyncCallback): void; function stopBackgroundRunning(context: Context): Promise; /** - * Apply or unapply efficiency resources. - * - * @since 9 - * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply - * @return True if efficiency resources apply success, else false. - * @systemapi Hide this for inner system use. - */ - function applyEfficiencyResources(request: EfficiencyResourcesRequest): boolean; - - /** - * Reset all efficiency resources apply. - * - * @since 9 - * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply - * @systemapi Hide this for inner system use. - */ - function resetAllEfficiencyResources(): void; - - /** - * supported background mode. + * Supported background mode. * * @since 8 * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask + * @deprecated since 9 + * @useinstead ohos.resourceschedule.backgroundTaskManager.BackgroundMode */ export enum BackgroundMode { /** @@ -198,90 +195,6 @@ declare namespace backgroundTaskManager { */ TASK_KEEPING = 9, } - - /** - * The type of resource. - * - * @since 9 - * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply - * @systemapi Hide this for inner system use. - */ - export enum ResourceType { - /** - * The cpu resource for not being suspended. - */ - CPU = 1, - - /** - * The resource for not being proxyed common_event. - */ - COMMON_EVENT = 1 << 1, - - /** - * The resource for not being proxyed timer. - */ - TIMER = 1 << 2, - - /** - * The resource for not being proxyed workscheduler. - */ - WORK_SCHEDULER = 1 << 3, - - /** - * The resource for not being proxyed bluetooth. - */ - BLUETOOTH = 1 << 4, - - /** - * The resource for not being proxyed gps. - */ - GPS = 1 << 5, - - /** - * The resource for not being proxyed audio. - */ - AUDIO = 1 << 6 - } - - /** - * The request of efficiency resources. - * - * @name EfficiencyResourcesRequest - * @since 9 - * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply - * @systemapi Hide this for inner system use. - */ - export interface EfficiencyResourcesRequest { - /** - * The set of resource types that app wants to apply. - */ - resourceTypes: number; - - /** - * True if the app begin to use, else false. - */ - isApply: boolean; - - /** - * The duration that the resource can be used most. - */ - timeOut: number; - - /** - * True if the apply action is persist, else false. Default value is false. - */ - isPersist?: boolean; - - /** - * True if apply action is for process, false is for package. Default value is false. - */ - isProcess?: boolean; - - /** - * The apply reason. - */ - reason: string; - } } export default backgroundTaskManager; diff --git a/api/@ohos.batteryInfo.d.ts b/api/@ohos.batteryInfo.d.ts index 3a27e57498e94a60cd4ddeef9955d6320418b1ae..30342e91e018035fd115748a55c5201ae0042c1d 100644 --- a/api/@ohos.batteryInfo.d.ts +++ b/api/@ohos.batteryInfo.d.ts @@ -209,7 +209,7 @@ declare namespace batteryInfo { */ export enum BatteryCapacityLevel { /** - * The battery is in unknow capacity level. + * The battery is in unknown capacity level. * @since 9 */ LEVEL_NONE, @@ -241,7 +241,7 @@ declare namespace batteryInfo { } /** - * Etra key code of common event COMMON_EVENT_BATTERY_CHANGED. + * Extra key code of common event COMMON_EVENT_BATTERY_CHANGED. * * @syscap SystemCapability.PowerManager.BatteryManager.Core * @since 9 diff --git a/api/@ohos.batteryStatistics.d.ts b/api/@ohos.batteryStatistics.d.ts index 2af0b585edf9b146aefc712347f17068d347086c..45289ecc6ad827b0965431ae595e69f7e2e76f05 100755 --- a/api/@ohos.batteryStatistics.d.ts +++ b/api/@ohos.batteryStatistics.d.ts @@ -13,7 +13,7 @@ * limitations under the License. */ -import { AsyncCallback } from "./basic"; +import {AsyncCallback, BusinessError} from "./basic"; /** * Provides methods to get power consumption information. @@ -61,18 +61,28 @@ declare namespace batteryStats { /** * Obtains the power consumption information list. * - * @return Returns power consumption information list of a device. + * @returns {Promise>} Power consumption information list. * @systemapi * @since 8 */ function getBatteryStats(): Promise>; + + /** + * Obtains the power consumption information list. + * + * @param {AsyncCallback} callback Indicates the callback of power consumption information list. + * @throws {BusinessError} 401 - If the callback is not valid. + * @systemapi + * @since 8 + */ function getBatteryStats(callback: AsyncCallback>): void; /** * Obtains power consumption information(Mah) for a given uid. * - * @param uid Indicates the uid. - * @return Returns power consumption information(Mah). + * @param {number} uid Indicates the uid. + * @returns {number} Power consumption information(Mah). + * @throws {BusinessError} 4600101 - If connecting to the service failed. * @systemapi * @since 8 */ @@ -81,8 +91,9 @@ declare namespace batteryStats { /** * Obtains power consumption information(Percent) for a given uid. * - * @param uid Indicates the uid. - * @return Returns power consumption information(Percent). + * @param {number} uid Indicates the uid. + * @returns {number} Power consumption information(Percent). + * @throws {BusinessError} 4600101 - If connecting to the service failed. * @systemapi * @since 8 */ @@ -91,8 +102,10 @@ declare namespace batteryStats { /** * Obtains power consumption information(Mah) for a given type. * - * @param ConsumptionType Indicates the hardware type. - * @return Returns power consumption information(Mah). + * @param {ConsumptionType} type Indicates the hardware type. + * @returns {number} Power consumption information(Mah). + * @throws {BusinessError} 401 - If the type is not valid. + * @throws {BusinessError} 4600101 - If connecting to the service failed. * @systemapi * @since 8 */ @@ -101,8 +114,10 @@ declare namespace batteryStats { /** * Obtains power consumption information(Percent) for a given type. * - * @param ConsumptionType Indicates the hardware type. - * @return Returns power consumption information(Percent). + * @param {ConsumptionType} type Indicates the hardware type. + * @returns {number} Power consumption information(Percent). + * @throws {BusinessError} 401 - If the type is not valid. + * @throws {BusinessError} 4600101 - If connecting to the service failed. * @systemapi * @since 8 */ @@ -123,7 +138,7 @@ declare namespace batteryStats { /** The type related with the power consumption info. */ type: ConsumptionType; - /** The power consumption value(mah). */ + /** The power consumption value(Mah). */ power: number; } } diff --git a/api/@ohos.brightness.d.ts b/api/@ohos.brightness.d.ts index adb007cd2caa1996d525b861cac454b7a0137de9..ab8eec2b79966d52f5b3929fe5c78b99fcb9f613 100644 --- a/api/@ohos.brightness.d.ts +++ b/api/@ohos.brightness.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,7 +13,7 @@ * limitations under the License. */ -import { AsyncCallback } from './basic'; +import {BusinessError} from './basic'; /** * Provides interfaces to control the power of display. @@ -23,13 +23,15 @@ import { AsyncCallback } from './basic'; * @since 7 */ declare namespace brightness { - /** - * Sets the screen brightness. - * - * @param value Brightness value, ranging from 0 to 255. - * @systemapi - * @since 7 - */ - function setValue(value: number): void; + /** + * Sets the screen brightness. + * + * @param {number} value Brightness value, ranging from 0 to 255. + * @throws {BusinessError} 401 - If the value is not valid. + * @throws {BusinessError} 4700101 - If connecting to the service failed. + * @systemapi + * @since 7 + */ + function setValue(value: number): void; } export default brightness; diff --git a/api/@ohos.buffer.d.ts b/api/@ohos.buffer.d.ts index 3931a0aeaa132f260f13e734ba050ff121896529..9fc9a1bfac96e59997cd657d11f0d7f8957a9744 100644 --- a/api/@ohos.buffer.d.ts +++ b/api/@ohos.buffer.d.ts @@ -1,6 +1,6 @@ /* * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); + * Licensed under the Apache License, Version 2.0 (The type of "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * @@ -31,7 +31,8 @@ declare namespace buffer { * @param size The desired length of the new Buffer * @param [fill=0] A value to pre-fill the new Buffer with * @param [encoding='utf8'] If `fill` is a string, this is its encoding - * @return Return a new allocated Buffer + * @returns Return a new allocated Buffer + * @throws {BusinessError} 401 - if the input parameters are invalid. */ function alloc(size: number, fill?: string | Buffer | number, encoding?: BufferEncoding): Buffer; @@ -40,7 +41,8 @@ declare namespace buffer { * @since 9 * @syscap SystemCapability.Utils.Lang * @param size The desired length of the new Buffer - * @return Return a new allocated Buffer + * @returns Return a new allocated Buffer + * @throws {BusinessError} 401 - if the input parameters are invalid. */ function allocUninitializedFromPool(size: number): Buffer; @@ -49,7 +51,8 @@ declare namespace buffer { * @since 9 * @syscap SystemCapability.Utils.Lang * @param size The desired length of the new Buffer - * @return Return a new allocated Buffer + * @returns Return a new allocated Buffer + * @throws {BusinessError} 401 - if the input parameters are invalid. */ function allocUninitialized(size: number): Buffer; @@ -61,7 +64,8 @@ declare namespace buffer { * @syscap SystemCapability.Utils.Lang * @param string A value to calculate the length of * @param [encoding='utf8'] If `string` is a string, this is its encoding - * @return The number of bytes contained within `string` + * @returns The number of bytes contained within `string` + * @throws {BusinessError} 401 - if the input parameters are invalid. */ function byteLength(string: string | Buffer | TypedArray | DataView | ArrayBuffer | SharedArrayBuffer, encoding?: BufferEncoding): number; @@ -71,7 +75,9 @@ declare namespace buffer { * @syscap SystemCapability.Utils.Lang * @param list List of `Buffer` or Uint8Array instances to concatenate * @param totalLength Total length of the `Buffer` instances in `list` when concatenated - * @return Return a new allocated Buffer + * @returns Return a new allocated Buffer + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "length" is out of range. It must be >= 0 and <= uint32 max. Received value is: [length] */ function concat(list: Buffer[] | Uint8Array[], totalLength?: number): Buffer; @@ -80,7 +86,8 @@ declare namespace buffer { * @since 9 * @syscap SystemCapability.Utils.Lang * @param array an array of bytes in the range 0 – 255 - * @return Return a new allocated Buffer + * @returns Return a new allocated Buffer + * @throws {BusinessError} 401 - if the input parameters are invalid. */ function from(array: number[]): Buffer; @@ -91,7 +98,9 @@ declare namespace buffer { * @param arrayBuffer An ArrayBuffer, SharedArrayBuffer, for example the .buffer property of a TypedArray. * @param [byteOffset = 0] Index of first byte to expose * @param [length = arrayBuffer.byteLength - byteOffset] Number of bytes to expose - * @return Return a view of the ArrayBuffer + * @returns Return a view of the ArrayBuffer + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "[byteOffset/length]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [byteOffset/length] */ function from(arrayBuffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): Buffer; @@ -100,7 +109,8 @@ declare namespace buffer { * @since 9 * @syscap SystemCapability.Utils.Lang * @param buffer An existing Buffer or Uint8Array from which to copy data - * @return Return a new allocated Buffer + * @returns Return a new allocated Buffer + * @throws {BusinessError} 401 - if the input parameters are invalid. */ function from(buffer: Buffer | Uint8Array): Buffer; @@ -112,7 +122,8 @@ declare namespace buffer { * @param object An object supporting Symbol.toPrimitive or valueOf() * @param offsetOrEncoding A byte-offset or encoding * @param length A length - * @return Return a new allocated Buffer + * @returns Return a new allocated Buffer + * @throws {BusinessError} 401 - if the input parameters are invalid. */ function from(object: Object, offsetOrEncoding: number | string, length: number): Buffer; @@ -123,7 +134,8 @@ declare namespace buffer { * @syscap SystemCapability.Utils.Lang * @param string A string to encode * @param [encoding='utf8'] The encoding of string - * @return Return a new Buffer containing string + * @returns Return a new Buffer containing string + * @throws {BusinessError} 401 - if the input parameters are invalid. */ function from(string: String, encoding?: BufferEncoding): Buffer; @@ -132,7 +144,7 @@ declare namespace buffer { * @since 9 * @syscap SystemCapability.Utils.Lang * @param obj Objects to be judged - * @return true or false + * @returns true or false */ function isBuffer(obj: Object): boolean; @@ -141,7 +153,7 @@ declare namespace buffer { * @since 9 * @syscap SystemCapability.Utils.Lang * @param encoding A character encoding name to check - * @return true or false + * @returns true or false */ function isEncoding(encoding: string):boolean; @@ -151,9 +163,10 @@ declare namespace buffer { * @syscap SystemCapability.Utils.Lang * @param buf1 A Buffer or Uint8Array instance. * @param buf2 A Buffer or Uint8Array instance. - * @return 0 is returned if target is the same as buf + * @returns 0 is returned if target is the same as buf * 1 is returned if target should come before buf when sorted. * -1 is returned if target should come after buf when sorted. + * @throws {BusinessError} 401 - if the input parameters are invalid. */ function compare(buf1: Buffer | Uint8Array, buf2: Buffer | Uint8Array): -1 | 0 | 1; @@ -164,7 +177,8 @@ declare namespace buffer { * @param source A Buffer or Uint8Array instance. * @param fromEnc The current encoding * @param toEnc To target encoding - * @return Returns a new Buffer instance + * @returns Returns a new Buffer instance + * @throws {BusinessError} 401 - if the input parameters are invalid. */ function transcode(source: Buffer | Uint8Array, fromEnc: string, toEnc: string): Buffer; @@ -176,20 +190,23 @@ declare namespace buffer { * Returns the number of bytes in buf * @since 9 * @syscap SystemCapability.Utils.Lang + * @throws {BusinessError} 10200013 - Cannot set property length of Buffer which has only a getter */ length: number; /** * The underlying ArrayBuffer object based on which this Buffer object is created. * @since 9 - * @syscap SystemCapability.Utils.Lang + * @syscap SystemCapability.Utils.Lang + * @throws {BusinessError} 10200013 - Cannot set property buffer of Buffer which has only a getter */ buffer: ArrayBuffer; /** * The byteOffset of the Buffers underlying ArrayBuffer object * @since 9 - * @syscap SystemCapability.Utils.Lang + * @syscap SystemCapability.Utils.Lang + * @throws {BusinessError} 10200013 - Cannot set property byteOffset of Buffer which has only a getter */ byteOffset: number; @@ -201,7 +218,9 @@ declare namespace buffer { * @param [offset = 0] Number of bytes to skip before starting to fill buf * @param [end = buf.length] Where to stop filling buf (not inclusive) * @param [encoding='utf8'] The encoding for value if value is a string - * @return A reference to buf + * @returns A reference to buf + * @throws {BusinessError} 10200001 - The value of "[offset/end]" is out of range. It must be >= 0 and <= [right range]. Received value is: [offset/end] + * @throws {BusinessError} 401 - if the input parameters are invalid. */ fill(value: string | Buffer | Uint8Array | number, offset?: number, end?: number, encoding?: BufferEncoding): Buffer; @@ -215,9 +234,12 @@ declare namespace buffer { * @param [targetEnd = target.length] The offset within target at which to end comparison (not inclusive) * @param [sourceStart = 0] The offset within buf at which to begin comparison * @param [sourceEnd = buf.length] The offset within buf at which to end comparison (not inclusive) - * @return 0 is returned if target is the same as buf + * @returns 0 is returned if target is the same as buf * 1 is returned if target should come before buf when sorted. * -1 is returned if target should come after buf when sorted. + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "[targetStart/targetEnd/sourceStart/sourceEnd]" is out of range. + * It must be >= 0 and <= [right range]. Received value is: [targetStart/targetEnd/sourceStart/sourceEnd] */ compare(target: Buffer | Uint8Array, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): -1 | 0 | 1; @@ -230,7 +252,10 @@ declare namespace buffer { * @param [targetStart = 0] The offset within target at which to begin writing * @param [sourceStart = 0] The offset within buf from which to begin copying * @param [sourceEnd = buf.length] The offset within buf at which to stop copying (not inclusive) - * @return The number of bytes copied + * @returns The number of bytes copied + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "[targetStart/sourceStart/sourceEnd]" is out of range. It must be >= 0. + * Received value is: [targetStart/sourceStart/sourceEnd] */ copy(target: Buffer | Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; @@ -239,7 +264,8 @@ declare namespace buffer { * @since 9 * @syscap SystemCapability.Utils.Lang * @param otherBuffer A Buffer or Uint8Array with which to compare buf - * @return true or false + * @returns true or false + * @throws {BusinessError} 401 - if the input parameters are invalid. */ equals(otherBuffer: Uint8Array | Buffer): boolean; @@ -250,7 +276,8 @@ declare namespace buffer { * @param value What to search for * @param [byteOffset = 0] Where to begin searching in buf. If negative, then offset is calculated from the end of buf * @param [encoding='utf8'] If value is a string, this is its encoding - * @return true or false + * @returns true or false + * @throws {BusinessError} 401 - if the input parameters are invalid. */ includes(value: string | number | Buffer | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): boolean; @@ -261,7 +288,8 @@ declare namespace buffer { * @param value What to search for * @param [byteOffset = 0] Where to begin searching in buf * @param [encoding='utf8'] If value is a string, this is the encoding used to determine the binary representation of the string that will be searched for in buf - * @return The index of the first occurrence of value in buf, or -1 if buf does not contain value + * @returns The index of the first occurrence of value in buf, or -1 if buf does not contain value + * @throws {BusinessError} 401 - if the input parameters are invalid. */ indexOf(value: string | number | Buffer | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number; @@ -293,7 +321,8 @@ declare namespace buffer { * @param value What to search for * @param [byteOffset = 0] Where to begin searching in buf * @param [encoding='utf8'] If value is a string, this is the encoding used to determine the binary representation of the string that will be searched for in buf - * @return The index of the last occurrence of value in buf, or -1 if buf does not contain value + * @returns The index of the last occurrence of value in buf, or -1 if buf does not contain value + * @throws {BusinessError} 401 - if the input parameters are invalid. */ lastIndexOf(value: string | number | Buffer | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number; @@ -302,7 +331,9 @@ declare namespace buffer { * @since 9 * @syscap SystemCapability.Utils.Lang * @param [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 - * @return Return a signed, big-endian 64-bit integer + * @returns Return a signed, big-endian 64-bit integer + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] */ readBigInt64BE(offset?: number): bigint; @@ -311,7 +342,9 @@ declare namespace buffer { * @since 9 * @syscap SystemCapability.Utils.Lang * @param [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 - * @return Return a signed, little-endian 64-bit integer + * @returns Return a signed, little-endian 64-bit integer + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] */ readBigInt64LE(offset?: number): bigint; @@ -320,7 +353,9 @@ declare namespace buffer { * @since 9 * @syscap SystemCapability.Utils.Lang * @param [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 - * @return Return a unsigned, big-endian 64-bit integer + * @returns Return a unsigned, big-endian 64-bit integer + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] */ readBigUInt64BE(offset?: number): bigint; @@ -329,7 +364,9 @@ declare namespace buffer { * @since 9 * @syscap SystemCapability.Utils.Lang * @param [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 - * @return Return a unsigned, little-endian 64-bit integer + * @returns Return a unsigned, little-endian 64-bit integer + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] */ readBigUInt64LE(offset?: number): bigint; @@ -338,7 +375,9 @@ declare namespace buffer { * @since 9 * @syscap SystemCapability.Utils.Lang * @param [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 - * @return Return a 64-bit, big-endian double + * @returns Return a 64-bit, big-endian double + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] */ readDoubleBE(offset?: number): number; @@ -347,7 +386,9 @@ declare namespace buffer { * @since 9 * @syscap SystemCapability.Utils.Lang * @param [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 8 - * @return Return a 64-bit, little-endian double + * @returns Return a 64-bit, little-endian double + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] */ readDoubleLE(offset?: number): number; @@ -356,7 +397,9 @@ declare namespace buffer { * @since 9 * @syscap SystemCapability.Utils.Lang * @param [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 4 - * @return Return a 32-bit, big-endian float + * @returns Return a 32-bit, big-endian float + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] */ readFloatBE(offset?: number): number; @@ -365,7 +408,9 @@ declare namespace buffer { * @since 9 * @syscap SystemCapability.Utils.Lang * @param [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 4 - * @return Return a 32-bit, little-endian float + * @returns Return a 32-bit, little-endian float + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] */ readFloatLE(offset?: number): number; @@ -374,7 +419,9 @@ declare namespace buffer { * @since 9 * @syscap SystemCapability.Utils.Lang * @param [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 1 - * @return Return a signed 8-bit integer + * @returns Return a signed 8-bit integer + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 1. Received value is: [offset] */ readInt8(offset?: number): number; @@ -383,7 +430,9 @@ declare namespace buffer { * @since 9 * @syscap SystemCapability.Utils.Lang * @param [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 2 - * @return Return a signed, big-endian 16-bit integer + * @returns Return a signed, big-endian 16-bit integer + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 2. Received value is: [offset] */ readInt16BE(offset?: number): number; @@ -392,7 +441,9 @@ declare namespace buffer { * @since 9 * @syscap SystemCapability.Utils.Lang * @param [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 2 - * @return Return a signed, little-endian 16-bit integer + * @returns Return a signed, little-endian 16-bit integer + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 2. Received value is: [offset] */ readInt16LE(offset?: number): number; @@ -401,7 +452,9 @@ declare namespace buffer { * @since 9 * @syscap SystemCapability.Utils.Lang * @param [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 4 - * @return Return a signed, big-endian 32-bit integer + * @returns Return a signed, big-endian 32-bit integer + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] */ readInt32BE(offset?: number): number; @@ -410,7 +463,9 @@ declare namespace buffer { * @since 9 * @syscap SystemCapability.Utils.Lang * @param [offset = 0] Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - 4 - * @return Return a signed, little-endian 32-bit integer + * @returns Return a signed, little-endian 32-bit integer + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] */ readInt32LE(offset?: number): number; @@ -421,7 +476,9 @@ declare namespace buffer { * @syscap SystemCapability.Utils.Lang * @param offset Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - byteLength * @param byteLength Number of bytes to read. Must satisfy 0 < byteLength <= 6 - * @return + * @returns + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] */ readIntBE(offset: number, byteLength: number): number; @@ -432,7 +489,9 @@ declare namespace buffer { * @syscap SystemCapability.Utils.Lang * @param offset Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - byteLength * @param byteLength Number of bytes to read. Must satisfy 0 < byteLength <= 6 - * @return + * @returns + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] */ readIntLE(offset: number, byteLength: number): number; @@ -441,7 +500,9 @@ declare namespace buffer { * @since 9 * @syscap SystemCapability.Utils.Lang * @param [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 1 - * @return Reads an unsigned 8-bit integer + * @returns Reads an unsigned 8-bit integer + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 1. Received value is: [offset] */ readUInt8(offset?: number): number; @@ -450,7 +511,9 @@ declare namespace buffer { * @since 9 * @syscap SystemCapability.Utils.Lang * @param [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 2 - * @return Reads an unsigned, big-endian 16-bit integer + * @returns Reads an unsigned, big-endian 16-bit integer + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 2. Received value is: [offset] */ readUInt16BE(offset?: number): number; @@ -459,7 +522,9 @@ declare namespace buffer { * @since 9 * @syscap SystemCapability.Utils.Lang * @param [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 2 - * @return Reads an unsigned, little-endian 16-bit integer + * @returns Reads an unsigned, little-endian 16-bit integer + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 2. Received value is: [offset] */ readUInt16LE(offset?: number): number; @@ -468,7 +533,9 @@ declare namespace buffer { * @since 9 * @syscap SystemCapability.Utils.Lang * @param [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 4 - * @return Reads an unsigned, big-endian 32-bit integer + * @returns Reads an unsigned, big-endian 32-bit integer + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] */ readUInt32BE(offset?: number): number; @@ -477,7 +544,9 @@ declare namespace buffer { * @since 9 * @syscap SystemCapability.Utils.Lang * @param [offset = 0] Number of bytes to skip before starting to read. Must satisfy 0 <= offset <= buf.length - 4 - * @return Reads an unsigned, little-endian 32-bit integer + * @returns Reads an unsigned, little-endian 32-bit integer + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] */ readUInt32LE(offset?: number): number; @@ -488,7 +557,9 @@ declare namespace buffer { * @syscap SystemCapability.Utils.Lang * @param offset Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - byteLength * @param byteLength Number of bytes to read. Must satisfy 0 < byteLength <= 6 - * @return + * @returns + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] */ readUIntBE(offset: number, byteLength: number): number; @@ -499,7 +570,9 @@ declare namespace buffer { * @syscap SystemCapability.Utils.Lang * @param offset Number of bytes to skip before starting to read. Must satisfy: 0 <= offset <= buf.length - byteLength * @param byteLength Number of bytes to read. Must satisfy 0 < byteLength <= 6 - * @return + * @returns + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] */ readUIntLE(offset: number, byteLength: number): number; @@ -509,7 +582,7 @@ declare namespace buffer { * @syscap SystemCapability.Utils.Lang * @param [start = 0] Where the new Buffer will start * @param [end = buf.length] Where the new Buffer will end (not inclusive) - * @return Returns a new Buffer that references the same memory as the original + * @returns Returns a new Buffer that references the same memory as the original */ subarray(start?: number, end?: number): Buffer; @@ -517,7 +590,8 @@ declare namespace buffer { * Interprets buf as an array of unsigned 16-bit integers and swaps the byte order in-place. * @since 9 * @syscap SystemCapability.Utils.Lang - * @return A reference to buf + * @returns A reference to buf + * @throws {BusinessError} 10200009 - Buffer size must be a multiple of 16-bits */ swap16(): Buffer; @@ -525,7 +599,8 @@ declare namespace buffer { * Interprets buf as an array of unsigned 32-bit integers and swaps the byte order in-place. * @since 9 * @syscap SystemCapability.Utils.Lang - * @return A reference to buf + * @returns A reference to buf + * @throws {BusinessError} 10200009 - Buffer size must be a multiple of 32-bits */ swap32(): Buffer; @@ -533,7 +608,8 @@ declare namespace buffer { * Interprets buf as an array of unsigned 64-bit integers and swaps the byte order in-place. * @since 9 * @syscap SystemCapability.Utils.Lang - * @return A reference to buf + * @returns A reference to buf + * @throws {BusinessError} 10200009 - Buffer size must be a multiple of 64-bits */ swap64(): Buffer; @@ -541,7 +617,7 @@ declare namespace buffer { * Returns a JSON representation of buf * @since 9 * @syscap SystemCapability.Utils.Lang - * @return Returns a JSON + * @returns Returns a JSON */ toJSON(): Object; @@ -552,6 +628,7 @@ declare namespace buffer { * @param [encoding='utf8'] The character encoding to use * @param [start = 0] The byte offset to start decoding at * @param [end = buf.length] The byte offset to stop decoding at (not inclusive) + * @throws {BusinessError} 401 - if the input parameters are invalid. */ toString(encoding?: string, start?: number, end?: number): string; @@ -563,7 +640,9 @@ declare namespace buffer { * @param [offset = 0] Number of bytes to skip before starting to write string * @param [length = buf.length - offset] Maximum number of bytes to write (written bytes will not exceed buf.length - offset) * @param [encoding='utf8'] The character encoding of string. - * @return Number of bytes written. + * @returns Number of bytes written. + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "[offset/length]" is out of range. It must be >= 0 and <= buf.length. Received value is: [offset/length] */ write(str: string, offset?: number, length?: number, encoding?: string): number; @@ -573,7 +652,9 @@ declare namespace buffer { * @syscap SystemCapability.Utils.Lang * @param value Number to be written to buf * @param [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 - * @return offset plus the number of bytes written + * @returns offset plus the number of bytes written + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] */ writeBigInt64BE(value: bigint, offset?: number): number; @@ -583,7 +664,9 @@ declare namespace buffer { * @syscap SystemCapability.Utils.Lang * @param value Number to be written to buf * @param [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 - * @return offset plus the number of bytes written + * @returns offset plus the number of bytes written + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] */ writeBigInt64LE(value: bigint, offset?: number): number; @@ -593,7 +676,9 @@ declare namespace buffer { * @syscap SystemCapability.Utils.Lang * @param value Number to be written to buf * @param [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 - * @return offset plus the number of bytes written + * @returns offset plus the number of bytes written + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] */ writeBigUInt64BE(value: bigint, offset?: number): number; @@ -603,7 +688,9 @@ declare namespace buffer { * @syscap SystemCapability.Utils.Lang * @param value Number to be written to buf * @param [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 - * @return offset plus the number of bytes written + * @returns offset plus the number of bytes written + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] */ writeBigUInt64LE(value: bigint, offset?: number): number; @@ -613,7 +700,9 @@ declare namespace buffer { * @syscap SystemCapability.Utils.Lang * @param value Number to be written to buf * @param [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 - * @return offset plus the number of bytes written + * @returns offset plus the number of bytes written + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] */ writeDoubleBE(value: number, offset?: number): number; @@ -623,7 +712,9 @@ declare namespace buffer { * @syscap SystemCapability.Utils.Lang * @param value Number to be written to buf * @param [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 - * @return offset plus the number of bytes written + * @returns offset plus the number of bytes written + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 8. Received value is: [offset] */ writeDoubleLE(value: number, offset?: number): number; @@ -633,7 +724,9 @@ declare namespace buffer { * @syscap SystemCapability.Utils.Lang * @param value Number to be written to buf * @param [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 4 - * @return offset plus the number of bytes written + * @returns offset plus the number of bytes written + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] */ writeFloatBE(value: number, offset?: number): number; @@ -643,7 +736,9 @@ declare namespace buffer { * @syscap SystemCapability.Utils.Lang * @param value Number to be written to buf * @param [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 4 - * @return offset plus the number of bytes written + * @returns offset plus the number of bytes written + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "offset" is out of range. It must be >= 0 and <= buf.length - 4. Received value is: [offset] */ writeFloatLE(value: number, offset?: number): number; @@ -652,8 +747,10 @@ declare namespace buffer { * @since 9 * @syscap SystemCapability.Utils.Lang * @param value Number to be written to buf - * @param [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 8 - * @return offset plus the number of bytes written + * @param [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 1 + * @returns offset plus the number of bytes written + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] */ writeInt8(value: number, offset?: number): number; @@ -663,7 +760,9 @@ declare namespace buffer { * @syscap SystemCapability.Utils.Lang * @param value Number to be written to buf * @param [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 2 - * @return offset plus the number of bytes written + * @returns offset plus the number of bytes written + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] */ writeInt16BE(value: number, offset?: number): number; @@ -673,7 +772,9 @@ declare namespace buffer { * @syscap SystemCapability.Utils.Lang * @param value Number to be written to buf * @param [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 2 - * @return offset plus the number of bytes written + * @returns offset plus the number of bytes written + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] */ writeInt16LE(value: number, offset?: number): number; @@ -683,7 +784,9 @@ declare namespace buffer { * @syscap SystemCapability.Utils.Lang * @param value Number to be written to buf * @param [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 4 - * @return offset plus the number of bytes written + * @returns offset plus the number of bytes written + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] */ writeInt32BE(value: number, offset?: number): number; @@ -693,7 +796,9 @@ declare namespace buffer { * @syscap SystemCapability.Utils.Lang * @param value Number to be written to buf * @param [offset = 0] Number of bytes to skip before starting to write. Must satisfy: 0 <= offset <= buf.length - 4 - * @return offset plus the number of bytes written + * @returns offset plus the number of bytes written + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] */ writeInt32LE(value: number, offset?: number): number; @@ -704,7 +809,9 @@ declare namespace buffer { * @param value Number to be written to buf * @param offset Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength * @param byteLength Number of bytes to write. Must satisfy 0 < byteLength <= 6 - * @return offset plus the number of bytes written + * @returns offset plus the number of bytes written + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] */ writeIntBE(value: number, offset: number, byteLength: number): number; @@ -715,7 +822,9 @@ declare namespace buffer { * @param value Number to be written to buf * @param offset Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength * @param byteLength Number of bytes to write. Must satisfy 0 < byteLength <= 6 - * @return offset plus the number of bytes written + * @returns offset plus the number of bytes written + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] */ writeIntLE(value : number, offset: number, byteLength: number): number; @@ -725,7 +834,9 @@ declare namespace buffer { * @syscap SystemCapability.Utils.Lang * @param value Number to be written to buf * @param [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 1 - * @return offset plus the number of bytes written + * @returns offset plus the number of bytes written + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] */ writeUInt8(value: number, offset?: number): number; @@ -735,7 +846,9 @@ declare namespace buffer { * @syscap SystemCapability.Utils.Lang * @param value Number to be written to buf * @param [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 2 - * @return offset plus the number of bytes written + * @returns offset plus the number of bytes written + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] */ writeUInt16BE(value: number, offset?: number): number; @@ -745,7 +858,9 @@ declare namespace buffer { * @syscap SystemCapability.Utils.Lang * @param value Number to be written to buf * @param [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 2 - * @return offset plus the number of bytes written + * @returns offset plus the number of bytes written + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] */ writeUInt16LE(value: number, offset?: number): number; @@ -755,7 +870,9 @@ declare namespace buffer { * @syscap SystemCapability.Utils.Lang * @param value Number to be written to buf * @param [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 4 - * @return offset plus the number of bytes written + * @returns offset plus the number of bytes written + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] */ writeUInt32BE(value: number, offset?: number): number; @@ -765,7 +882,9 @@ declare namespace buffer { * @syscap SystemCapability.Utils.Lang * @param value Number to be written to buf * @param [offset = 0] Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - 4 - * @return offset plus the number of bytes written + * @returns offset plus the number of bytes written + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] */ writeUInt32LE(value: number, offset?: number): number; @@ -776,7 +895,9 @@ declare namespace buffer { * @param value Number to be written to buf * @param offset Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength * @param byteLength Number of bytes to write. Must satisfy 0 < byteLength <= 6 - * @return offset plus the number of bytes written + * @returns offset plus the number of bytes written + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] */ writeUIntBE(value: number, offset: number, byteLength: number): number; @@ -787,7 +908,9 @@ declare namespace buffer { * @param value Number to be written to buf * @param offset Number of bytes to skip before starting to write. Must satisfy 0 <= offset <= buf.length - byteLength * @param byteLength Number of bytes to write. Must satisfy 0 < byteLength <= 6 - * @return offset plus the number of bytes written + * @returns offset plus the number of bytes written + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200001 - The value of "[param]" is out of range. It must be >= [left range] and <= [right range]. Received value is: [param] */ writeUIntLE(value: number, offset: number, byteLength: number): number; @@ -803,6 +926,7 @@ declare namespace buffer { * @param options {endings: string, type: string} * endings: One of either 'transparent' or 'native'. * type: The Blob content-type + * @throws {BusinessError} 401 - if the input parameters are invalid. */ constructor(sources: string[] | ArrayBuffer[] | TypedArray[] | DataView[] | Blob[] , options?: Object); diff --git a/api/@ohos.bundle.appControl.d.ts b/api/@ohos.bundle.appControl.d.ts index 0f9de6b9fb14da9eef3bc40e8fd934153764207a..d780a5e477cbe6e2bf80ebe2c5f72fcf3533c24b 100644 --- a/api/@ohos.bundle.appControl.d.ts +++ b/api/@ohos.bundle.appControl.d.ts @@ -14,7 +14,7 @@ */ import { AsyncCallback } from './basic'; -import Want from './@ohos.application.Want'; +import Want from './@ohos.app.ability.Want'; /** * Used for application interception control @@ -32,8 +32,8 @@ declare namespace appControl { * @param { AsyncCallback } callback - The callback of setting the disposed status result. * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 401 - The parameter check failed. - * @throws { BusinessError } 801 - Capicity not supported. - * @throws { BusinessError } 17700005 - The specified appId was not found. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 17700005 - The specified app ID is not found. * @syscap SystemCapability.BundleManager.BundleFramework.AppControl * @systemapi * @since 9 @@ -48,8 +48,8 @@ declare namespace appControl { * @returns { Promise } The result of setting the disposed status of a specified bundle. * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 401 - The parameter check failed. - * @throws { BusinessError } 801 - Capicity not supported. - * @throws { BusinessError } 17700005 - The specified appId was not found. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 17700005 - The specified app ID is not found. * @syscap SystemCapability.BundleManager.BundleFramework.AppControl * @systemapi * @since 9 @@ -63,8 +63,8 @@ declare namespace appControl { * @param { AsyncCallback } callback - The callback of getting the disposed status of a specified bundle result. * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 401 - The parameter check failed. - * @throws { BusinessError } 801 - Capicity not supported. - * @throws { BusinessError } 17700005 - The specified appId was not found. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 17700005 - The specified app ID is not found. * @syscap SystemCapability.BundleManager.BundleFramework.AppControl * @systemapi * @since 9 @@ -78,8 +78,8 @@ declare namespace appControl { * @returns { Promise } Returns the disposed status of a specified bundle. * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 401 - The parameter check failed. - * @throws { BusinessError } 801 - Capicity not supported. - * @throws { BusinessError } 17700005 - The specified appId was not found. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 17700005 - The specified app ID is not found. * @syscap SystemCapability.BundleManager.BundleFramework.AppControl * @systemapi * @since 9 @@ -93,8 +93,8 @@ declare namespace appControl { * @param { AsyncCallback } callback - the callback of deleting the disposed status of a specified bundle result. * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 401 - The parameter check failed. - * @throws { BusinessError } 801 - Capicity not supported. - * @throws { BusinessError } 17700005 - The specified appId was not found. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 17700005 - The specified app ID is not found. * @syscap SystemCapability.BundleManager.BundleFramework.AppControl * @systemapi * @since 9 @@ -108,8 +108,8 @@ declare namespace appControl { * @returns { Promise } Returns the result of deleting the disposed status of a specified bundle. * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 401 - The parameter check failed. - * @throws { BusinessError } 801 - Capicity not supported. - * @throws { BusinessError } 17700005 - The specified appId was not found. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 17700005 - The specified app ID is not found. * @syscap SystemCapability.BundleManager.BundleFramework.AppControl * @systemapi * @since 9 diff --git a/api/@ohos.bundle.bundleManager.d.ts b/api/@ohos.bundle.bundleManager.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..dc16be6f29e6ec87a52c4f956b8fe7f6bc2094e5 --- /dev/null +++ b/api/@ohos.bundle.bundleManager.d.ts @@ -0,0 +1,1344 @@ +/* + * 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 as _ApplicationInfo } from './bundleManager/applicationInfo'; +import { Metadata as _Metadata } from './bundleManager/metadata'; +import { HapModuleInfo as _HapModuleInfo } from './bundleManager/hapModuleInfo'; +import { PermissionDef as _PermissionDef } from './bundleManager/permissionDef'; +import { ElementName as _ElementName } from './bundleManager/elementName'; +import Want from './@ohos.app.ability.Want'; +import image from './@ohos.multimedia.image'; +import * as _AbilityInfo from './bundleManager/abilityInfo'; +import * as _BundleInfo from './bundleManager/bundleInfo'; +import * as _ExtensionAbilityInfo from './bundleManager/extensionAbilityInfo'; + +/** + * This module is used to obtain package information of various applications installed on the current device. + * @namespace bundleManager + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + declare namespace bundleManager { + /** + * Used to query the enumeration value of bundleInfo. Multiple values can be passed in the form. + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + enum BundleFlag { + /** + * Used to obtain the default bundleInfo. The obtained bundleInfo does not contain information of + * signatureInfo, applicationInfo, hapModuleInfo, ability, extensionAbility and permission. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_BUNDLE_INFO_DEFAULT = 0x00000000, + /** + * Used to obtain the bundleInfo containing applicationInfo. The obtained bundleInfo does not + * contain the information of signatureInfo, hapModuleInfo, ability, extensionAbility and permission. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_BUNDLE_INFO_WITH_APPLICATION = 0x00000001, + /** + * Used to obtain the bundleInfo containing hapModuleInfo. The obtained bundleInfo does not + * contain the information of signatureInfo, applicationInfo, ability, extensionAbility and permission. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_BUNDLE_INFO_WITH_HAP_MODULE = 0x00000002, + /** + * Used to obtain the bundleInfo containing ability. The obtained bundleInfo does not + * contain the information of signatureInfo, applicationInfo, extensionAbility and permission. + * It can't be used alone, it needs to be used with GET_BUNDLE_INFO_WITH_HAP_MODULE. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_BUNDLE_INFO_WITH_ABILITY = 0x00000004, + /** + * Used to obtain the bundleInfo containing extensionAbility. The obtained bundleInfo does not + * contain the information of signatureInfo, applicationInfo, ability and permission. + * It can't be used alone, it needs to be used with GET_BUNDLE_INFO_WITH_HAP_MODULE. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY = 0x00000008, + /** + * Used to obtain the bundleInfo containing permission. The obtained bundleInfo does not + * contain the information of signatureInfo, applicationInfo, hapModuleInfo, extensionAbility and ability. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION = 0x00000010, + /** + * Used to obtain the metadata contained in applicationInfo, moduleInfo and abilityInfo. + * It can't be used alone, it needs to be used with GET_BUNDLE_INFO_WITH_APPLICATION, + * GET_BUNDLE_INFO_WITH_HAP_MODULE, GET_BUNDLE_INFO_WITH_ABILITIES, GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_BUNDLE_INFO_WITH_METADATA = 0x00000020, + /** + * Used to obtain the default bundleInfo containing disabled application and ability. + * The obtained bundleInfo does not contain information of signatureInfo, applicationInfo, + * hapModuleInfo, ability, extensionAbility and permission. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_BUNDLE_INFO_WITH_DISABLE = 0x00000040, + /** + * Used to obtain the bundleInfo containing signatureInfo. The obtained bundleInfo does not + * contain the information of applicationInfo, hapModuleInfo, extensionAbility, ability and permission. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_BUNDLE_INFO_WITH_SIGNATURE_INFO = 0x00000080, + } + + /** + * Used to query the enumeration value of applicationInfo. Multiple values can be passed in the form. + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + enum ApplicationFlag { + /** + * Used to obtain the default applicationInfo. The obtained applicationInfo does not contain the information of + * permission and metadata. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_APPLICATION_INFO_DEFAULT = 0x00000000, + /** + * Used to obtain the applicationInfo containing permission. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_APPLICATION_INFO_WITH_PERMISSION = 0x00000001, + /** + * Used to obtain the applicationInfo containing metadata. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_APPLICATION_INFO_WITH_METADATA = 0x00000002, + /** + * Used to obtain the applicationInfo containing disabled application. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_APPLICATION_INFO_WITH_DISABLE = 0x00000004, + } + +/** + * Used to query the enumeration value of abilityInfo. Multiple values can be passed in the form. + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + enum AbilityFlag { + /** + * Used to obtain the default abilityInfo. The obtained abilityInfo does not contain the information of + * permission, metadata and disabled abilityInfo. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_ABILITY_INFO_DEFAULT = 0x00000000, + /** + * Used to obtain the abilityInfo containing permission. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_ABILITY_INFO_WITH_PERMISSION = 0x00000001, + /** + * Used to obtain the abilityInfo containing applicationInfo. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_ABILITY_INFO_WITH_APPLICATION = 0x00000002, + /** + * Used to obtain the abilityInfo containing metadata. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_ABILITY_INFO_WITH_METADATA = 0x00000004, + /** + * Used to obtain the abilityInfo containing disabled abilityInfo. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_ABILITY_INFO_WITH_DISABLE = 0x00000008, + /** + * Used to obtain the abilityInfo only for system app. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_ABILITY_INFO_ONLY_SYSTEM_APP = 0x00000010, + } + + /** + * Used to query the enumeration value of ExtensionAbilityInfo. Multiple values can be passed in the form. + * @enum { number } + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + enum ExtensionAbilityFlag { + /** + * Used to obtain the default extensionAbilityInfo. The obtained extensionAbilityInfo does not contain the information of + * permission, metadata and disabled abilityInfo. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_EXTENSION_ABILITY_INFO_DEFAULT = 0x00000000, + /** + * Used to obtain the extensionAbilityInfo containing permission. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_EXTENSION_ABILITY_INFO_WITH_PERMISSION = 0x00000001, + /** + * Used to obtain the extensionAbilityInfo containing applicationInfo. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_EXTENSION_ABILITY_INFO_WITH_APPLICATION = 0x00000002, + /** + * Used to obtain the extensionAbilityInfo containing metadata. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + GET_EXTENSION_ABILITY_INFO_WITH_METADATA = 0x00000004, + } + + /** + * This enumeration value is used to identify various types of extension ability + * @enum {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + export enum ExtensionAbilityType { + /** + * Indicates extension info with type of form + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + FORM = 0, + + /** + * Indicates extension info with type of work schedule + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + WORK_SCHEDULER = 1, + + /** + * Indicates extension info with type of input method + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + INPUT_METHOD = 2, + + /** + * Indicates extension info with type of service + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + SERVICE = 3, + + /** + * Indicates extension info with type of accessibility + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + ACCESSIBILITY = 4, + + /** + * Indicates extension info with type of dataShare + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + DATA_SHARE = 5, + + /** + * Indicates extension info with type of filesShare + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + FILE_SHARE = 6, + + /** + * Indicates extension info with type of staticSubscriber + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + STATIC_SUBSCRIBER = 7, + + /** + * Indicates extension info with type of wallpaper + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + WALLPAPER = 8, + + /** + * Indicates extension info with type of backup + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + BACKUP = 9, + + /** + * Indicates extension info with type of window + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + WINDOW = 10, + + /** + * Indicates extension info with type of enterprise admin + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + ENTERPRISE_ADMIN = 11, + + /** + * Indicates extension info with type of thumbnail + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + THUMBNAIL = 13, + + /** + * Indicates extension info with type of preview + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + PREVIEW = 14, + + /** + * Indicates extension info with type of unspecified + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + UNSPECIFIED = 255, + } + + /** + * PermissionGrantState + * @enum {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + export enum PermissionGrantState { + /** + * PERMISSION_DENIED + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + PERMISSION_DENIED = -1, + + /** + * PERMISSION_GRANTED + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + PERMISSION_GRANTED = 0, + } + + /** + * Support window mode + * @enum {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + export enum SupportWindowMode { + /** + * Indicates supported window mode of full screen mode + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + FULL_SCREEN = 0, + /** + * Indicates supported window mode of split mode + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + SPLIT = 1, + /** + * Indicates supported window mode of floating mode + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + FLOATING = 2, + } + + /** + * Launch type + * @enum {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + export enum LaunchType { + /** + * Indicates that the ability has only one instance + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + SINGLETON = 0, + + /** + * Indicates that the ability can have multiple instances + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + STANDARD = 1, + + /** + * Indicates that the ability can have specified instances + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + SPECIFIED = 2, + } + + /** + * Indicates ability type + * @enum {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @FAModelOnly + * @since 9 + */ + export enum AbilityType { + /** + * Indicates that the ability has a UI + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + PAGE = 1, + + /** + * Indicates that the ability does not have a UI + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + SERVICE = 2, + + /** + * Indicates that the ability is used to provide data access services + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + DATA = 3, + } + + /** + * Display orientation + * @enum {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + export enum DisplayOrientation { + /** + * Indicates that the system automatically determines the display orientation + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + UNSPECIFIED, + + /** + * Indicates the landscape orientation + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + LANDSCAPE, + + /** + * Indicates the portrait orientation + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + PORTRAIT, + + /** + * Indicates the page ability orientation is the same as that of the nearest ability in the stack + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + FOLLOW_RECENT, + + /** + * Indicates the inverted landscape orientation + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + LANDSCAPE_INVERTED, + + /** + * Indicates the inverted portrait orientation + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + PORTRAIT_INVERTED, + + /** + * Indicates the orientation can be auto-rotated + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + AUTO_ROTATION, + + /** + * Indicates the landscape orientation rotated with sensor + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + AUTO_ROTATION_LANDSCAPE, + + /** + * Indicates the portrait orientation rotated with sensor + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + AUTO_ROTATION_PORTRAIT, + + /** + * Indicates the sensor restricted mode + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + AUTO_ROTATION_RESTRICTED, + + /** + * Indicates the sensor landscape restricted mode + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + AUTO_ROTATION_LANDSCAPE_RESTRICTED, + + /** + * Indicates the sensor portrait restricted mode + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + AUTO_ROTATION_PORTRAIT_RESTRICTED, + + /** + * Indicates the locked orientation mode + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + LOCKED, + } + + /** + * Obtains own bundleInfo. + * @param { number } bundleFlags - Indicates the flag used to specify information contained in the BundleInfo objects that will be returned. + * @returns { Promise } The result of getting the bundle info. + * @throws { BusinessError } 401 - The parameter check failed. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + function getBundleInfoForSelf(bundleFlags: number): Promise; + + /** + * Obtains own bundleInfo. + * @param { number } bundleFlags - Indicates the flag used to specify information contained in the BundleInfo objects that will be returned. + * @param { AsyncCallback } callback - The callback of getting bundle info result. + * @throws { BusinessError } 401 - The parameter check failed. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + function getBundleInfoForSelf(bundleFlags: number, callback: AsyncCallback): void; + + /** + * Obtains bundleInfo based on bundleName, bundleFlags and options. ohos.permission.GET_BUNDLE_INFO_PRIVILEGED is required for cross user access. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { string } bundleName - Indicates the application bundle name to be queried. + * @param { number } bundleFlags - Indicates the flag used to specify information contained in the BundleInfo objects that will be returned. + * @param { number } userId - Indicates the user ID or do not pass user ID. + * @param { AsyncCallback } callback - The callback of getting bundle info result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 17700001 - The specified bundleName is not found. + * @throws { BusinessError } 17700004 - The specified user ID is not found. + * @throws { BusinessError } 17700026 - The specified bundle is disabled. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getBundleInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback): void; + function getBundleInfo(bundleName: string, bundleFlags: number, userId: number, callback: AsyncCallback): void; + + /** + * Obtains bundleInfo based on bundleName, bundleFlags and options. ohos.permission.GET_BUNDLE_INFO_PRIVILEGED is required for cross user access. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { string } bundleName - Indicates the application bundle name to be queried. + * @param { number } bundleFlags - Indicates the flag used to specify information contained in the BundleInfo objects that will be returned. + * @param { number } userId - Indicates the user ID or do not pass user ID. + * @returns { Promise } The result of getting the bundle info. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 17700001 - The specified bundleName is not found. + * @throws { BusinessError } 17700004 - The specified user ID is not found. + * @throws { BusinessError } 17700026 - The specified bundle is disabled. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getBundleInfo(bundleName: string, bundleFlags: number, userId?: number): Promise; + + /** + * Obtains application info based on a given bundle name. ohos.permission.GET_BUNDLE_INFO_PRIVILEGED is required for cross user access. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { string } bundleName - Indicates the application bundle name to be queried. + * @param { number } appFlags - Indicates the flag used to specify information contained in the ApplicationInfo objects that will be returned. + * @param { number } userId - Indicates the user ID or do not pass user ID. + * @param { AsyncCallback } callback - The callback of getting application info result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 17700001 - The specified bundleName is not found. + * @throws { BusinessError } 17700004 - The specified user ID is not found. + * @throws { BusinessError } 17700026 - The specified bundle is disabled. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getApplicationInfo(bundleName: string, appFlags: number, callback: AsyncCallback): void; + function getApplicationInfo(bundleName: string, appFlags: number, userId: number, callback: AsyncCallback): void; + + /** + * Obtains application info based on a given bundle name. ohos.permission.GET_BUNDLE_INFO_PRIVILEGED is required for cross user access. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { string } bundleName - Indicates the application bundle name to be queried. + * @param { number } appFlags - Indicates the flag used to specify information contained in the ApplicationInfo objects that will be returned. + * @param { number } userId - Indicates the user ID or do not pass user ID. + * @returns { Promise } The result of getting the application info. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 17700001 - The specified bundleName is not found. + * @throws { BusinessError } 17700004 - The specified user ID is not found. + * @throws { BusinessError } 17700026 - The specified bundle is disabled. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getApplicationInfo(bundleName: string, appFlags: number, userId?: number): Promise; + + /** + * Obtains BundleInfo of all bundles available in the system. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { number } bundleFlags - Indicates the flag used to specify information contained in the BundleInfo that will be returned. + * @param { number } userId - Indicates the user id. + * @param { AsyncCallback } callback - The callback of getting a list of BundleInfo objects. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 17700004 - The specified user ID is not found. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getAllBundleInfo(bundleFlags: number, callback: AsyncCallback>): void; + function getAllBundleInfo(bundleFlags: number, userId: number, callback: AsyncCallback>): void; + + /** + * Obtains BundleInfo of all bundles available in the system. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { number } bundleFlags - Indicates the flag used to specify information contained in the BundleInfo that will be returned. + * @param { number } userId - Indicates the user id. + * @returns { Promise> } Returns a list of BundleInfo objects. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 17700004 - The specified user ID is not found. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getAllBundleInfo(bundleFlags: number, userId?: number): Promise>; + + /** + * Obtains information about all installed applications of a specified user. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { number } appFlags - Indicates the flag used to specify information contained in the ApplicationInfo objects that will be returned. + * @param { number } userId - Indicates the user ID or do not pass user ID. + * @param { AsyncCallback } callback - The callback of getting a list of ApplicationInfo objects. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 17700004 - The specified user ID is not found. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getAllApplicationInfo(appFlags: number, callback: AsyncCallback>): void; + function getAllApplicationInfo(appFlags: number, userId: number, callback: AsyncCallback>): void; + + /** + * Obtains information about all installed applications of a specified user. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { number } appFlags - Indicates the flag used to specify information contained in the ApplicationInfo objects that will be returned. + * @param { number } userId - Indicates the user ID or do not pass user ID. + * @returns { Promise> } Returns a list of ApplicationInfo objects. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 17700004 - The specified user ID is not found. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getAllApplicationInfo(appFlags: number, userId?: number): Promise>; + + /** + * Query the AbilityInfo by the given Want. ohos.permission.GET_BUNDLE_INFO_PRIVILEGED is required for cross user access. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { Want } want - Indicates the Want containing the application bundle name to be queried. + * @param { number } abilityFlags - Indicates the flag used to specify information contained in the AbilityInfo objects that will be returned. + * @param { number } userId - userId Indicates the user ID. + * @param { AsyncCallback> } callback - The callback of querying ability info result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 17700001 - The specified bundleName is not found. + * @throws { BusinessError } 17700003 - The specified ability is not found. + * @throws { BusinessError } 17700004 - The specified userId is invalid. + * @throws { BusinessError } 17700026 - The specified bundle is disabled. + * @throws { BusinessError } 17700029 - The specified ability is disabled. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function queryAbilityInfo(want: Want, abilityFlags: number, callback: AsyncCallback>): void; + function queryAbilityInfo(want: Want, abilityFlags: number, userId: number, callback: AsyncCallback>): void; + + /** + * Query the AbilityInfo by the given Want. ohos.permission.GET_BUNDLE_INFO_PRIVILEGED is required for cross user access. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { Want } want - Indicates the Want containing the application bundle name to be queried. + * @param { number } abilityFlags - Indicates the flag used to specify information contained in the AbilityInfo objects that will be returned. + * @param { number } userId - userId Indicates the user ID. + * @returns { Promise> } Returns a list of AbilityInfo objects. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 17700001 - The specified bundleName is not found. + * @throws { BusinessError } 17700003 - The specified extensionAbility is not found. + * @throws { BusinessError } 17700004 - The specified userId is invalid. + * @throws { BusinessError } 17700026 - The specified bundle is disabled. + * @throws { BusinessError } 17700029 - The specified ability is disabled. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function queryAbilityInfo(want: Want, abilityFlags: number, userId?: number): Promise>; + + /** + * Query extension info of by utilizing a Want. ohos.permission.GET_BUNDLE_INFO_PRIVILEGED is required for cross user access. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { Want } want - Indicates the Want containing the application bundle name to be queried. + * @param { ExtensionAbilityType } extensionAbilityType - Indicates ExtensionAbilityType. + * @param { number } extensionAbilityFlags - Indicates the flag used to specify information contained in the ExtensionAbilityInfo objects that will be returned. + * @param { number } userId - Indicates the user ID. + * @param { AsyncCallback> } callback - The callback of querying extension ability info result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 17700001 - The specified bundleName is not found. + * @throws { BusinessError } 17700003 - The specified extensionAbility is not found. + * @throws { BusinessError } 17700004 - The specified userId is invalid. + * @throws { BusinessError } 17700026 - The specified bundle is disabled. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function queryExtensionAbilityInfo(want: Want, extensionAbilityType: ExtensionAbilityType, extensionAbilityFlags: number, callback: AsyncCallback>): void; + function queryExtensionAbilityInfo(want: Want, extensionAbilityType: ExtensionAbilityType, extensionAbilityFlags: number, userId: number, callback: AsyncCallback>): void; + + /** + * Query the ExtensionAbilityInfo by the given Want. ohos.permission.GET_BUNDLE_INFO_PRIVILEGED is required for cross user access. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { Want } want - Indicates the Want containing the application bundle name to be queried. + * @param { ExtensionAbilityType } extensionAbilityType - Indicates ExtensionAbilityType. + * @param { number } extensionAbilityFlags - Indicates the flag used to specify information contained in the ExtensionAbilityInfo objects that will be returned. + * @param { number } userId - Indicates the user ID. + * @returns { Promise> } Returns a list of ExtensionAbilityInfo objects. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 17700001 - The specified bundleName is not found. + * @throws { BusinessError } 17700003 - The specified extensionAbility is not found. + * @throws { BusinessError } 17700004 - The specified userId is invalid. + * @throws { BusinessError } 17700026 - The specified bundle is disabled. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function queryExtensionAbilityInfo(want: Want, extensionAbilityType: ExtensionAbilityType, extensionAbilityFlags: number, userId?: number): Promise>; + + /** + * Obtains bundle name by the given uid. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { number } uid - Indicates the UID of an application. + * @param { AsyncCallback } callback - The callback of getting bundle name. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 17700021 - The uid is not found. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getBundleNameByUid(uid: number, callback: AsyncCallback): void + + /** + * Obtains bundle name by the given uid. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { number } uid - Indicates the UID of an application. + * @returns { Promise } Returns the bundle name. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 17700021 - The uid is not found. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getBundleNameByUid(uid: number): Promise; + + /** + * Obtains information about an application bundle contained in an ohos Ability Package (HAP). + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { string } hapFilePath - Indicates the path storing the HAP. The path should be the relative path to the data directory of the current application. + * @param { number } bundleFlags - Indicates the flag used to specify information contained in the BundleInfo object to be returned. + * @param { AsyncCallback } callback - The callback of getting bundle archive info result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 17700022 - The hapFilePath is invalid. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getBundleArchiveInfo(hapFilePath: string, bundleFlags: number, callback: AsyncCallback): void + + /** + * Obtains information about an application bundle contained in an ohos Ability Package (HAP). + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { string } hapFilePath - Indicates the path storing the HAP. The path should be the relative path to the data directory of the current application. + * @param { number } bundleFlags - Indicates the flag used to specify information contained in the BundleInfo object to be returned. + * @returns { Promise } Returns the BundleInfo object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 17700022 - The hapFilePath is invalid. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getBundleArchiveInfo(hapFilePath: string, bundleFlags: number): Promise; + + /** + * Clears cache data of a specified application. + * @permission ohos.permission.REMOVE_CACHE_FILES + * @param { string } bundleName - Indicates the bundle name of the application whose cache data is to be cleaned. + * @param { AsyncCallback } callback - The callback of cleaning bundle cache files result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 17700001 - The specified bundleName is not found. + * @throws { BusinessError } 17700030 - The specified bundle does not support clearing of cache files. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function cleanBundleCacheFiles(bundleName: string, callback: AsyncCallback): void; + + /** + * Clears cache data of a specified application. + * @permission ohos.permission.REMOVE_CACHE_FILES + * @param { string } bundleName - Indicates the bundle name of the application whose cache data is to be cleaned. + * @returns { Promise } Clean bundle cache files result + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 17700001 - The specified bundleName is not found. + * @throws { BusinessError } 17700030 - The specified bundle does not support clearing of cache files. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function cleanBundleCacheFiles(bundleName: string): Promise; + + /** + * Sets whether to enable a specified application. + * @permission ohos.permission.CHANGE_ABILITY_ENABLED_STATE + * @param { string } bundleName - Indicates the bundle name of the application. + * @param { boolean } isEnabled - The value true means to enable it, and the value false means to disable it. + * @param { AsyncCallback } callback - The callback of setting app enabled result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 17700001 - The specified bundleName is not found. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function setApplicationEnabled(bundleName: string, isEnabled: boolean, callback: AsyncCallback): void; + + /** + * Sets whether to enable a specified application. + * @permission ohos.permission.CHANGE_ABILITY_ENABLED_STATE + * @param { string } bundleName - Indicates the bundle name of the application. + * @param { boolean } isEnabled - The value true means to enable it, and the value false means to disable it. + * @returns { Promise } set app enabled result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 17700001 - The specified bundleName is not found. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function setApplicationEnabled(bundleName: string, isEnabled: boolean): Promise; + + /** + * Sets whether to enable a specified ability. + * @permission ohos.permission.CHANGE_ABILITY_ENABLED_STATE + * @param { AbilityInfo } abilityInfo - Indicates information about the ability to set. + * @param { boolean } isEnabled - The value true means to enable it, and the value false means to disable it. + * @param { AsyncCallback } callback - The callback of setting ability enabled result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 17700001 - The specified bundleName is not found. + * @throws { BusinessError } 17700003 - The specified abilityInfo is not found. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function setAbilityEnabled(info: AbilityInfo, isEnabled: boolean, callback: AsyncCallback): void; + + /** + * Sets whether to enable a specified ability. + * @permission ohos.permission.CHANGE_ABILITY_ENABLED_STATE + * @param { AbilityInfo } abilityInfo - Indicates information about the ability to set. + * @param { boolean } isEnabled - The value true means to enable it, and the value false means to disable it. + * @returns { Promise } set ability enabled result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 17700001 - The specified bundleName is not found. + * @throws { BusinessError } 17700003 - The specified abilityInfo is not found. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function setAbilityEnabled(info: AbilityInfo, isEnabled: boolean): Promise; + + /** + * Checks whether a specified application is enabled. + * @param { string } bundleName - Indicates the bundle name of the application. + * @param { AsyncCallback } callback - The callback of checking application enabled result. The result is true if enabled, false otherwise. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 17700001 - The specified bundleName is not found. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function isApplicationEnabled(bundleName: string, callback: AsyncCallback): void; + + /** + * Checks whether a specified application is enabled. + * @param { string } bundleName - Indicates the bundle name of the application. + * @returns { Promise } Returns true if the application is enabled; returns false otherwise. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 17700001 - The specified bundleName is not found. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function isApplicationEnabled(bundleName: string): Promise; + + /** + * Checks whether a specified ability is enabled. + * @param { AbilityInfo } info - Indicates information about the ability to check. + * @param { AsyncCallback } callback - The callback of checking ability enabled result. The result is true if enabled, false otherwise. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 17700001 - The specified bundleName is not found. + * @throws { BusinessError } 17700003 - The specified abilityName is not found. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function isAbilityEnabled(info: AbilityInfo, callback: AsyncCallback): void; + + /** + * Checks whether a specified ability is enabled. + * @param { AbilityInfo } info - Indicates information about the ability to check. + * @returns { Promise } Returns true if the ability is enabled; returns false otherwise. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 17700001 - The specified bundleName is not found. + * @throws { BusinessError } 17700003 - The specified abilityName is not found. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function isAbilityEnabled(info: AbilityInfo): 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 + * #ACTION_HOME and #ENTITY_HOME Want filters set in the application's config.json or module.json file. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { string } bundleName - Indicates the bundle name of the application. + * @param { number } userId - Indicates the user ID or do not pass user ID. + * @param { AsyncCallback } callback - The callback for starting the application's main ability. + * @throws { BusinessError } 201 - Calling interface without permission 'ohos.permission.GET_BUNDLE_INFO_PRIVILEGED'. + * @throws { BusinessError } 401 - Input parameters check failed. + * @throws { BusinessError } 17700001 - The specified bundleName is not found. + * @throws { BusinessError } 17700004 - The specified user ID is not found. + * @throws { BusinessError } 17700026 - The specified bundle is disabled. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getLaunchWantForBundle(bundleName: string, userId: number, callback: AsyncCallback): void; + + /** + * 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 + * #ACTION_HOME and #ENTITY_HOME Want filters set in the application's config.json or module.json file. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { string } bundleName - Indicates the bundle name of the application. + * @param { AsyncCallback } callback - The callback for starting the application's main ability. + * @throws { BusinessError } 201 - Calling interface without permission 'ohos.permission.GET_BUNDLE_INFO_PRIVILEGED'. + * @throws { BusinessError } 401 - Input parameters check failed. + * @throws { BusinessError } 17700001 - The specified bundleName is not found. + * @throws { BusinessError } 17700004 - The specified user ID is not found. + * @throws { BusinessError } 17700026 - The specified bundle is disabled. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getLaunchWantForBundle(bundleName: string, callback: AsyncCallback): void; + + /** + * 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 + * #ACTION_HOME and #ENTITY_HOME Want filters set in the application's config.json or module.json file. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { string } bundleName - Indicates the bundle name of the application. + * @param { number } userId - Indicates the user ID or do not pass user ID. + * @returns { Promise } the Want for starting the application's main ability. + * @throws { BusinessError } 201 - Calling interface without permission 'ohos.permission.GET_BUNDLE_INFO_PRIVILEGED'. + * @throws { BusinessError } 401 - Input parameters check failed. + * @throws { BusinessError } 17700001 - The specified bundleName is not found. + * @throws { BusinessError } 17700004 - The specified user ID is not found. + * @throws { BusinessError } 17700026 - The specified bundle is disabled. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getLaunchWantForBundle(bundleName: string, userId?: number): Promise; + + /** + * Obtains the profile designated by metadata name, abilityName and moduleName from the current application. + * @param { string } moduleName - Indicates the moduleName of the application. + * @param { string } abilityName - Indicates the abilityName of the application. + * @param { string } metadataName - Indicates the name of metadata in ability. + * @param { AsyncCallback> } callback - The callback of returning string in json-format of the corresponding config file. + * @throws { BusinessError } 401 - Input parameters check failed. + * @throws { BusinessError } 17700002 - The specified moduleName is not existed. + * @throws { BusinessError } 17700003 - The specified abilityName is not existed. + * @throws { BusinessError } 17700024 - Failed to get the profile because there is no profile in the HAP. + * @throws { BusinessError } 17700026 - The specified bundle is disabled. + * @throws { BusinessError } 17700029 - The specified ability is disabled. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + function getProfileByAbility(moduleName: string, abilityName: string, metadataName: string, callback: AsyncCallback>): void; + + /** + * Obtains the profile designated by metadata name, abilityName and moduleName from the current application. + * @param { string } moduleName - Indicates the moduleName of the application. + * @param { string } abilityName - Indicates the abilityName of the application. + * @param { string } metadataName - Indicates the name of metadata in ability. + * @returns { Promise> } Returns string in json-format of the corresponding config file. + * @throws { BusinessError } 401 - Input parameters check failed. + * @throws { BusinessError } 17700002 - The specified moduleName is not existed. + * @throws { BusinessError } 17700003 - The specified abilityName is not existed. + * @throws { BusinessError } 17700024 - Failed to get the profile because there is no profile in the HAP. + * @throws { BusinessError } 17700026 - The specified bundle is disabled. + * @throws { BusinessError } 17700029 - The specified ability is disabled. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + function getProfileByAbility(moduleName: string, abilityName: string, metadataName?: string): Promise>; + + /** + * Obtains the profile designated by metadata name, extensionAbilityName and moduleName from the current application. + * @param { string } moduleName - Indicates the moduleName of the application. + * @param { string } extensionAbilityName - Indicates the extensionAbilityName of the application. + * @param { string } metadataName - Indicates the name of metadata in ability. + * @param { AsyncCallback } callback - The callback of returning string in json-format of the corresponding config file. + * @throws { BusinessError } 401 - Input parameters check failed. + * @throws { BusinessError } 17700002 - The specified moduleName is not existed. + * @throws { BusinessError } 17700003 - The specified extensionAbilityName not existed. + * @throws { BusinessError } 17700024 - Failed to get the profile because there is no profile in the HAP. + * @throws { BusinessError } 17700026 - The specified bundle is disabled. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + function getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName: string, callback: AsyncCallback>): void; + + /** + * Obtains the profile designated by metadata name, extensionAbilityName and moduleName from the current application. + * @param { string } moduleName - Indicates the moduleName of the application. + * @param { string } extensionAbilityName - Indicates the extensionAbilityName of the application. + * @param { string } metadataName - Indicates the name of metadata in ability. + * @returns { Promise> } Returns string in json-format of the corresponding config file. + * @throws { BusinessError } 401 - Input parameters check failed. + * @throws { BusinessError } 17700002 - The specified moduleName is not existed. + * @throws { BusinessError } 17700003 - The specified extensionAbilityName not existed. + * @throws { BusinessError } 17700024 - Failed to get the profile because there is no profile in the HAP. + * @throws { BusinessError } 17700026 - The specified bundle is disabled. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + function getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName?: string): Promise>; + + /** + * Get the permission details by permission name. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { string } permissionName - Indicates permission name. + * @param { AsyncCallback } callback - The callback of get permissionDef object result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Input parameters check failed. + * @throws { BusinessError } 17700006 - The specified permission is not found. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getPermissionDef(permissionName: string, callback: AsyncCallback): void; + + /** + * Get the permission details by permission name. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { string } permissionName - Indicates permission name. + * @returns { Promise } Returns permissionDef object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Input parameters check failed. + * @throws { BusinessError } 17700006 - The specified permission is not found. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getPermissionDef(permissionName: string): Promise; + + /** + * Obtains the label of a specified ability. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { string } bundleName - Indicates the bundle name of the application to which the ability belongs. + * @param { string } moduleName - Indicates the module name. + * @param { string } abilityName - Indicates the ability name. + * @param { AsyncCallback } callback - The callback of getting ability label result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 17700001 - The specified bundleName is not found. + * @throws { BusinessError } 17700002 - The specified moduleName is not found. + * @throws { BusinessError } 17700003 - The specified abilityName is not found. + * @throws { BusinessError } 17700026 - The specified bundle is disabled. + * @throws { BusinessError } 17700029 - The specified ability is disabled. + * @syscap SystemCapability.BundleManager.BundleFramework.Resource + * @systemapi + * @since 9 + */ + function getAbilityLabel(bundleName: string, moduleName: string, abilityName: string, callback: AsyncCallback): void; + + /** + * Obtains the label of a specified ability. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { string } bundleName - Indicates the bundle name of the application to which the ability belongs. + * @param { string } moduleName - Indicates the module name. + * @param { string } abilityName - Indicates the ability name. + * @returns { Promise } Returns the label representing the label of the specified ability. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 17700001 - The specified bundleName is not found. + * @throws { BusinessError } 17700002 - The specified moduleName is not found. + * @throws { BusinessError } 17700003 - The specified abilityName is not found. + * @throws { BusinessError } 17700026 - The specified bundle is disabled. + * @throws { BusinessError } 17700029 - The specified ability is disabled. + * @syscap SystemCapability.BundleManager.BundleFramework.Resource + * @systemapi + * @since 9 + */ + function getAbilityLabel(bundleName: string, moduleName: string, abilityName: string): Promise; + + /** + * Obtains the icon of a specified ability. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { string } bundleName - Indicates the bundle name of the application to which the ability belongs. + * @param { string } moduleName - Indicates the module name. + * @param { string } abilityName - Indicates the ability name. + * @param { AsyncCallAsyncCallback } callback - The callback of getting ability icon result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 17700001 - The specified bundleName is not found. + * @throws { BusinessError } 17700002 - The specified moduleName is not found. + * @throws { BusinessError } 17700003 - The specified abilityName is not found. + * @throws { BusinessError } 17700026 - The specified bundle is disabled. + * @throws { BusinessError } 17700029 - The specified ability is disabled. + * @syscap SystemCapability.BundleManager.BundleFramework.Resource + * @systemapi + * @since 9 + */ + function getAbilityIcon(bundleName: string, moduleName: string, abilityName: string, callback: AsyncCallback): void; + + /** + * Obtains the icon of a specified ability. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { string } bundleName - Indicates the bundle name of the application to which the ability belongs. + * @param { string } moduleName - Indicates the module name. + * @param { string } abilityName - Indicates the ability name. + * @returns { Promise } Returns the PixelMap object representing the icon of the specified ability. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 17700001 - The specified bundleName is not found. + * @throws { BusinessError } 17700002 - The specified moduleName is not found. + * @throws { BusinessError } 17700003 - The specified abilityName is not found. + * @throws { BusinessError } 17700026 - The specified bundle is disabled. + * @throws { BusinessError } 17700029 - The specified ability is disabled. + * @syscap SystemCapability.BundleManager.BundleFramework.Resource + * @systemapi + * @since 9 + */ + function getAbilityIcon(bundleName: string, moduleName: string, abilityName: string): Promise; + + /** + * Obtains applicationInfo based on a given bundleName and bundleFlags. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { string } bundleName - Indicates the application bundle name to be queried. + * @param { number } applicationFlags - Indicates the flag used to specify information contained in the ApplicationInfo object that will be returned. + * @param { number } userId - Indicates the user ID or do not pass user ID. + * @returns Returns the ApplicationInfo object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 17700001 - The specified bundleName is not found. + * @throws { BusinessError } 17700004 - The specified user ID is not found. + * @throws { BusinessError } 17700026 - The specified bundle is disabled. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getApplicationInfoSync(bundleName: string, applicationFlags: number, userId: number) : ApplicationInfo; + function getApplicationInfoSync(bundleName: string, applicationFlags: number) : ApplicationInfo; + + /** + * Obtains bundleInfo based on bundleName, bundleFlags and options. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @param { string } bundleName - Indicates the application bundle name to be queried. + * @param { number } bundleFlags - Indicates the flag used to specify information contained in the BundleInfo object that will be returned. + * @param { number } userId - Indicates the user ID or do not pass user ID. + * @returns Returns the BundleInfo object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 17700001 - The specified bundleName is not found. + * @throws { BusinessError } 17700004 - The specified user ID is not found. + * @throws { BusinessError } 17700026 - The specified bundle is disabled. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getBundleInfoSync(bundleName: string, bundleFlags: number, userId: number): BundleInfo; + function getBundleInfoSync(bundleName: string, bundleFlags: number): BundleInfo; + + /** + * Obtains configuration information about an application. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + export type ApplicationInfo = _ApplicationInfo; + + /** + * Indicates the Metadata. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + export type Metadata = _Metadata; + + /** + * Obtains configuration information about a bundle. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + export type BundleInfo = _BundleInfo.BundleInfo; + + /** + * The scene which is used. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + export type UsedScene = _BundleInfo.UsedScene; + + /** + * Indicates the required permissions details defined in file config.json. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + export type ReqPermissionDetail = _BundleInfo.ReqPermissionDetail; + + /** + * Indicates the SignatureInfo. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + export type SignatureInfo = _BundleInfo.SignatureInfo; + + /** + * Obtains configuration information about an module. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + export type HapModuleInfo = _HapModuleInfo; + + /** + * Obtains configuration information about an ability. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + export type AbilityInfo = _AbilityInfo.AbilityInfo; + + /** + * Contains basic Ability information. Indicates the window size.. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + export type WindowSize = _AbilityInfo.WindowSize; + + /** + * Obtains extension information about a bundle. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + export type ExtensionAbilityInfo = _ExtensionAbilityInfo.ExtensionAbilityInfo; + + /** + * Indicates the defined permission details in file config.json. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + export type PermissionDef = _PermissionDef; + + /** + * Contains basic Ability information, which uniquely identifies an ability. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + export type ElementName = _ElementName; +} + +export default bundleManager; diff --git a/api/@ohos.bundle.bundleMonitor.d.ts b/api/@ohos.bundle.bundleMonitor.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b56af8dda540fb6a8acd38d86dc371d07a0529d8 --- /dev/null +++ b/api/@ohos.bundle.bundleMonitor.d.ts @@ -0,0 +1,85 @@ +/* + * 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 { Callback } from './basic'; + +/** + * Bundle monitor + * @namespace bundleMonitor + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ +declare namespace bundleMonitor { + /** + * This module defines the result information of monitoring install, update and uninstall. + * @typedef BundleChangedInfo + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + interface BundleChangedInfo { + /** + * The bundle name + * @type {string} + * @systemapi + * @since 9 + */ + readonly bundleName: string; + /** + * The user id + * @type {number} + * @systemapi + * @since 9 + */ + readonly userId: number; + } + + /** + * Indicates the event type of bundle change + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + type BundleChangedEvent = 'add' | 'update' | 'remove'; + + /** + * Register to monitor the installation status + * @permission ohos.permission.LISTEN_BUNDLE_CHANGE + * @param { BundleChangedEvent } type - Indicates the command should be implement. + * @param { Callback } callback - Indicates the callback to be register. + * @throws {BusinessError} 201 - Verify permission denied. + * @throws {BusinessError} 401 - The parameter check failed. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function on(type: BundleChangedEvent, callback: Callback): void; + + /** + * Unregister to monitor the installation status + * @permission ohos.permission.LISTEN_BUNDLE_CHANGE + * @param { BundleChangedEvent } type -type Indicates the command should be implement. + * @param { Callback } callback - Indicates the callback to be unregister. + * @throws {BusinessError} 201 - Verify permission denied. + * @throws {BusinessError} 401 - The parameter check failed. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function off(type: BundleChangedEvent, callback?: Callback): void; +} + +export default bundleMonitor diff --git a/api/@ohos.bundle.d.ts b/api/@ohos.bundle.d.ts index 468be9fb97238214a070f680c72daccf4123437f..d9285e25e2a6169f814f54627d5de1503ad88786 100644 --- a/api/@ohos.bundle.d.ts +++ b/api/@ohos.bundle.d.ts @@ -13,30 +13,22 @@ * limitations under the License. */ -import { AsyncCallback, Callback } from './basic'; -import { ApplicationInfo as _ApplicationInfo } from './bundle/applicationInfo'; -import { ModuleInfo as _ModuleInfo } from './bundle/moduleInfo'; -import { CustomizeData as _CustomizeData } from './bundle/customizeData'; -import { Metadata as _Metadata } from './bundle/metadata'; -import { HapModuleInfo as _HapModuleInfo } from './bundle/hapModuleInfo'; -import { AbilityInfo as _AbilityInfo } from './bundle/abilityInfo'; -import { ExtensionAbilityInfo as _ExtensionAbilityInfo } from './bundle/extensionAbilityInfo'; -import { PermissionDef as _PermissionDef } from './bundle/PermissionDef'; -import { ElementName as _ElementName } from './bundle/elementName'; -import { DispatchInfo as _DispatchInfo } from './bundle/dispatchInfo'; +import { AsyncCallback } from './basic'; +import { ApplicationInfo } from './bundle/applicationInfo'; +import { AbilityInfo } from './bundle/abilityInfo'; +import { PermissionDef } from './bundle/PermissionDef'; import Want from './@ohos.application.Want'; import image from './@ohos.multimedia.image'; -import pack from './bundle/packInfo'; -import * as _PackInfo from './bundle/packInfo'; -import * as _BundleInfo from './bundle/bundleInfo'; -import * as _BundleInstaller from './bundle/bundleInstaller'; +import { BundleInfo } from './bundle/bundleInfo'; +import { BundleInstaller } from './bundle/bundleInstaller'; /** * bundle. * @name bundle * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework - * @permission NA + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager */ declare namespace bundle { @@ -44,8 +36,9 @@ declare namespace bundle { * @name BundleFlag * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework - * @import NA - * @permission NA + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager.BundleFlag, ohos.bundle.bundleManager.ApplicationFlag or + * ohos.bundle.bundleManager.AbilityFlag */ enum BundleFlag { GET_BUNDLE_DEFAULT = 0x00000000, @@ -59,14 +52,6 @@ declare namespace bundle { * @since 8 */ GET_ABILITY_INFO_WITH_METADATA = 0x00000020, - /** - * @since 9 - */ - GET_BUNDLE_WITH_EXTENSION_ABILITY = 0x00000020, - /** - * @since 9 - */ - GET_BUNDLE_WITH_HASH_VALUE = 0x00000030, /** * @since 8 */ @@ -83,32 +68,13 @@ declare namespace bundle { * @since 8 */ GET_APPLICATION_INFO_WITH_DISABLE = 0x00000200, - /** - * @since 9 - */ - GET_APPLICATION_INFO_WITH_CERTIFICATE_FINGERPRINT = 0x00000400, - } - -/** - * @name ExtensionFlag - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @import NA - * @permission NA - */ - enum ExtensionFlag { - GET_EXTENSION_INFO_DEFAULT = 0x00000000, - GET_EXTENSION_INFO_WITH_PERMISSION = 0x00000002, - GET_EXTENSION_INFO_WITH_APPLICATION = 0x00000004, - GET_EXTENSION_INFO_WITH_METADATA = 0x00000020, } /** * @name ColorMode * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework - * @import NA - * @permission NA + * @deprecated since 9 */ export enum ColorMode { AUTO_MODE = -1, @@ -120,8 +86,8 @@ declare namespace bundle { * @name GrantStatus * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework - * @import NA - * @permission NA + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager.PermissionGrantState */ export enum GrantStatus { PERMISSION_DENIED = -1, @@ -132,8 +98,8 @@ declare namespace bundle { * @name AbilityType * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework - * @import NA - * @permission NA + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager.AbilityType */ export enum AbilityType { /** @@ -169,8 +135,7 @@ declare namespace bundle { * @name AbilitySubType * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework - * @import NA - * @permission NA + * @deprecated since 9 */ export enum AbilitySubType { UNSPECIFIED = 0, @@ -181,8 +146,8 @@ declare namespace bundle { * @name DisplayOrientation * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework - * @import NA - * @permission NA + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager.DisplayOrientation */ export enum DisplayOrientation { /** @@ -212,77 +177,14 @@ declare namespace bundle { * @syscap SystemCapability.BundleManager.BundleFramework */ FOLLOW_RECENT, - - /** - * @default Indicates the inverted landscape orientation - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - LANDSCAPE_INVERTED, - - /** - * @default Indicates the inverted portrait orientation - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - PORTRAIT_INVERTED, - - /** - * @default Indicates the orientation can be auto-rotated - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - AUTO_ROTATION, - - /** - * @default Indicates the landscape orientation rotated with sensor - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - AUTO_ROTATION_LANDSCAPE, - - /** - * @default Indicates the portrait orientation rotated with sensor - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - AUTO_ROTATION_PORTRAIT, - - /** - * @default Indicates the sensor restricted mode - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - AUTO_ROTATION_RESTRICTED, - - /** - * @default Indicates the sensor landscape restricted mode - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - AUTO_ROTATION_LANDSCAPE_RESTRICTED, - - /** - * @default Indicates the sensor portrait restricted mode - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - AUTO_ROTATION_PORTRAIT_RESTRICTED, - - /** - * @default Indicates the locked orientation mode - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - LOCKED, } /** * @name LaunchMode * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework - * @import NA - * @permission NA + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager.LaunchType */ export enum LaunchMode { /** @@ -300,112 +202,11 @@ declare namespace bundle { STANDARD = 1, } - /** - * @name ExtensionAbilityType - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @import NA - * @permission NA - */ - export enum ExtensionAbilityType { - /** - * @default Indicates extension info with type of form - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - FORM = 0, - /** - * @default Indicates extension info with type of work schedule - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - WORK_SCHEDULER = 1, - /** - * @default Indicates extension info with type of input method - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - INPUT_METHOD = 2, - /** - * @default Indicates extension info with type of service - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - SERVICE = 3, - /** - * @default Indicates extension info with type of accessibility - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - ACCESSIBILITY = 4, - /** - * @default Indicates extension info with type of datashare - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - DATA_SHARE = 5, - /** - * @default Indicates extension info with type of fileshare - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - FILE_SHARE = 6, - /** - * @default Indicates extension info with type of staticsubscriber - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - STATIC_SUBSCRIBER = 7, - /** - * @default Indicates extension info with type of wallpaper - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - WALLPAPER = 8, - /** - * @default Indicates extension info with type of backup - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - BACKUP = 9, - /** - * @default Indicates extension info with type of window - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - WINDOW = 10, - /** - * @default Indicates extension info with type of enterprise admin - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - ENTERPRISE_ADMIN = 11, - /** - * @default Indicates extension info with type of thumbnail - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - THUMBNAIL = 13, - /** - * @default Indicates extension info with type of preview - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - PREVIEW = 14, - /** - * @default Indicates extension info with type of unspecified - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - UNSPECIFIED = 255, - } - /** * @name BundleOptions * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework - * @import NA - * @permission NA + * @deprecated since 9 */ export interface BundleOptions { /** @@ -420,8 +221,7 @@ declare namespace bundle { * @name InstallErrorCode * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework - * @import NA - * @permission NA + * @deprecated since 9 */ export enum InstallErrorCode{ SUCCESS = 0, @@ -467,61 +267,6 @@ declare namespace bundle { STATUS_UNINSTALL_PERMISSION_DENIED = 0x45, } - /** - * @name UpgradeFlag - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @systemapi Hide this for inner system use - */ - export enum UpgradeFlag { - /** - * @default Indicates module not need to be upgraded - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - NOT_UPGRADE = 0, - /** - * @default Indicates single module need to be upgraded - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - SINGLE_UPGRADE = 1, - /** - * @default Indicates relation module need to be upgraded - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - RELATION_UPGRADE = 2, - } - - /** - * @name SupportWindowMode - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @import NA - * @permission NA - */ - export enum SupportWindowMode { - /** - * @default Indicates supported window mode of full screen mode - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - FULL_SCREEN = 0, - /** - * @default Indicates supported window mode of split mode - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - SPLIT = 1, - /** - * @default Indicates supported window mode of floating mode - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - FLOATING = 2, - } - /** * Obtains bundleInfo based on bundleName, bundleFlags and options. * @@ -530,8 +275,10 @@ declare namespace bundle { * @param bundleName Indicates the application bundle name to be queried. * @param bundleFlags Indicates the application bundle flags to be queried. * @param options Indicates the bundle options object. - * @return Returns the BundleInfo object. + * @returns Returns the BundleInfo object. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager#getBundleInfo */ function getBundleInfo(bundleName: string, bundleFlags: number, options: BundleOptions, callback: AsyncCallback): void; function getBundleInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback): void; @@ -542,9 +289,11 @@ declare namespace bundle { * * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework - * @return Returns the IBundleInstaller interface. + * @returns Returns the IBundleInstaller interface. * @permission ohos.permission.INSTALL_BUNDLE * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead ohos.bundle.installer#getBundleInstaller */ function getBundleInstaller(callback: AsyncCallback): void; function getBundleInstaller(): Promise; @@ -556,8 +305,10 @@ declare namespace bundle { * @syscap SystemCapability.BundleManager.BundleFramework * @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. + * @returns Returns the AbilityInfo object for the current ability. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager#queryAbilityInfo */ function getAbilityInfo(bundleName: string, abilityName: string, callback: AsyncCallback): void; function getAbilityInfo(bundleName: string, abilityName: string): Promise; @@ -571,8 +322,10 @@ declare namespace bundle { * @param bundleFlags Indicates the flag used to specify information contained in the ApplicationInfo object * that will be returned. * @param userId Indicates the user ID or do not pass user ID. - * @return Returns the ApplicationInfo object. + * @returns Returns the ApplicationInfo object. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager#getApplicationInfo */ function getApplicationInfo(bundleName: string, bundleFlags: number, userId: number, callback: AsyncCallback) : void; function getApplicationInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback) : void; @@ -588,8 +341,10 @@ declare namespace bundle { * @param bundleFlags Indicates the flag used to specify information contained in the AbilityInfo objects that * will be returned. * @param userId Indicates the user ID. - * @return Returns a list of AbilityInfo objects. + * @returns Returns a list of AbilityInfo objects. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager#queryAbilityInfo */ function queryAbilityByWant(want: Want, bundleFlags: number, userId: number, callback: AsyncCallback>): void; function queryAbilityByWant(want: Want, bundleFlags: number, callback: AsyncCallback>): void; @@ -603,8 +358,10 @@ declare namespace bundle { * @param bundleFlag Indicates the flag used to specify information contained in the BundleInfo that will be * returned. * @param userId Indicates the user id. - * @return Returns a list of BundleInfo objects. + * @returns Returns a list of BundleInfo objects. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager#getAllBundleInfo */ function getAllBundleInfo(bundleFlag: BundleFlag, userId: number, callback: AsyncCallback>) : void; function getAllBundleInfo(bundleFlag: BundleFlag, callback: AsyncCallback>) : void; @@ -618,8 +375,10 @@ declare namespace bundle { * @param bundleFlags Indicates the flag used to specify information contained in the ApplicationInfo objects * that will be returned. * @param userId Indicates the user ID or do not pass user ID. - * @return Returns a list of ApplicationInfo objects. + * @returns Returns a list of ApplicationInfo objects. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager#getAllApplicationInfo */ function getAllApplicationInfo(bundleFlags: number, userId: number, callback: AsyncCallback>) : void; function getAllApplicationInfo(bundleFlags: number, callback: AsyncCallback>) : void; @@ -631,7 +390,9 @@ declare namespace bundle { * @since 8 * @syscap SystemCapability.BundleManager.BundleFramework * @param uid Indicates the UID of an application. - * @return Returns the bundle name. + * @returns Returns the bundle name. + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager#getNameForUid */ function getNameForUid(uid: number, callback: AsyncCallback) : void function getNameForUid(uid: number) : Promise; @@ -645,7 +406,9 @@ declare namespace bundle { * directory of the current application. * @param bundleFlags Indicates the flag used to specify information contained in the BundleInfo object to be * returned. - * @return Returns the BundleInfo object. + * @returns Returns the BundleInfo object. + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager#getBundleArchiveInfo */ function getBundleArchiveInfo(hapFilePath: string, bundleFlags: number, callback: AsyncCallback) : void function getBundleArchiveInfo(hapFilePath: string, bundleFlags: number) : Promise; @@ -659,9 +422,11 @@ declare namespace bundle { * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework * @param bundleName Indicates the bundle name of the application. - * @return Returns the Want for starting the application's main ability if any; returns null if + * @returns Returns the Want for starting the application's main ability if any; returns null if * the given bundle does not exist or does not contain any main ability. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager#getLaunchWantForBundle */ function getLaunchWantForBundle(bundleName: string, callback: AsyncCallback): void; function getLaunchWantForBundle(bundleName: string): Promise; @@ -675,6 +440,8 @@ declare namespace bundle { * @param callback Indicates the callback to be invoked for returning the operation result. * @permission ohos.permission.REMOVE_CACHE_FILES * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager#cleanBundleCacheFiles */ function cleanBundleCacheFiles(bundleName: string, callback: AsyncCallback): void; function cleanBundleCacheFiles(bundleName: string): Promise; @@ -689,6 +456,8 @@ declare namespace bundle { * value false means to disable it. * @permission ohos.permission.CHANGE_ABILITY_ENABLED_STATE * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager#setApplicationEnabled */ function setApplicationEnabled(bundleName: string, isEnable: boolean, callback: AsyncCallback): void; function setApplicationEnabled(bundleName: string, isEnable: boolean): Promise; @@ -703,35 +472,23 @@ declare namespace bundle { * value false means to disable it.. * @permission ohos.permission.CHANGE_ABILITY_ENABLED_STATE * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager#setAbilityEnabled */ function setAbilityEnabled(info: AbilityInfo, isEnable: boolean, callback: AsyncCallback): void; function setAbilityEnabled(info: AbilityInfo, isEnable: boolean): Promise; - /** - * Query extension info of by utilizing a Want. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @param want Indicates the Want containing the application bundle name to be queried. - * @param extensionFlags Indicates the flag used to specify information contained in the ExtensionInfo objects that - * will be returned. - * @param userId Indicates the user ID. - * @return Returns a list of ExtensionInfo objects. - * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO - */ - function queryExtensionAbilityInfos(want: Want, extensionType: number, extensionFlags: number, userId: number, callback: AsyncCallback>): void; - function queryExtensionAbilityInfos(want: Want, extensionType: number, extensionFlags: number, callback: AsyncCallback>): void; - function queryExtensionAbilityInfos(want: Want, extensionType: number, extensionFlags: number, userId?: number): Promise>; - /** * Get the permission details by permissionName. * * @since 8 * @syscap SystemCapability.BundleManager.BundleFramework * @param permissionName Indicates permission name. - * @return Returns permissionDef object. + * @returns Returns permissionDef object. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED * @systemapi + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager#getPermissionDef */ function getPermissionDef(permissionName: string, callback: AsyncCallback): void; function getPermissionDef(permissionName: string): Promise; @@ -744,7 +501,9 @@ declare namespace bundle { * @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 or ohos.permission.GET_BUNDLE_INFO - * @return Returns the label representing the label of the specified ability. + * @returns Returns the label representing the label of the specified ability. + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager#getAbilityLabel */ function getAbilityLabel(bundleName: string, abilityName: string, callback: AsyncCallback): void; function getAbilityLabel(bundleName: string, abilityName: string): Promise; @@ -756,8 +515,10 @@ 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. - * @return Returns the PixelMap object representing the icon of the specified ability. + * @returns Returns the PixelMap object representing the icon of the specified ability. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager#getAbilityIcon */ function getAbilityIcon(bundleName: string, abilityName: string, callback: AsyncCallback): void; function getAbilityIcon(bundleName: string, abilityName: string): Promise; @@ -769,7 +530,9 @@ declare namespace bundle { * @syscap SystemCapability.BundleManager.BundleFramework * @param info Indicates information about the ability to check. * @returns Returns true if the ability is enabled; returns false otherwise. - */ + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager#isAbilityEnabled + */ function isAbilityEnabled(info: AbilityInfo, callback: AsyncCallback): void; function isAbilityEnabled(info: AbilityInfo): Promise; @@ -780,434 +543,11 @@ declare namespace bundle { * @syscap SystemCapability.BundleManager.BundleFramework * @param bundleName Indicates the bundle name of the application. * @returns Returns true if the application is enabled; returns false otherwise. + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager#isApplicationEnabled */ function isApplicationEnabled(bundleName: string, callback: AsyncCallback): void; function isApplicationEnabled(bundleName: string): Promise; - - /** - * Set the module wether need upgrade - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @param bundleName Indicates the bundle name of the application. - * @param moduleName Indicates the module name of the application. - * @param upgradeFlag Indicates upgradeFlag of the application. - * @systemapi Hide this for inner system use - */ - function setModuleUpgradeFlag(bundleName: string, moduleName: string, upgradeFlag: UpgradeFlag, callback: AsyncCallback):void; - function setModuleUpgradeFlag(bundleName: string, moduleName: string, upgradeFlag: UpgradeFlag): Promise; - - /** - * Checks whether a specified module is removable. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @param bundleName Indicates the bundle name of the application. - * @param moduleName Indicates the module name of the application. - * @returns Returns true if the module is removable; returns false otherwise. - * @systemapi Hide this for inner system use - */ - function isModuleRemovable(bundleName: string, moduleName: string, callback: AsyncCallback): void; - function isModuleRemovable(bundleName: string, moduleName: string): Promise; - - /** - * Obtains bundlePackInfo based on bundleName and bundleFlags. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @param bundleName Indicates the application bundle name to be queried. - * @param bundlePackFlag Indicates the application bundle pack flag to be queried. - * @return Returns the BundlePackInfo object. - * @systemapi hide this for inner system use - */ - function getBundlePackInfo(bundleName: string, bundlePackFlag : pack.BundlePackFlag, callback: AsyncCallback): void; - function getBundlePackInfo(bundleName: string, bundlePackFlag : pack.BundlePackFlag): Promise; - - /** - * Obtains information about the current ability. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @param bundleName Indicates the application bundle name to be queried. - * @param moduleName Indicates the module name. - * @param abilityName Indicates the ability name. - * @return Returns the AbilityInfo object for the current ability. - * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO - */ - function getAbilityInfo(bundleName: string, moduleName: string, abilityName: string, callback: AsyncCallback): void; - function getAbilityInfo(bundleName: string, moduleName: string, abilityName: string): Promise; - - /** - * Obtains information about the dispatcher version. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @return Returns the DispatchInfo object for the current ability. - * @systemapi hide this for inner system use - */ - function getDispatcherVersion(callback: AsyncCallback): void; - function getDispatcherVersion(): Promise; - - /** - * Obtains the label of a specified ability. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @param bundleName Indicates the bundle name of the application to which the ability belongs. - * @param moduleName Indicates the module name. - * @param abilityName Indicates the ability name. - * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO - * @return Returns the label representing the label of the specified ability. - */ - function getAbilityLabel(bundleName: string, moduleName: string, abilityName: string, callback: AsyncCallback): void; - function getAbilityLabel(bundleName: string, moduleName: string, abilityName: string): Promise; - - /** - * Obtains the icon of a specified ability. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @param bundleName Indicates the bundle name of the application to which the ability belongs. - * @param moduleName Indicates the module name. - * @param abilityName Indicates the ability name. - * @return Returns the PixelMap object representing the icon of the specified ability. - * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO - */ - function getAbilityIcon(bundleName: string, moduleName: string, abilityName: string, callback: AsyncCallback): void; - function getAbilityIcon(bundleName: string, moduleName: string, abilityName: string): Promise; - - /** - * Obtains the profile designated by metadata name, abilityName and moduleName from the current application. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @param moduleName Indicates the moduleName of the application. - * @param abilityName Indicates the abilityName of the application. - * @param metadataName Indicates the name of metadata in ability. - * @return Returns string in json-format of the corresponding config file. - */ - function getProfileByAbility(moduleName: string, abilityName: string, metadataName: string, callback: AsyncCallback>): void; - function getProfileByAbility(moduleName: string, abilityName: string, metadataName?: string): Promise>; - - /** - * Obtains the profile designated by metadata name, extensionAbilityName and moduleName from the current application. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @param moduleName Indicates the moduleName of the application. - * @param extensionAbilityName Indicates the extensionAbilityName of the application. - * @param metadataName Indicates the name of metadata in ability. - * @return Returns string in json-format of the corresponding config file. - */ - function getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName: string, callback: AsyncCallback>): void; - function getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName?: string): Promise>; - - /** - * Set the disposed status of a specified bundle. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @param bundleName Indicates the bundle name of the application. - * @param status Indicates the disposed status. - * @return Returns the disposed status of a specified bundle. - * @permission ohos.permission.MANAGE_DISPOSED_APP_STATUS - * @systemapi Hide this for inner system use - */ - function setDisposedStatus(bundleName: string, status: number, callback: AsyncCallback): void; - function setDisposedStatus(bundleName: string, status: number): Promise; - - /** - * Obtains the disposed status of a specified bundle. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @param bundleName Indicates the bundle name of the application. - * @return Returns the disposed status of a specified bundle. - * @permission ohos.permission.MANAGE_DISPOSED_APP_STATUS - * @systemapi Hide this for inner system use - */ - function getDisposedStatus(bundleName: string, callback: AsyncCallback): void; - function getDisposedStatus(bundleName: string): Promise; - - /** - * Obtains based on a given bundleName and bundleFlags. - * - * @since 9 - * @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 or do not pass user ID. - * @return Returns the ApplicationInfo object. - * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO - */ - function getApplicationInfoSync(bundleName: string, bundleFlags: number, userId: number) : ApplicationInfo; - function getApplicationInfoSync(bundleName: string, bundleFlags: number) : ApplicationInfo; - - /** - * Obtains bundleInfo based on bundleName, bundleFlags and options. - * - * @since 9 - * @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 BundleInfo object - * that will be returned. - * @param options Indicates the bundle options object. - * @return Returns the BundleInfo object. - * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO - */ - function getBundleInfoSync(bundleName: string, bundleFlags: number, options: BundleOptions): BundleInfo; - function getBundleInfoSync(bundleName: string, bundleFlags: number): BundleInfo; - - /** - * Obtains configuration information about an application. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - export type ApplicationInfo = _ApplicationInfo; - - /** - * Stores module information about an application. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - export type ModuleInfo = _ModuleInfo; - - /** - * Indicates the custom metadata. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - export type CustomizeData = _CustomizeData; - - /** - * Indicates the Metadata. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - export type Metadata = _Metadata; - - /** - * Obtains configuration information about a bundle. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - export type BundleInfo = _BundleInfo.BundleInfo; - - /** - * The scene which is used. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - export type UsedScene = _BundleInfo.UsedScene; - - /** - * Indicates the required permissions details defined in file config.json. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - export type ReqPermissionDetail = _BundleInfo.ReqPermissionDetail; - - /** - * Obtains configuration information about an module. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - export type HapModuleInfo = _HapModuleInfo; - - /** - * Obtains configuration information about an ability. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - export type AbilityInfo = _AbilityInfo; - - /** - * Obtains extension information about a bundle. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - export type ExtensionAbilityInfo = _ExtensionAbilityInfo; - - /** - * Offers install, upgrade, and remove bundles on the devices. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @systemapi hide this for inner system use - */ - export type BundleInstaller = _BundleInstaller.BundleInstaller; - - /** - * Provides parameters required for hashParam. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @systemapi hide this for inner system use - */ - export type HashParam = _BundleInstaller.HashParam; - - /** - * Provides parameters required for installing or uninstalling an application. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @systemapi hide this for inner system use - */ - export type InstallParam = _BundleInstaller.InstallParam; - - /** - * Indicates the install or uninstall status. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @systemapi hide this for inner system use - */ - export type InstallStatus = _BundleInstaller.InstallStatus; - - /** - * Indicates the defined permission details in file config.json. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @systemapi hide this for inner system use - */ - export type PermissionDef = _PermissionDef; - - /** - * Contains basic Ability information, which uniquely identifies an ability. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - export type ElementName = _ElementName; - - /** - * The dispatch info class. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @systemapi hide this for inner system use - */ - export type DispatchInfo = _DispatchInfo; - - /** - * The bundle pack info class. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @systemapi hide this for inner system use - */ - export type BundlePackInfo = _PackInfo.BundlePackInfo; - - /** - * The package info class. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @systemapi hide this for inner system use - */ - export type PackageConfig = _PackInfo.PackageConfig; - - /** - * The package summary class. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @systemapi hide this for inner system use - */ - export type PackageSummary = _PackInfo.PackageSummary; - - /** - * The bundle summary class. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @systemapi hide this for inner system use - */ - export type BundleConfigInfo = _PackInfo.BundleConfigInfo; - - /** - * The extension ability forms class. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @systemapi hide this for inner system use - */ - export type ExtensionAbilities = _PackInfo.ExtensionAbilities; - - /** - * The module summary of a bundle. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @systemapi hide this for inner system use - */ - export type ModuleConfigInfo = _PackInfo.ModuleConfigInfo; - - /** - * The bundle info summary class. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @systemapi hide this for inner system use - */ - export type ModuleDistroInfo = _PackInfo.ModuleDistroInfo; - - /** - * The ability info of a module. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @systemapi hide this for inner system use - */ - export type ModuleAbilityInfo = _PackInfo.ModuleAbilityInfo; - - /** - * The form info of an ability. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @systemapi hide this for inner system use - */ - export type AbilityFormInfo = _PackInfo.AbilityFormInfo; - - /** - * The bundle version class. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @systemapi hide this for inner system use - */ - export type Version = _PackInfo.Version; - - /** - * The bundle Api version class. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @systemapi hide this for inner system use - */ - export type ApiVersion = _PackInfo.ApiVersion; - - /** - * Flags which are used to indicate bundle pack. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @systemapi hide this for inner system use - */ - export type BundlePackFlag = _PackInfo.BundlePackFlag; } export default bundle; diff --git a/api/@ohos.bundle.defaultAppManager.d.ts b/api/@ohos.bundle.defaultAppManager.d.ts index d467bb1b4a8d8e4d78dabfdff5e52e53682214e3..9dc3842280a53f9ce010bac247e688b948c8c781 100644 --- a/api/@ohos.bundle.defaultAppManager.d.ts +++ b/api/@ohos.bundle.defaultAppManager.d.ts @@ -14,130 +14,205 @@ */ import { AsyncCallback } from './basic'; -import { BundleInfo } from './bundle/bundleInfo'; -import { ElementName } from './bundle/elementName'; +import { BundleInfo } from './bundleManager/bundleInfo'; +import { ElementName } from './bundleManager/elementName'; /** - * default application manager. - * @name defaultAppManager + * Default application manager. + * @namespace defaultAppManager + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @permission NA */ declare namespace defaultAppManager { /** - * the constant for application type. - * @name ApplicationType + * The constant for application type. + * @enum {number} + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @permission N/A */ export enum ApplicationType { /** - * default browser identifier. - * + * Default browser identifier. + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp * @since 9 */ - BROWSER = "BROWSER", + BROWSER = "Web Browser", /** - * default image identifier. - * + * Default image identifier. + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp * @since 9 */ - IMAGE = "IMAGE", + IMAGE = "Image Gallery", /** - * default audio identifier. - * + * Default audio identifier. + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp * @since 9 */ - AUDIO = "AUDIO", + AUDIO = "Audio Player", /** - * default video identifier. - * + * Default video identifier. + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp * @since 9 */ - VIDEO = "VIDEO", + VIDEO = "Video Player", /** - * default pdf identifier. - * + * Default PDF identifier. + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp * @since 9 */ - PDF = "PDF", + PDF = "PDF Viewer", /** - * default word identifier. - * + * Default word identifier. + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp * @since 9 */ - WORD = "WORD", + WORD = "Word Viewer", /** - * default excel identifier. - * + * Default excel identifier. + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp * @since 9 */ - EXCEL = "EXCEL", + EXCEL = "Excel Viewer", /** - * default ppt identifier. - * + * Default PPT identifier. + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp * @since 9 */ - PPT = "PPT", + PPT = "PPT Viewer", } /** - * query whether the caller is default application based on type. - * + * Query whether the caller is default application based on type. + * @param { string } type - Application type or a file type that conforms to media type format. + * @param { AsyncCallback } callback - The callback of querying default application result. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @param type application type or file type. - * @return return true if caller is default application; return false otherwise. - * @permission N/A */ - function isDefaultApplication(type: string) : Promise; function isDefaultApplication(type: string, callback: AsyncCallback) : void; /** - * get default application based on type. - * + * Query whether the caller is default application based on type. + * @param { string } type - Application type or a file type that conforms to media type format. + * @returns { Promise } Return true if caller is default application; return false otherwise. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @param type application type or file type. - * @param userId indicates the id for the user. - * @return return the BundleInfo object. + */ + function isDefaultApplication(type: string) : Promise; + + /** + * Get default application based on type. * @permission ohos.permission.GET_DEFAULT_APPLICATION - * @systemapi hide this for inner system use. + * @param { string } type - Application type or a file type that conforms to media type format. + * @param { number } userId - Indicates the id for the user. + * @param { AsyncCallback } callback - The callback of the BundleInfo object result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 17700004 - The specified user ID is not found. + * @throws { BusinessError } 17700023 - The specified default app does not exist. + * @throws { BusinessError } 17700025 - The specified type is invalid. + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp + * @systemapi + * @since 9 */ - function getDefaultApplication(type: string, userId?: number) : Promise; function getDefaultApplication(type: string, userId: number, callback: AsyncCallback) : void; function getDefaultApplication(type: string, callback: AsyncCallback) : void; /** - * set default application based on type. - * + * Get default application based on type. + * @permission ohos.permission.GET_DEFAULT_APPLICATION + * @param { string } type - Application type or a file type that conforms to media type format. + * @param { number } userId - Indicates the id for the user. + * @returns { Promise } Return the BundleInfo object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 17700004 - The specified user ID is not found. + * @throws { BusinessError } 17700023 - The specified default app does not exist. + * @throws { BusinessError } 17700025 - The specified type is invalid. + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp + * @systemapi * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @param type application type or file type. - * @param elementName uniquely identifies an ability or extensionAbility. - * @param userId indicates the id for the user. + */ + function getDefaultApplication(type: string, userId?: number) : Promise; + + /** + * Set default application based on type. * @permission ohos.permission.SET_DEFAULT_APPLICATION - * @systemapi hide this for inner system use. + * @param { string } type - Application type or a file type that conforms to media type format. + * @param { ElementName } elementName - Uniquely identifies an ability or extensionAbility. + * @param { number } userId - Indicates the id for the user. + * @param { AsyncCallback } callback - The callback of setting default application result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 17700004 - The specified user ID is not found. + * @throws { BusinessError } 17700025 - The specified type is invalid. + * @throws { BusinessError } 17700028 - The specified ability does not match the type. + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp + * @systemapi + * @since 9 */ - function setDefaultApplication(type: string, elementName: ElementName, userId?: number) : Promise; function setDefaultApplication(type: string, elementName: ElementName, userId: number, callback: AsyncCallback) : void; function setDefaultApplication(type: string, elementName: ElementName, callback: AsyncCallback) : void; /** - * reset default application based on type. - * + * Set default application based on type. + * @permission ohos.permission.SET_DEFAULT_APPLICATION + * @param { string } type - Application type or a file type that conforms to media type format. + * @param { ElementName } elementName - Uniquely identifies an ability or extensionAbility. + * @param { number } userId - Indicates the id for the user. + * @returns { Promise } The result of setting default application. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 17700004 - The specified user ID is not found. + * @throws { BusinessError } 17700025 - The specified type is invalid. + * @throws { BusinessError } 17700028 - The specified ability does not match the type. + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp + * @systemapi * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @param type application type or file type. - * @param userId indicates the id for the user. + */ + function setDefaultApplication(type: string, elementName: ElementName, userId?: number) : Promise; + + /** + * Reset default application based on type. * @permission ohos.permission.SET_DEFAULT_APPLICATION - * @systemapi hide this for inner system use. + * @param { string } type - Application type or a file type that conforms to media type format. + * @param { number } userId - Indicates the id for the user. + * @param { AsyncCallback } callback - The callback of resetting default application result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 17700004 - The specified user ID is not found. + * @throws { BusinessError } 17700025 - The specified type is invalid. + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp + * @systemapi + * @since 9 */ - function resetDefaultApplication(type: string, userId?: number) : Promise; function resetDefaultApplication(type: string, userId: number, callback: AsyncCallback) : void; function resetDefaultApplication(type: string, callback: AsyncCallback) : void; + + /** + * Reset default application based on type. + * @permission ohos.permission.SET_DEFAULT_APPLICATION + * @param { string } type - Application type or a file type that conforms to media type format. + * @param { number } userId - Indicates the id for the user. + * @returns { Promise } The result of resetting default application. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 17700004 - The specified user ID is not found. + * @throws { BusinessError } 17700025 - The specified type is invalid. + * @syscap SystemCapability.BundleManager.BundleFramework.DefaultApp + * @systemapi + * @since 9 + */ + function resetDefaultApplication(type: string, userId?: number) : Promise; } -export default defaultAppManager; +export default defaultAppManager; \ No newline at end of file diff --git a/api/@ohos.bundle.distributedBundle.d.ts b/api/@ohos.bundle.distributedBundle.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a5b16cec77ff6d6477bf390ca36b8fc28fd7df27 --- /dev/null +++ b/api/@ohos.bundle.distributedBundle.d.ts @@ -0,0 +1,185 @@ +/* + * 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 { ElementName } from './bundleManager/elementName'; +import { RemoteAbilityInfo as _RemoteAbilityInfo } from './bundleManager/remoteAbilityInfo'; + +/** + * DistributedBundle manager. + * @namespace distributedBundle + * @syscap SystemCapability.BundleManager.DistributedBundleFramework + * @systemapi + * @since 9 + */ +declare namespace distributedBundle { + /** + * Obtains information about the ability info of the remote device. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { ElementName } elementName - Indicates the elementName. + * @param { AsyncCallback } callback - The callback of getting the ability info of the remote device. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 17700001 - The specified bundle name is not found. + * @throws { BusinessError } 17700003 - The specified ability name is not found. + * @throws { BusinessError } 17700007 - The specified device ID is not found. + * @throws { BusinessError } 17700027 - The distributed service is not running. + * @syscap SystemCapability.BundleManager.DistributedBundleFramework + * @systemapi + * @since 9 + */ + function getRemoteAbilityInfo(elementName: ElementName, callback: AsyncCallback): void; + + /** + * Obtains information about the ability info of the remote device. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { ElementName } elementName - Indicates the elementName. + * @returns { Promise } Returns the ability info of the remote device. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 17700001 - The specified bundle name is not found. + * @throws { BusinessError } 17700003 - The specified ability name is not found. + * @throws { BusinessError } 17700007 - The specified device ID is not found. + * @throws { BusinessError } 17700027 - The distributed service is not running. + * @syscap SystemCapability.BundleManager.DistributedBundleFramework + * @systemapi + * @since 9 + */ + function getRemoteAbilityInfo(elementName: ElementName): Promise; + + /** + * Obtains information about the abilities info of the remote device. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { Array } elementNames - Indicates the elementNames, Maximum array length ten. + * @param { AsyncCallback> } callback - the callback of getting the abilities info of the remote device. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 17700001 - The specified bundle name is not found. + * @throws { BusinessError } 17700003 - The specified ability name is not found. + * @throws { BusinessError } 17700007 - The specified device ID is not found. + * @throws { BusinessError } 17700027 - The distributed service is not running. + * @syscap SystemCapability.BundleManager.DistributedBundleFramework + * @systemapi + * @since 9 + */ + function getRemoteAbilityInfo(elementNames: Array, callback: AsyncCallback>): void; + + /** + * Obtains information about the abilities info of the remote device. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { Array } elementNames - Indicates the elementNames, Maximum array length ten. + * @returns { Promise> } The result of getting the abilities info of the remote device. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 17700001 - The specified bundle name is not found. + * @throws { BusinessError } 17700003 - The specified ability name is not found. + * @throws { BusinessError } 17700007 - The specified device ID is not found. + * @throws { BusinessError } 17700027 - The distributed service is not running. + * @syscap SystemCapability.BundleManager.DistributedBundleFramework + * @systemapi + * @since 9 + */ + function getRemoteAbilityInfo(elementNames: Array): Promise>; + + /** + * Obtains information about the ability info of the remote device. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { ElementName } elementName - Indicates the elementName. + * @param { string } locale - Indicates the locale info + * @param { AsyncCallback } callback - The callback of getting the ability info of the remote device. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 17700001 - The specified bundle name is not found. + * @throws { BusinessError } 17700003 - The specified ability name is not found. + * @throws { BusinessError } 17700007 - The specified device ID is not found. + * @throws { BusinessError } 17700027 - The distributed service is not running. + * @syscap SystemCapability.BundleManager.DistributedBundleFramework + * @systemapi + * @since 9 + */ + function getRemoteAbilityInfo(elementName: ElementName, locale: string, callback: AsyncCallback): void; + + /** + * Obtains information about the ability info of the remote device. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { ElementName } elementName - Indicates the elementName. + * @param { string } locale - Indicates the locale info + * @returns { Promise> } The result of getting the ability info of the remote device. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 17700001 - The specified bundle name is not found. + * @throws { BusinessError } 17700003 - The specified ability name is not found. + * @throws { BusinessError } 17700007 - The specified device ID is not found. + * @throws { BusinessError } 17700027 - The distributed service is not running. + * @syscap SystemCapability.BundleManager.DistributedBundleFramework + * @systemapi + * @since 9 + */ + function getRemoteAbilityInfo(elementName: ElementName, locale: string): Promise; + + /** + * Obtains information about the ability info of the remote device. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { Array } elementNames - Indicates the elementNames, Maximum array length ten. + * @param { string } locale - Indicates the locale info + * @param { AsyncCallback } callback - Returns the abilities info of the remote device. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 17700001 - The specified bundle name is not found. + * @throws { BusinessError } 17700003 - The specified ability name is not found. + * @throws { BusinessError } 17700007 - The specified device ID is not found. + * @throws { BusinessError } 17700027 - The distributed service is not running. + * @syscap SystemCapability.BundleManager.DistributedBundleFramework + * @systemapi + * @since 9 + */ + function getRemoteAbilityInfo(elementNames: Array, locale: string, callback: AsyncCallback>): void; + + /** + * Obtains information about the abilities info of the remote device. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { Array } elementNames - Indicates the elementNames, Maximum array length ten. + * @param { string } locale - Indicates the locale info + * @returns { Promise> } Returns the abilities info of the remote device. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 17700001 - The specified bundle name is not found. + * @throws { BusinessError } 17700003 - The specified ability name is not found. + * @throws { BusinessError } 17700007 - The specified device ID is not found. + * @throws { BusinessError } 17700027 - The distributed service is not running. + * @syscap SystemCapability.BundleManager.DistributedBundleFramework + * @systemapi + * @since 9 + */ + function getRemoteAbilityInfo(elementNames: Array, locale: string): Promise>; + + /** + * Contains basic remote ability information. + * @syscap SystemCapability.BundleManager.DistributedBundleFramework + * @systemapi + * @since 9 + */ + export type RemoteAbilityInfo = _RemoteAbilityInfo; +} + +export default distributedBundle; diff --git a/api/@ohos.bundle.freeInstall.d.ts b/api/@ohos.bundle.freeInstall.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..331dbced298a8e7e0599391341284475361ef490 --- /dev/null +++ b/api/@ohos.bundle.freeInstall.d.ts @@ -0,0 +1,313 @@ +/* + * 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 { DispatchInfo as _DispatchInfo } from './bundleManager/dispatchInfo'; +import * as _PackInfo from './bundleManager/packInfo' + +/** + * Free install bundle manager. + * @namespace freeInstall + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ +declare namespace freeInstall { + /** + * Used to set the enumeration value of upgrading for free installation. + * @enum {number} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ + export enum UpgradeFlag { + /** + * Indicates module not need to be upgraded + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + NOT_UPGRADE = 0, + /** + * Indicates single module need to be upgraded + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + SINGLE_UPGRADE = 1, + /** + * Indicates relation module need to be upgraded + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + RELATION_UPGRADE = 2, + } + + /** + * Used to query the enumeration value of bundlePackInfo. + * @enum {number} + * @syscap SystemCapability.BundleManager.BundleFramework + * @systemapi + * @since 9 + */ + export enum BundlePackFlag { + /** + * Query all package information. + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + GET_PACK_INFO_ALL = 0x00000000, + /** + * Query package information + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + GET_PACKAGES = 0x00000001, + /** + * Query the brief information of the package + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + GET_BUNDLE_SUMMARY = 0x00000002, + /** + * Query the brief information of the module. + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + GET_MODULE_SUMMARY = 0x00000004, + } + + /** + * Sets whether to upgrade the module. + * @permission ohos.permission.INSTALL_BUNDLE + * @param { string } bundleName - Indicates the bundle name of the application. + * @param { string } moduleName - Indicates the module name of the application. + * @param { UpgradeFlag } upgradeFlag - Indicates upgradeFlag of the application. + * @param { AsyncCallback } callback - The callback of setting module upgrade flag result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 17700001 - The specified bundle name is not found. + * @throws { BusinessError } 17700002 - The specified module name is not found. + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ + function setHapModuleUpgradeFlag(bundleName: string, moduleName: string, upgradeFlag: UpgradeFlag, callback: AsyncCallback) : void; + + /** + * Sets whether to upgrade the module. + * @permission ohos.permission.INSTALL_BUNDLE + * @param { string } bundleName - Indicates the bundle name of the application. + * @param { string } moduleName - Indicates the module name of the application. + * @param { UpgradeFlag } upgradeFlag - Indicates upgradeFlag of the application. + * @returns { Promise } - Return the result of setting module upgrade flag. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 17700001 - The specified bundle name is not found. + * @throws { BusinessError } 17700002 - The specified module name is not found. + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ + function setHapModuleUpgradeFlag(bundleName: string, moduleName: string, upgradeFlag: UpgradeFlag): Promise; + + /** + * Checks whether a specified module is removable. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { string } bundleName - Indicates the bundle name of the application. + * @param { string } moduleName - Indicates the module name of the application. + * @param { AsyncCallback } callback - The callback of checking module removable result.The result is true if the module is removable, false otherwise. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 17700001 - The specified bundle name is not found. + * @throws { BusinessError } 17700002 - The specified module name is not found. + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ + function isHapModuleRemovable(bundleName: string, moduleName: string, callback: AsyncCallback): void; + + /** + * Checks whether a specified module is removable. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { string } bundleName - Indicates the bundle name of the application. + * @param { string } moduleName - Indicates the module name of the application. + * @returns {Promise} Returns true if the module is removable; returns false otherwise. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 17700001 - The specified bundle name is not found. + * @throws { BusinessError } 17700002 - The specified module name is not found. + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ + function isHapModuleRemovable(bundleName: string, moduleName: string): Promise; + + /** + * Obtains bundlePackInfo based on bundleName and bundlePackFlags. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { string } bundleName - Indicates the application bundle name to be queried. + * @param { BundlePackFlag } bundlePackFlag - Indicates the application bundle pack flag to be queried. + * @param { AsyncCallback } callback - The callback of getting the BundlePackInfo object result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 17700001 - The specified bundle name is not found. + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ + function getBundlePackInfo(bundleName: string, bundlePackFlag : BundlePackFlag, callback: AsyncCallback): void; + + /** + * Obtains bundlePackInfo based on bundleName and bundlePackFlags. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { string } bundleName - Indicates the application bundle name to be queried. + * @param { BundlePackFlag } bundlePackFlag - Indicates the application bundle pack flag to be queried. + * @returns {Promise} Returns the BundlePackInfo object. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 17700001 - The specified bundle name is not found. + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ + function getBundlePackInfo(bundleName: string, bundlePackFlag : BundlePackFlag): Promise; + + /** + * Obtains information about the dispatcher version. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { AsyncCallback } callback - The callback of getting the dispatchInfo object for the current ability result. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ + function getDispatchInfo(callback: AsyncCallback): void; + + /** + * Obtains information about the dispatcher version. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @returns { Promise } Returns the DispatchInfo object for the current ability. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ + function getDispatchInfo(): Promise; + + /** + * The dispatch info class. + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ + export type DispatchInfo = _DispatchInfo; + + /** + * The bundle pack info class. + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ + export type BundlePackInfo = _PackInfo.BundlePackInfo; + + /** + * The package info class. + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ + export type PackageConfig = _PackInfo.PackageConfig; + + /** + * The package summary class. + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ + export type PackageSummary = _PackInfo.PackageSummary; + + /** + * The bundle summary class. + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ + export type BundleConfigInfo = _PackInfo.BundleConfigInfo; + + /** + * The extension ability forms class. + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ + export type ExtensionAbility = _PackInfo.ExtensionAbility; + + /** + * The module summary of a bundle. + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ + export type ModuleConfigInfo = _PackInfo.ModuleConfigInfo; + + /** + * The bundle info summary class. + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ + export type ModuleDistroInfo = _PackInfo.ModuleDistroInfo; + + /** + * The ability info of a module. + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ + export type ModuleAbilityInfo = _PackInfo.ModuleAbilityInfo; + + /** + * The form info of an ability. + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ + export type AbilityFormInfo = _PackInfo.AbilityFormInfo; + + /** + * The bundle version class. + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ + export type Version = _PackInfo.Version; + + /** + * The bundle Api version class. + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ + export type ApiVersion = _PackInfo.ApiVersion; +} + +export default freeInstall; diff --git a/api/@ohos.bundle.innerBundleManager.d.ts b/api/@ohos.bundle.innerBundleManager.d.ts index 9eaaeee19f2a5d289681f7acd18a7e9f9bfcc5ee..e979c17a9e1a3f00faf74a615e42c034863cd783 100644 --- a/api/@ohos.bundle.innerBundleManager.d.ts +++ b/api/@ohos.bundle.innerBundleManager.d.ts @@ -13,18 +13,19 @@ * limitations under the License. */ -import { AsyncCallback, Callback } from './basic'; -import { BundleStatusCallback as _BundleStatusCallback } from './bundle/bundleStatusCallback'; -import { LauncherAbilityInfo as _LauncherAbilityInfo } from './bundle/launcherAbilityInfo'; -import * as _ShortCutInfo from './bundle/shortcutInfo'; +import { AsyncCallback } from './basic'; +import { BundleStatusCallback } from './bundle/bundleStatusCallback'; +import { LauncherAbilityInfo } from './bundle/launcherAbilityInfo'; +import { ShortcutInfo } from './bundle/shortcutInfo'; /** * inner bundle manager. * @name innerBundleManager * @since 8 * @syscap SystemCapability.BundleManager.BundleFramework - * @permission NA * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead ohos.bundle.launcherBundleManager */ declare namespace innerBundleManager { @@ -35,9 +36,11 @@ declare namespace innerBundleManager { * @syscap SystemCapability.BundleManager.BundleFramework * @param bundleName Indicates the application bundle name to be queried. * @param userId Indicates the id for the user. - * @return Returns the LauncherAbilityInfo object. + * @returns Returns the LauncherAbilityInfo object. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead ohos.bundle.launcherBundleManager#getLauncherAbilityInfo */ function getLauncherAbilityInfos(bundleName: string, userId: number, callback: AsyncCallback>) : void; function getLauncherAbilityInfos(bundleName: string, userId: number) : Promise>; @@ -49,9 +52,11 @@ declare namespace innerBundleManager { * @syscap SystemCapability.BundleManager.BundleFramework * @param type Indicates the command should be implement. * @param LauncherStatusCallback Indicates the callback to be register. - * @return Returns the result or error maeeage. + * @returns { string | Promise } Returns the result of register. * @permission ohos.permission.LISTEN_BUNDLE_CHANGE * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead ohos.bundle.bundleMonitor#on */ function on(type:"BundleStatusChange", bundleStatusCallback : BundleStatusCallback, callback: AsyncCallback) : void; function on(type:"BundleStatusChange", bundleStatusCallback : BundleStatusCallback): Promise; @@ -62,9 +67,11 @@ declare namespace innerBundleManager { * @since 8 * @syscap SystemCapability.BundleManager.BundleFramework * @param type Indicates the command should be implement. - * @return Returns the result or error maeeage. + * @returns { string | Promise } Returns the result of unregister. * @permission ohos.permission.LISTEN_BUNDLE_CHANGE * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead ohos.bundle.bundleMonitor#off */ function off(type:"BundleStatusChange", callback: AsyncCallback) : void; function off(type:"BundleStatusChange"): Promise; @@ -75,9 +82,11 @@ declare namespace innerBundleManager { * @since 8 * @syscap SystemCapability.BundleManager.BundleFramework * @param userId Indicates the id for the user. - * @return Returns the LauncherAbilityInfo object. + * @returns Returns the LauncherAbilityInfo object. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead ohos.bundle.launcherBundleManager#getAllLauncherAbilityInfos */ function getAllLauncherAbilityInfos(userId: number, callback: AsyncCallback>) : void; function getAllLauncherAbilityInfos(userId: number) : Promise>; @@ -88,48 +97,14 @@ declare namespace innerBundleManager { * @since 8 * @syscap SystemCapability.BundleManager.BundleFramework * @param bundleName Indicates the application bundle name to be queried. - * @return Returns the LauncherShortcutInfo object. + * @returns Returns the LauncherShortcutInfo object. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead ohos.bundle.launcherBundleManager#getShortcutInfo */ function getShortcutInfos(bundleName :string, callback: AsyncCallback>) : void; function getShortcutInfos(bundleName : string) : Promise>; - - /** - * Contains basic launcher Ability information, which uniquely identifies an LauncherAbilityInfo. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @systemapi hide this for inner system use - */ - export type LauncherAbilityInfo = _LauncherAbilityInfo; - - /** - * Contains basic launcher Ability information, which uniquely identifies a launcher StatusCallback. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @systemapi hide this for inner system use - */ - export type BundleStatusCallback = _BundleStatusCallback; - - /** - * Provides information about a shortcut, including the shortcut ID and label. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - export type ShortcutInfo = _ShortCutInfo.ShortcutInfo; - - /** - * Provides methods for obtaining information about the ability that a shortcut will start, including the target - * bundle name, target module name and ability class name. - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @systemapi hide this for inner system use - */ - export type ShortcutWant = _ShortCutInfo.ShortcutWant; } export default innerBundleManager; diff --git a/api/@ohos.bundle.installer.d.ts b/api/@ohos.bundle.installer.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..50cc5f8742ca5684d082ee12936dd98da64a5120 --- /dev/null +++ b/api/@ohos.bundle.installer.d.ts @@ -0,0 +1,179 @@ +/* + * 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'; + +/** + * Support install, upgrade, remove and recover bundles on the devices. + * @namespace installer + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ +declare namespace installer { + /** + * Obtains the interface used to install bundle. + * @param { AsyncCallback } callback - The callback of BundleInstaller object. + * @throws { BusinessError } 401 - Input parameters check failed. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getBundleInstaller(callback: AsyncCallback): void + + /** + * Obtains the interface used to install bundle. + * @param { AsyncCallback } callback - The callback of getting a list of BundleInstaller objects. + * @returns { Promise } BundleInstaller object. + * @throws { BusinessError } 401 - Input parameters check failed. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + function getBundleInstaller(): Promise; + + /** + * Bundle installer interface, include install uninstall recover. + * @interface BundleInstaller + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + interface BundleInstaller { + /** + * Install haps for an application. + * @permission ohos.permission.INSTALL_BUNDLE + * @param { Array } hapFilePaths - Indicates the path where the hap of the application is stored. + * @param { InstallParam } installParam - Indicates other parameters required for the installation. + * @param { AsyncCallback } callback - The callback of installing haps result. + * @throws { BusinessError } 201 - Calling interface without permission 'ohos.permission.INSTALL_BUNDLE'. + * @throws { BusinessError } 401 - Input parameters check failed. + * @throws { BusinessError } 17700004 - The specified user ID is not found. + * @throws { BusinessError } 17700010 - Failed to install the HAP because the HAP fails to be parsed. + * @throws { BusinessError } 17700011 - Failed to install the HAP because the HAP signature fails to be verified. + * @throws { BusinessError } 17700012 - Failed to install the HAP because the HAP path is invalid or the HAP is too large. + * @throws { BusinessError } 17700015 - Failed to install the HAPs because they have different configuration information. + * @throws { BusinessError } 17700016 - Failed to install the HAP because of insufficient system disk space. + * @throws { BusinessError } 17700017 - Failed to install the HAP since the version of the HAP to install is too early. + * @throws { BusinessError } 17700101 - The system service is excepted. + * @throws { BusinessError } 17700103 - I/O operation is failed. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + install(hapFilePaths: Array, installParam: InstallParam, callback: AsyncCallback) : void; + + /** + * Uninstall an application. + * @permission ohos.permission.INSTALL_BUNDLE + * @param { string } bundleName - Indicates the bundle name of the application to be uninstalled. + * @param { InstallParam } installParam - Indicates other parameters required for the uninstall. + * @param { AsyncCallback } callback - The callback of uninstalling application result. + * @throws { BusinessError } 201 - Calling interface without permission 'ohos.permission.INSTALL_BUNDLE'. + * @throws { BusinessError } 401 - Input parameters check failed. + * @throws { BusinessError } 17700004 - The specified user ID is not found. + * @throws { BusinessError } 17700020 - The specified bundle is pre-installed bundle which cannot be uninstalled. + * @throws { BusinessError } 17700101 - The system service is excepted. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + uninstall(bundleName: string, installParam: InstallParam, callback : AsyncCallback) : void; + + /** + * recover an application. + * @permission ohos.permission.INSTALL_BUNDLE + * @param { string } bundleName - Indicates the bundle name of the application to be recovered. + * @param { InstallParam } installParam - Indicates other parameters required for the recover. + * @param { AsyncCallback } callback - The callback of recovering application result. + * @throws { BusinessError } 201 - Calling interface without permission 'ohos.permission.INSTALL_BUNDLE'. + * @throws { BusinessError } 401 - Input parameters check failed. + * @throws { BusinessError } 17700004 - The specified user ID is not found. + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + recover(bundleName: string, installParam: InstallParam, callback: AsyncCallback): void; + } + + /** + * Provides parameters required for hashParam. + * @typedef HashParam + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + export interface HashParam { + /** + * Indicates the moduleName + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + moduleName: string; + + /** + * Indicates the hash value + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + hashValue: string; + } + + /** + * Provides parameters required for installing or uninstalling an application. + * @typedef InstallParam + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + export interface InstallParam { + /** + * Indicates the user id + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + userId: number; + + /** + * Indicates the install flag + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + installFlag: number; + + /** + * Indicates whether the param has data + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + isKeepData: boolean; + + /** + * Indicates the hash params + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + hashParams?: Array; + + /** + * Indicates the deadline of the crowdtesting bundle + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + crowdtestDeadline?: number; + } +} + +export default installer; \ No newline at end of file diff --git a/api/@ohos.bundle.launcherBundleManager.d.ts b/api/@ohos.bundle.launcherBundleManager.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1553297a6ea76ecf005c2bcbff00a95f5dc2b39d --- /dev/null +++ b/api/@ohos.bundle.launcherBundleManager.d.ts @@ -0,0 +1,147 @@ +/* + * 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 { LauncherAbilityInfo as _LauncherAbilityInfo } from './bundleManager/launcherAbilityInfo'; +import { ShortcutInfo as _ShortcutInfo, ShortcutWant as _ShortcutWant} from './bundleManager/shortcutInfo'; + + +/** + * Launcher bundle manager. + * @namespace launcherBundleManager + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @systemapi + * @since 9 + */ +declare namespace launcherBundleManager { + /** + * Obtains launcher abilities info based on a given bundleName and userId. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { string } bundleName - Indicates the application bundle name to be queried. + * @param { number } userId - Indicates the id for the user. + * @param { AsyncCallback> } callback -The callback of the LauncherAbilityInfo object result. + * @throws {BusinessError} 201 - Verify permission denied. + * @throws {BusinessError} 401 - The parameter check failed. + * @throws {BusinessError} 801 - Capability not support. + * @throws {BusinessError} 17700001 - The specified bundle name is not found. + * @throws {BusinessError} 17700004 - The specified user ID is not found. + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @systemapi + * @since 9 + */ + function getLauncherAbilityInfo(bundleName: string, userId: number, callback: AsyncCallback>) : void; + + /** + * Obtains launcher abilities info based on a given bundleName and userId. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { string } bundleName - Indicates the application bundle name to be queried. + * @param { number } userId - Indicates the id for the user. + * @returns { Promise> } the LauncherAbilityInfo object. + * @throws {BusinessError} 201 - Verify permission denied. + * @throws {BusinessError} 401 - The parameter check failed. + * @throws {BusinessError} 801 - Capability not support. + * @throws {BusinessError} 17700001 - The specified bundle name is not found. + * @throws {BusinessError} 17700004 - The specified user ID is not found. + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @systemapi + * @since 9 + */ + function getLauncherAbilityInfo(bundleName: string, userId: number) : Promise>; + + /** + * Obtains launcher abilities info based on a given userId. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { number } userId - Indicates the id for the user. + * @param { AsyncCallback> } callback -The callback of the LauncherAbilityInfo object result. + * @throws {BusinessError} 201 - Verify permission denied. + * @throws {BusinessError} 401 - The parameter check failed. + * @throws {BusinessError} 801 - Capability not support. + * @throws {BusinessError} 17700004 - The specified user ID is not found. + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @systemapi + * @since 9 + */ + function getAllLauncherAbilityInfo(userId: number, callback: AsyncCallback>) : void; + + /** + * Obtains launcher abilities info based on a given userId. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { number } userId - Indicates the id for the user. + * @returns { Promise> } the LauncherAbilityInfo object. + * @throws {BusinessError} 201 - Verify permission denied. + * @throws {BusinessError} 401 - The parameter check failed. + * @throws {BusinessError} 801 - Capability not support. + * @throws {BusinessError} 17700004 - The specified user ID is not found. + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @systemapi + * @since 9 + */ + function getAllLauncherAbilityInfo(userId: number) : Promise>; + + /** + * Obtains shortcut info based on a given bundleName. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { string } bundleName - Indicates the application bundle name to be queried. + * @param { AsyncCallback> } callback -The callback of the ShortcutInfo object result. + * @throws {BusinessError} 201 - Verify permission denied. + * @throws {BusinessError} 401 - The parameter check failed. + * @throws {BusinessError} 801 - Capability not support. + * @throws {BusinessError} 17700001 - The specified bundle name is not found. + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @systemapi + * @since 9 + */ + function getShortcutInfo(bundleName :string, callback: AsyncCallback>) : void; + + /** + * Obtains shortcut info based on a given bundleName. + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { string } bundleName - Indicates the application bundle name to be queried. + * @returns { Promise> } the LauncherShortcutInfo object. + * @throws {BusinessError} 201 - Verify permission denied. + * @throws {BusinessError} 401 - The parameter check failed. + * @throws {BusinessError} 801 - Capability not support. + * @throws {BusinessError} 17700001 - The specified bundle name is not found. + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @systemapi + * @since 9 + */ + function getShortcutInfo(bundleName : string) : Promise>; + + /** + * Contains basic launcher Ability information, which uniquely identifies an LauncherAbilityInfo. + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @systemapi + * @since 9 + */ + export type LauncherAbilityInfo = _LauncherAbilityInfo; + + /** + * Provides information about a shortcut, including the shortcut ID and label. + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @systemapi + * @since 9 + */ + export type ShortcutInfo = _ShortcutInfo; + /** + * Obtains information about the ability that a shortcut will start. + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @systemapi + * @since 9 + */ + export type ShortcutWant = _ShortcutWant; +} + +export default launcherBundleManager; diff --git a/api/@ohos.bundleState.d.ts b/api/@ohos.bundleState.d.ts index 01d6f4c8e3322bd595fcf63efc3f3bf43eb3033a..b2539343d27555c39858a623dd9f5f87021b081a 100644 --- a/api/@ohos.bundleState.d.ts +++ b/api/@ohos.bundleState.d.ts @@ -25,53 +25,57 @@ import { AsyncCallback , Callback} from './basic'; * then returns it to you. * * @since 7 + * @deprecated since 9 + * @useinstead ohos.resourceschedule.usageStatistics */ declare namespace bundleState { /** * @since 7 * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @deprecated since 9 + * @useinstead ohos.resourceschedule.usageStatistics.BundleStatsInfo */ interface BundleStateInfo { /** - * the identifier of BundleStateInfo. + * The identifier of BundleStateInfo. */ id: number; /** - * the total duration, in milliseconds. + * The total duration, in milliseconds. */ abilityInFgTotalTime?: number; /** - * the last time when the application was accessed, in milliseconds. + * The last time when the application was accessed, in milliseconds. */ abilityPrevAccessTime?: number; /** - * the last time when the application was visible in the foreground, in milliseconds. + * The last time when the application was visible in the foreground, in milliseconds. */ abilityPrevSeenTime?: number; /** - * the total duration, in milliseconds. + * The total duration, in milliseconds. */ abilitySeenTotalTime?: number; /** - * the bundle name of the application. + * The bundle name of the application. */ bundleName?: string; /** - * the total duration, in milliseconds. + * The total duration, in milliseconds. */ fgAbilityAccessTotalTime?: number; /** - * the last time when the foreground application was accessed, in milliseconds. + * The last time when the foreground application was accessed, in milliseconds. */ fgAbilityPrevAccessTime?: number; /** - * the time of the first bundle usage record in this {@code BundleActiveInfo} object, + * The time of the first bundle usage record in this {@code BundleActiveInfo} object, * in milliseconds. */ infosBeginTime?: number; /** - * the time of the last bundle usage record in this {@code BundleActiveInfo} object, + * The time of the last bundle usage record in this {@code BundleActiveInfo} object, * in milliseconds. */ infosEndTime?: number; @@ -83,178 +87,43 @@ declare namespace bundleState { * @since 7 * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App * @param toMerge Indicates the {@link BundleActiveInfo} object to merge. - * if the bundle names of the two {@link BundleActiveInfo} objects are different. + * If the bundle names of the two {@link BundleActiveInfo} objects are different. */ merge(toMerge: BundleStateInfo): void; } - /** - * @since 9 - * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App - * @systemapi Hide this for inner system use. - */ - interface BundleActiveFormInfo { - /** - * the form name. - */ - formName: string; - /** - * the form dimension. - */ - formDimension: number; - /** - * the form id. - */ - formId: number; - /** - * the last time when the form was accessed, in milliseconds.. - */ - formLastUsedTime: number; - /** - * the click count of module. - */ - count: number; - } - - /** - * @since 9 - * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App - * @systemapi Hide this for inner system use. - */ - interface BundleActiveModuleInfo { - /** - * the device id of module. - */ - deviceId?: string; - /** - * the bundle name. - */ - bundleName: string; - /** - * the module name. - */ - moduleName: string; - /** - * the main ability name of module. - */ - abilityName?: string; - /** - * the label id of application. - */ - appLabelId?: number; - /** - * the label id of module. - */ - labelId?: number; - /** - * the description id of application. - */ - descriptionId?: number; - /** - * the ability id of main ability. - */ - abilityLableId?: number; - /** - * the description id of main ability. - */ - abilityDescriptionId?: number; - /** - * the icon id of main ability. - */ - abilityIconId?: number; - /** - * the launch count of module. - */ - launchedCount: number; - /** - * the last time when the module was accessed, in milliseconds. - */ - lastModuleUsedTime: number; - /** - * the form usage record list of current module. - */ - formRecords: Array; - } - - /** - * @since 9 - * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App - * @systemapi Hide this for inner system use. - */ - interface BundleActiveEventState { - /** - * the bundle name or system event name. - */ - name: string; - - /** - * the event id. - */ - eventId: number; - - /** - * the the event occurrence number. - */ - count: number; - } - /** * @since 7 * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @deprecated since 9 + * @useinstead ohos.resourceschedule.usageStatistics.BundleEvents */ interface BundleActiveState { /** - * the usage priority group of the application. + * The usage priority group of the application. */ appUsagePriorityGroup?: number; /** - * the bundle name. + * The bundle name. */ bundleName?: string; /** - * the shortcut ID. + * The shortcut ID. */ indexOfLink?: string; /** - * the class name. + * The class name. */ nameOfClass?: string; /** - * the time when this state occurred, in milliseconds. + * The time when this state occurred, in milliseconds. */ stateOccurredTime?: number; /** - * the state type. + * The state type. */ stateType?: number; } - /** - * @since 9 - * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup - * @systemapi Hide this for inner system use. - */ - interface BundleActiveGroupCallbackInfo { - /* - * the usage old group of the application - */ - appUsageOldGroup: number; - /* - * the usage new group of the application - */ - appUsageNewGroup: number; - /* - * the use id - */ - userId: number; - /* - * the change reason - */ - changeReason: number; - /* - * the bundle name - */ - bundleName: string; - } /** * Checks whether the application with a specified bundle name is in the idle state. @@ -265,6 +134,8 @@ declare namespace bundleState { * @return Returns {@code true} if the application is idle in a particular period; * returns {@code false} otherwise. The time range of the particular period is defined by the system, * which may be hours or days. + * @deprecated since 9 + * @useinstead ohos.resourceschedule.usageStatistics.isIdleState */ function isIdleState(bundleName: string, callback: AsyncCallback): void; function isIdleState(bundleName: string): Promise; @@ -278,6 +149,8 @@ declare namespace bundleState { * @since 7 * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup * @return Returns the usage priority group of the calling application. + * @deprecated since 9 + * @useinstead ohos.resourceschedule.usageStatistics.queryAppGroup */ function queryAppUsagePriorityGroup(callback: AsyncCallback): void; function queryAppUsagePriorityGroup(): Promise; @@ -285,6 +158,8 @@ declare namespace bundleState { /** * @since 7 * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @deprecated since 9 + * @useinstead ohos.resourceschedule.usageStatistics.BundleStatsMap */ interface BundleActiveInfoResponse { [key: string]: BundleStateInfo; @@ -302,6 +177,8 @@ declare namespace bundleState { * @param begin Indicates the start time of the query period, in milliseconds. * @param end Indicates the end time of the query period, in milliseconds. * @return Returns the {@link BundleActiveInfoResponse} objects containing the usage information about each bundle. + * @deprecated since 9 + * @useinstead ohos.resourceschedule.usageStatistics.queryBundleStatsInfos */ function queryBundleStateInfos(begin: number, end: number, callback: AsyncCallback): void; function queryBundleStateInfos(begin: number, end: number): Promise; @@ -311,6 +188,8 @@ declare namespace bundleState { * * @since 7 * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @deprecated since 9 + * @useinstead ohos.resourceschedule.usageStatistics.IntervalType */ export enum IntervalType { /** @@ -352,6 +231,8 @@ declare namespace bundleState { * @param begin Indicates the start time of the query period, in milliseconds. * @param end Indicates the end time of the query period, in milliseconds. * @return Returns the list of {@link BundleStateInfo} objects containing the usage information about each bundle. + * @deprecated since 9 + * @useinstead ohos.resourceschedule.usageStatistics.queryBundleStatsInfoByInterval */ function queryBundleStateInfoByInterval(byInterval: IntervalType, begin: number, end: number, callback: AsyncCallback>): void; function queryBundleStateInfoByInterval(byInterval: IntervalType, begin: number, end: number): Promise>; @@ -366,6 +247,8 @@ declare namespace bundleState { * @param begin Indicates the start time of the query period, in milliseconds. * @param end Indicates the end time of the query period, in milliseconds. * @return Returns the list of {@link BundleActiveState} objects containing the state data of all bundles. + * @deprecated since 9 + * @useinstead ohos.resourceschedule.usageStatistics.queryBundleEvents */ function queryBundleActiveStates(begin: number, end: number, callback: AsyncCallback>): void; function queryBundleActiveStates(begin: number, end: number): Promise>; @@ -378,146 +261,11 @@ declare namespace bundleState { * @param begin Indicates the start time of the query period, in milliseconds. * @param end Indicates the end time of the query period, in milliseconds. * @return Returns the {@link BundleActiveState} object Array containing the state data of the current bundle. + * @deprecated since 9 + * @useinstead ohos.resourceschedule.usageStatistics.queryCurrentBundleEvents */ function queryCurrentBundleActiveStates(begin: number, end: number, callback: AsyncCallback>): void; function queryCurrentBundleActiveStates(begin: number, end: number): Promise>; - - /** - * Queries recently module usage records. - * - * @since 9 - * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App - * @permission ohos.permission.BUNDLE_ACTIVE_INFO - * @systemapi Hide this for inner system use. - * @param maxNum Indicates max record number in result, max value is 1000, default value is 1000. - * @return Returns the {@link BundleActiveModuleInfo} object Array containing the usage data of the modules. - */ - function getRecentlyUsedModules(callback: AsyncCallback>): void; - function getRecentlyUsedModules(maxNum: number, callback: AsyncCallback>): void; - function getRecentlyUsedModules(maxNum?: number): Promise>; - - /** - * Queries the usage priority group of the calling application. - * - *

          The priority defined in a priority group restricts the resource usage of an application, - * for example, restricting the running of background tasks.

          - * - * @since 9 - * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup - * @permission ohos.permission.BUNDLE_ACTIVE_INFO - * @systemapi Hide this for inner system use. - * @param bundleName, name of the application. - * @return Returns the usage priority group of the calling application. - */ - function queryAppUsagePriorityGroup(callback: AsyncCallback): void; - function queryAppUsagePriorityGroup(bundleName: string, callback: AsyncCallback): void; - function queryAppUsagePriorityGroup(bundleName?: string): Promise; - - /** - * Declares group type. - * - * @since 9 - * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup - * @systemapi Hide this for inner system use. - */ - export enum GroupType { - /** - * Indicates the alive group. - */ - ACTIVE_GROUP_ALIVE = 10, - - /** - * Indicates the daily group. - */ - ACTIVE_GROUP_DAILY = 20, - - /** - * Indicates the fixed group. - */ - ACTIVE_GROUP_FIXED = 30, - - /** - * Indicates the rare group. - */ - ACTIVE_GROUP_RARE = 40, - - /** - * Indicates the limit group. - */ - ACTIVE_GROUP_LIMIT = 50, - - /** - * Indicates the never group. - */ - ACTIVE_GROUP_NEVER = 60 - } - - /** - * set bundle group by bundleName and number. - * - * @since 9 - * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup - * @permission ohos.permission.BUNDLE_ACTIVE_INFO - * @systemapi Hide this for inner system use. - * @param bundleName, name of the application. - * @param newGroup,the group of the application whose name is bundleName. - * @return Returns the result of setBundleGroup, true of false. - */ - function setBundleGroup(bundleName: string, newGroup: GroupType, callback: AsyncCallback): void; - function setBundleGroup(bundleName: string, newGroup: GroupType): Promise; - - /** - * register callback to service. - * - * @since 9 - * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup - * @permission ohos.permission.BUNDLE_ACTIVE_INFO - * @systemapi Hide this for inner system use. - * @param Callback, callback when application group change,return the BundleActiveGroupCallbackInfo. - * @return Returns BundleActiveGroupCallbackInfo when the group of bundle changed. the result of AsyncCallback is true or false. - */ - function registerGroupCallBack(groupCallback: Callback, callback: AsyncCallback): void; - function registerGroupCallBack(groupCallback: Callback): Promise; - - /** - * unRegister callback from service. - * - * @since 9 - * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup - * @permission ohos.permission.BUNDLE_ACTIVE_INFO - * @systemapi Hide this for inner system use. - * @return Returns the result of unRegisterGroupCallBack, true of false. - */ - function unRegisterGroupCallBack(callback: AsyncCallback): void; - function unRegisterGroupCallBack(): Promise; - - /* - * Queries system event states data within a specified period identified by the start and end time. - * - * @since 9 - * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App - * @permission ohos.permission.BUNDLE_ACTIVE_INFO - * @systemapi Hide this for inner system use. - * @param begin Indicates the start time of the query period, in milliseconds. - * @param end Indicates the end time of the query period, in milliseconds. - * @return Returns the {@link BundleActiveEventState} object Array containing the event states data. - */ - function queryBundleActiveEventStates(begin: number, end: number, callback: AsyncCallback>): void; - function queryBundleActiveEventStates(begin: number, end: number): Promise>; - - /** - * Queries app notification number within a specified period identified by the start and end time. - * - * @since 9 - * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App - * @permission ohos.permission.BUNDLE_ACTIVE_INFO - * @systemapi Hide this for inner system use. - * @param begin Indicates the start time of the query period, in milliseconds. - * @param end Indicates the end time of the query period, in milliseconds. - * @return Returns the {@link BundleActiveEventState} object Array containing the event states data. - */ - function queryAppNotificationNumber(begin: number, end: number, callback: AsyncCallback>): void; - function queryAppNotificationNumber(begin: number, end: number): Promise>; } export default bundleState; diff --git a/api/@ohos.bytrace.d.ts b/api/@ohos.bytrace.d.ts index e1b5a1ccad9e88567a91a9438207dc6e36b2620f..b2ee906edc823f2dd8d229ec3af0714dd7327fad 100644 --- a/api/@ohos.bytrace.d.ts +++ b/api/@ohos.bytrace.d.ts @@ -65,8 +65,8 @@ declare namespace bytrace { * @deprecated * @since 7 * @syscap SystemCapability.HiviewDFX.HiTrace - * @param name Indicates the task name. It must be the same whith the {@code name} of startTrace. - * @param taskId The unique id used to distinguish the tasks and must be the same whith the . + * @param name Indicates the task name. It must be the same with the {@code name} of startTrace. + * @param taskId The unique id used to distinguish the tasks and must be the same with the . * {@code taskId} of startTrace. */ function finishTrace(name: string, taskId: number): void; diff --git a/api/@ohos.commonEvent.d.ts b/api/@ohos.commonEvent.d.ts index 9920b8afb02338fc755799dc6f077589e559eb64..2ca7d7d8f6f40e632e7f54fc98a349b746761d45 100644 --- a/api/@ohos.commonEvent.d.ts +++ b/api/@ohos.commonEvent.d.ts @@ -20,7 +20,7 @@ import { CommonEventSubscribeInfo } from './commonEvent/commonEventSubscribeInfo import { CommonEventPublishData } from './commonEvent/commonEventPublishData'; /** - * Common event defination + * Common event definition * @name commonEvent * @since 7 * @syscap SystemCapability.Notification.CommonEvent @@ -142,156 +142,156 @@ declare namespace commonEvent { */ export enum Support { /** - * this commonEvent means when the device is booted or system upgrade completed, and only be sent by system. + * This commonEvent means when the device is booted or system upgrade completed, and only be sent by system. */ COMMON_EVENT_BOOT_COMPLETED = "usual.event.BOOT_COMPLETED", /** - * this commonEvent means when the device finnish booting, but still in the locked state. + * This commonEvent means when the device finnish booting, but still in the locked state. */ COMMON_EVENT_LOCKED_BOOT_COMPLETED = "usual.event.LOCKED_BOOT_COMPLETED", /** - * this commonEvent means when the device is shutting down, note: turn off, not sleeping. + * This commonEvent means when the device is shutting down, note: turn off, not sleeping. */ COMMON_EVENT_SHUTDOWN = "usual.event.SHUTDOWN", /** - * this commonEvent means when the charging state, level and so on about the battery. + * This commonEvent means when the charging state, level and so on about the battery. */ COMMON_EVENT_BATTERY_CHANGED = "usual.event.BATTERY_CHANGED", /** - * this commonEvent means when the device in low battery state.. + * This commonEvent means when the device in low battery state.. */ COMMON_EVENT_BATTERY_LOW = "usual.event.BATTERY_LOW", /** - * this commonEvent means when the battery level is an ok state. + * This commonEvent means when the battery level is an ok state. */ COMMON_EVENT_BATTERY_OKAY = "usual.event.BATTERY_OKAY", /** - * this commonEvent means when the other power is connected to the device. + * This commonEvent means when the other power is connected to the device. */ COMMON_EVENT_POWER_CONNECTED = "usual.event.POWER_CONNECTED", /** - * this commonEvent means when the other power is removed from the device. + * This commonEvent means when the other power is removed from the device. */ COMMON_EVENT_POWER_DISCONNECTED = "usual.event.POWER_DISCONNECTED", /** - * this commonEvent means when the screen is turned off. + * This commonEvent means when the screen is turned off. */ COMMON_EVENT_SCREEN_OFF = "usual.event.SCREEN_OFF", /** - * this commonEvent means when the device is waked up and interactive. + * This commonEvent means when the device is awakened and interactive. */ COMMON_EVENT_SCREEN_ON = "usual.event.SCREEN_ON", /** - * this commonEvent means when the thermal state level change + * This commonEvent means when the thermal state level change * @since 8 */ COMMON_EVENT_THERMAL_LEVEL_CHANGED = "usual.event.THERMAL_LEVEL_CHANGED", /** - * this commonEvent means when the user is present after the device waked up. + * This commonEvent means when the user is present after the device is awakened. */ COMMON_EVENT_USER_PRESENT = "usual.event.USER_PRESENT", /** - * this commonEvent means when the current time is changed. + * This commonEvent means when the current time is changed. */ COMMON_EVENT_TIME_TICK = "usual.event.TIME_TICK", /** - * this commonEvent means when the time is set. + * This commonEvent means when the time is set. */ COMMON_EVENT_TIME_CHANGED = "usual.event.TIME_CHANGED", /** - * this commonEvent means when the current date is changed. + * This commonEvent means when the current date is changed. */ COMMON_EVENT_DATE_CHANGED = "usual.event.DATE_CHANGED", /** - * this commonEvent means when the time zone is changed. + * This commonEvent means when the time zone is changed. */ COMMON_EVENT_TIMEZONE_CHANGED = "usual.event.TIMEZONE_CHANGED", /** - * this commonEvent means when the dialog to dismiss. + * This commonEvent means when the dialog to dismiss. */ COMMON_EVENT_CLOSE_SYSTEM_DIALOGS = "usual.event.CLOSE_SYSTEM_DIALOGS", /** - * this commonEvent means when a new application package is installed on the device. + * This commonEvent means when a new application package is installed on the device. */ COMMON_EVENT_PACKAGE_ADDED = "usual.event.PACKAGE_ADDED", /** - * this commonEvent means when a new version application package is installed on the device and + * This commonEvent means when a new version application package is installed on the device and * replace the old version.the data contains the name of the package. */ COMMON_EVENT_PACKAGE_REPLACED = "usual.event.PACKAGE_REPLACED", /** - * this commonEvent means when a new version application package is installed on the device and + * This commonEvent means when a new version application package is installed on the device and * replace the old version, it does not contain additional data and only be sent to the replaced application. */ COMMON_EVENT_MY_PACKAGE_REPLACED = "usual.event.MY_PACKAGE_REPLACED", /** - * this commonEvent means when an existing application package is removed from the device. + * This commonEvent means when an existing application package is removed from the device. */ COMMON_EVENT_PACKAGE_REMOVED = "usual.event.PACKAGE_REMOVED", /** - * this commonEvent means when an existing application package is removed from the device. + * This commonEvent means when an existing application package is removed from the device. */ COMMON_EVENT_BUNDLE_REMOVED = "usual.event.BUNDLE_REMOVED", /** - * this commonEvent means when an existing application package is completely removed from the device. + * This commonEvent means when an existing application package is completely removed from the device. */ COMMON_EVENT_PACKAGE_FULLY_REMOVED = "usual.event.PACKAGE_FULLY_REMOVED", /** - * this commonEvent means when an existing application package has been changed. + * This commonEvent means when an existing application package has been changed. */ COMMON_EVENT_PACKAGE_CHANGED = "usual.event.PACKAGE_CHANGED", /** - * this commonEvent means the user has restarted a package, and all of its processes have been killed. + * This commonEvent means the user has restarted a package, and all of its processes have been killed. */ COMMON_EVENT_PACKAGE_RESTARTED = "usual.event.PACKAGE_RESTARTED", /** - * this commonEvent means the user has cleared the package data. + * This commonEvent means the user has cleared the package data. */ COMMON_EVENT_PACKAGE_DATA_CLEARED = "usual.event.PACKAGE_DATA_CLEARED", /** - * this commonEvent means the user has cleared the package cache. + * This commonEvent means the user has cleared the package cache. * @since 9 */ COMMON_EVENT_PACKAGE_CACHE_CLEARED = "usual.event.PACKAGE_CACHE_CLEARED", /** - * this commonEvent means the packages have been suspended. + * This commonEvent means the packages have been suspended. */ COMMON_EVENT_PACKAGES_SUSPENDED = "usual.event.PACKAGES_SUSPENDED", /** - * this commonEvent means the packages have been un-suspended. + * This commonEvent means the packages have been un-suspended. */ COMMON_EVENT_PACKAGES_UNSUSPENDED = "usual.event.PACKAGES_UNSUSPENDED", /** - * this commonEvent Sent to a package that has been suspended by the system. + * This commonEvent Sent to a package that has been suspended by the system. */ COMMON_EVENT_MY_PACKAGE_SUSPENDED = "usual.event.MY_PACKAGE_SUSPENDED", @@ -301,23 +301,23 @@ declare namespace commonEvent { COMMON_EVENT_MY_PACKAGE_UNSUSPENDED = "usual.event.MY_PACKAGE_UNSUSPENDED", /** - * a user id has been removed from the system. + * A user id has been removed from the system. */ COMMON_EVENT_UID_REMOVED = "usual.event.UID_REMOVED", /** - * the application is first launched after installed. + * The application is first launched after installed. */ COMMON_EVENT_PACKAGE_FIRST_LAUNCH = "usual.event.PACKAGE_FIRST_LAUNCH", /** - * sent by system package verifier when a package need to be verified. + * Sent by system package verifier when a package need to be verified. */ COMMON_EVENT_PACKAGE_NEEDS_VERIFICATION = "usual.event.PACKAGE_NEEDS_VERIFICATION", /** - * sent by system package verifier when a package is verified. + * Sent by system package verifier when a package is verified. */ COMMON_EVENT_PACKAGE_VERIFIED = "usual.event.PACKAGE_VERIFIED", @@ -335,7 +335,7 @@ declare namespace commonEvent { "usual.event.EXTERNAL_APPLICATIONS_UNAVAILABLE", /** - * the device configuration such as orientation,locale have been changed. + * The device configuration such as orientation,locale have been changed. */ COMMON_EVENT_CONFIGURATION_CHANGED = "usual.event.CONFIGURATION_CHANGED", @@ -350,57 +350,57 @@ declare namespace commonEvent { COMMON_EVENT_MANAGE_PACKAGE_STORAGE = "usual.event.MANAGE_PACKAGE_STORAGE", /** - * sent by the smart function when the system in drive mode. + * Sent by the smart function when the system in drive mode. */ COMMON_EVENT_DRIVE_MODE = "common.event.DRIVE_MODE", /** - * sent by the smart function when the system in home mode. + * Sent by the smart function when the system in home mode. */ COMMON_EVENT_HOME_MODE = "common.event.HOME_MODE", /** - * sent by the smart function when the system in office mode. + * Sent by the smart function when the system in office mode. */ COMMON_EVENT_OFFICE_MODE = "common.event.OFFICE_MODE", /** - * remind new user of preparing to start. + * Remind new user of preparing to start. */ COMMON_EVENT_USER_STARTED = "usual.event.USER_STARTED", /** - * remind previous user of that the service has been the background. + * Remind previous user of that the service has been the background. */ COMMON_EVENT_USER_BACKGROUND = "usual.event.USER_BACKGROUND", /** - * remind new user of that the service has been the foreground. + * Remind new user of that the service has been the foreground. */ COMMON_EVENT_USER_FOREGROUND = "usual.event.USER_FOREGROUND", /** - * remind new user of that the service has been switched to new user. + * Remind new user of that the service has been switched to new user. */ COMMON_EVENT_USER_SWITCHED = "usual.event.USER_SWITCHED", /** - * remind new user of that the service has been starting. + * Remind new user of that the service has been starting. */ COMMON_EVENT_USER_STARTING = "usual.event.USER_STARTING", /** - * remind new user of that the service has been unlocked. + * Remind new user of that the service has been unlocked. */ COMMON_EVENT_USER_UNLOCKED = "usual.event.USER_UNLOCKED", /** - * remind new user of that the service has been stopping. + * Remind new user of that the service has been stopping. */ COMMON_EVENT_USER_STOPPING = "usual.event.USER_STOPPING", /** - * remind new user of that the service has stopped. + * Remind new user of that the service has stopped. */ COMMON_EVENT_USER_STOPPED = "usual.event.USER_STOPPED", @@ -465,7 +465,7 @@ declare namespace commonEvent { COMMON_EVENT_WIFI_MPLINK_STATE_CHANGE = "usual.event.wifi.mplink.STATE_CHANGE", /** - * Indicates Wi-Fi P2P connection state notification acknowledged by connecting or disconnecting P2P. + * Indicates Wi-Fi P2P connection state notification acknowledged by connecting or disconnected P2P. */ COMMON_EVENT_WIFI_P2P_CONN_STATE = "usual.event.wifi.p2p.CONN_STATE_CHANGE", @@ -720,19 +720,19 @@ declare namespace commonEvent { "usual.event.bluetooth.a2dpsink.AUDIO_STATE_UPDATE", /** - * nfc state change. + * Nfc state change. */ COMMON_EVENT_NFC_ACTION_ADAPTER_STATE_CHANGED = "usual.event.nfc.action.ADAPTER_STATE_CHANGED", /** - * nfc field on detected. + * Nfc field on detected. */ COMMON_EVENT_NFC_ACTION_RF_FIELD_ON_DETECTED = "usual.event.nfc.action.RF_FIELD_ON_DETECTED", /** - * nfc field off detected. + * Nfc field off detected. */ COMMON_EVENT_NFC_ACTION_RF_FIELD_OFF_DETECTED = "usual.event.nfc.action.RF_FIELD_OFF_DETECTED", @@ -758,12 +758,12 @@ declare namespace commonEvent { COMMON_EVENT_POWER_SAVE_MODE_CHANGED = "usual.event.POWER_SAVE_MODE_CHANGED", /** - * user added. + * User added. */ COMMON_EVENT_USER_ADDED = "usual.event.USER_ADDED", /** - * user removed. + * User removed. */ COMMON_EVENT_USER_REMOVED = "usual.event.USER_REMOVED", @@ -783,7 +783,7 @@ declare namespace commonEvent { COMMON_EVENT_ABILITY_UPDATED = "common.event.ABILITY_UPDATED", /** - * gps mode state changed. + * Gps mode state changed. */ COMMON_EVENT_LOCATION_MODE_STATE_CHANGED = "usual.event.location.MODE_STATE_CHANGED", diff --git a/api/@ohos.commonEventManager.d.ts b/api/@ohos.commonEventManager.d.ts index c327741a045d984d5ae9e1777110ef0532cd32c4..1cafa28a65b658a84267f0b4e6116994b890a7de 100644 --- a/api/@ohos.commonEventManager.d.ts +++ b/api/@ohos.commonEventManager.d.ts @@ -165,7 +165,7 @@ declare namespace commonEventManager { COMMON_EVENT_SCREEN_OFF = "usual.event.SCREEN_OFF", /** - * This commonEvent means when the device is waked up and interactive. + * This commonEvent means when the device is awakened and interactive. */ COMMON_EVENT_SCREEN_ON = "usual.event.SCREEN_ON", @@ -175,7 +175,7 @@ declare namespace commonEventManager { COMMON_EVENT_THERMAL_LEVEL_CHANGED = "usual.event.THERMAL_LEVEL_CHANGED", /** - * This commonEvent means when the user is present after the device waked up. + * This commonEvent means when the user is present after the device is awakened. */ COMMON_EVENT_USER_PRESENT = "usual.event.USER_PRESENT", @@ -441,7 +441,7 @@ declare namespace commonEventManager { COMMON_EVENT_WIFI_MPLINK_STATE_CHANGE = "usual.event.wifi.mplink.STATE_CHANGE", /** - * Indicates Wi-Fi P2P connection state notification acknowledged by connecting or disconnecting P2P. + * Indicates Wi-Fi P2P connection state notification acknowledged by connecting or disconnected P2P. */ COMMON_EVENT_WIFI_P2P_CONN_STATE = "usual.event.wifi.p2p.CONN_STATE_CHANGE", diff --git a/api/@ohos.configPolicy.d.ts b/api/@ohos.configPolicy.d.ts index c7f19d5baadcf7a75f0b57f262411ca224a1c8f1..f7dc969833d3f52cf1a85fc1d9932409f9b3bb10 100644 --- a/api/@ohos.configPolicy.d.ts +++ b/api/@ohos.configPolicy.d.ts @@ -30,7 +30,7 @@ declare namespace configPolicy { * @systemapi Hide this for inner system use. * @syscap SystemCapability.Customization.ConfigPolicy * @param relPath the relative path of the config file. - * @return Returns the path of the highest priority config file. + * @returns Returns the path of the highest priority config file. * @throws { BusinessError } 401 - invalid input parameter. */ function getOneCfgFile(relPath: string, callback: AsyncCallback); @@ -43,7 +43,7 @@ declare namespace configPolicy { * @systemapi Hide this for inner system use. * @syscap SystemCapability.Customization.ConfigPolicy * @param relPath the relative path of the config file. - * @return Returns paths of config files. + * @returns Returns paths of config files. * @throws { BusinessError } 401 - invalid input parameter. */ function getCfgFiles(relPath: string, callback: AsyncCallback>); @@ -55,7 +55,7 @@ declare namespace configPolicy { * @since 8 * @systemapi Hide this for inner system use. * @syscap SystemCapability.Customization.ConfigPolicy - * @return Returns paths of config directories. + * @returns Returns paths of config directories. * @throws { BusinessError } 401 - invalid input parameter. */ function getCfgDirList(callback: AsyncCallback>); diff --git a/api/@ohos.continuation.continuationManager.d.ts b/api/@ohos.continuation.continuationManager.d.ts index 9b9cbe3304f0a6cb9c9992cb469fbeee138e1a42..83959c0e5b323795f0d3bedf9adf8807f55de0e4 100644 --- a/api/@ohos.continuation.continuationManager.d.ts +++ b/api/@ohos.continuation.continuationManager.d.ts @@ -19,7 +19,7 @@ import { ContinuationExtraParams } from './continuation/continuationExtraParams' /** * Provides methods for interacting with the continuation manager service, including methods for registering and - * unregistering the ability to hop, updating the device connection state, and showing the list of devices + * Unregister the ability to hop, updating the device connection state, and showing the list of devices * that can be selected for hopping. * @namespace continuationManager * @syscap SystemCapability.Ability.DistributedAbilityManager @@ -30,8 +30,10 @@ declare namespace continuationManager { * Called when the user selects devices from the candidate device list. * You can implement your own processing logic in this callback to initiate the hop process. * - * @param type deviceConnect. + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param type deviceSelected. * @return callback Indicates the information about the selected devices. + * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 401 - The parameter check failed. * @throws { BusinessError } 16600001 - The system ability work abnormally. * @throws { BusinessError } 16600002 - The specified token or callback has not registered. @@ -39,15 +41,17 @@ declare namespace continuationManager { * @syscap SystemCapability.Ability.DistributedAbilityManager * @since 9 */ - function on(type: "deviceConnect", token: number, callback: Callback>): void; - function off(type: "deviceConnect", token: number): void; + function on(type: "deviceSelected", token: number, callback: Callback>): void; + function off(type: "deviceSelected", token: number): void; /** * Called when devices are disconnected from the continuation manager service. * You can implement your own processing logic in this callback, such as notifying the user of the disconnection. * - * @param type deviceDisconnect. - * @return callback Indicates the ID of the disconnected devices. + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param type deviceUnselected. + * @return callback Indicates the information about the unselected devices. + * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 401 - The parameter check failed. * @throws { BusinessError } 16600001 - The system ability work abnormally. * @throws { BusinessError } 16600002 - The specified token or callback has not registered. @@ -55,8 +59,8 @@ declare namespace continuationManager { * @syscap SystemCapability.Ability.DistributedAbilityManager * @since 9 */ - function on(type: "deviceDisconnect", token: number, callback: Callback>): void; - function off(type: "deviceDisconnect", token: number): void; + function on(type: "deviceUnselected", token: number, callback: Callback>): void; + function off(type: "deviceUnselected", token: number): void; /** * Called when the user selects a device from the candidate device list. @@ -67,6 +71,7 @@ declare namespace continuationManager { * @syscap SystemCapability.Ability.DistributedAbilityManager * @since 8 * @deprecated since 9 + * @useinstead ohos.continuation.continuationManager.continuationManager#on/off(type: "deviceSelected") */ function on(type: "deviceConnect", callback: Callback): void; function off(type: "deviceConnect", callback?: Callback): void; @@ -80,6 +85,7 @@ declare namespace continuationManager { * @syscap SystemCapability.Ability.DistributedAbilityManager * @since 8 * @deprecated since 9 + * @useinstead ohos.continuation.continuationManager.continuationManager#on/off(type: "deviceUnSelected") */ function on(type: "deviceDisconnect", callback: Callback): void; function off(type: "deviceDisconnect", callback?: Callback): void; @@ -94,7 +100,7 @@ declare namespace continuationManager { * @syscap SystemCapability.Ability.DistributedAbilityManager * @since 8 * @deprecated since 9 - * @useinstead ohos.continuation.continuationManager.registerContinuation + * @useinstead ohos.continuation.continuationManager.continuationManager#registerContinuation */ function register(callback: AsyncCallback): void; function register(options: ContinuationExtraParams, callback: AsyncCallback): void; @@ -109,7 +115,7 @@ declare namespace continuationManager { * @syscap SystemCapability.Ability.DistributedAbilityManager * @since 8 * @deprecated since 9 - * @useinstead ohos.continuation.continuationManager.unregisterContinuation + * @useinstead ohos.continuation.continuationManager.continuationManager#unregisterContinuation */ function unregister(token: number, callback: AsyncCallback): void; function unregister(token: number): Promise; @@ -124,7 +130,7 @@ declare namespace continuationManager { * @syscap SystemCapability.Ability.DistributedAbilityManager * @since 8 * @deprecated since 9 - * @useinstead ohos.continuation.continuationManager.updateContinuationState + * @useinstead ohos.continuation.continuationManager.continuationManager#updateContinuationState */ function updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState, callback: AsyncCallback): void; function updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState): Promise; @@ -139,7 +145,7 @@ declare namespace continuationManager { * @syscap SystemCapability.Ability.DistributedAbilityManager * @since 8 * @deprecated since 9 - * @useinstead ohos.continuation.continuationManager.startContinuationDeviceManager + * @useinstead ohos.continuation.continuationManager.continuationManager#startContinuationDeviceManager */ function startDeviceManager(token: number, callback: AsyncCallback): void; function startDeviceManager(token: number, options: ContinuationExtraParams, callback: AsyncCallback): void; @@ -149,9 +155,11 @@ declare namespace continuationManager { * Registers an ability to be hopped with the continuation manager service and obtains the registration token * assigned to the ability. * + * @permission ohos.permission.DISTRIBUTED_DATASYNC * @param options Indicates the {@link ExtraParams} object containing the extra parameters used to filter * the list of available devices. * @return callback Indicates the callback to be invoked when the continuation manager service is connected. + * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 401 - The parameter check failed. * @throws { BusinessError } 16600001 - The system ability work abnormally. * @throws { BusinessError } 16600003 - The number of token registration times has reached the upper limit. @@ -166,8 +174,10 @@ declare namespace continuationManager { * Unregisters a specified ability from the continuation manager service based on the token obtained during ability * registration. * + * @permission ohos.permission.DISTRIBUTED_DATASYNC * @param token Indicates the registration token of the ability. * @return callback Indicates the callback to be invoked when the continuation manager service is connected. + * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 401 - The parameter check failed. * @throws { BusinessError } 16600001 - The system ability work abnormally. * @throws { BusinessError } 16600002 - The specified token or callback has not registered. @@ -180,10 +190,12 @@ declare namespace continuationManager { /** * Updates the connection state of the device where the specified ability is successfully hopped. * + * @permission ohos.permission.DISTRIBUTED_DATASYNC * @param token Indicates the registration token of the ability. * @param deviceId Indicates the ID of the device whose connection state is to be updated. * @param status Indicates the connection state to update. * @return callback Indicates the callback to be invoked when the continuation manager service is connected. + * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 401 - The parameter check failed. * @throws { BusinessError } 16600001 - The system ability work abnormally. * @throws { BusinessError } 16600002 - The specified token or callback has not registered. @@ -196,10 +208,12 @@ declare namespace continuationManager { /** * Start to manage the devices that can be selected for continuation. * + * @permission ohos.permission.DISTRIBUTED_DATASYNC * @param token Indicates the registration token of the ability. * @param options Indicates the extraParams object containing the extra parameters used to filter * the list of available devices. This parameter can be null. * @return callback Indicates the callback to be invoked when the continuation manager service is connected. + * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 401 - The parameter check failed. * @throws { BusinessError } 16600001 - The system ability work abnormally. * @throws { BusinessError } 16600002 - The specified token or callback has not registered. diff --git a/api/@ohos.convertxml.d.ts b/api/@ohos.convertxml.d.ts index c4f7dfc141008641bac72b0e0e90451e55cbff0b..d77c980e64b65beba42f1c56c416f6a74aa82a5a 100644 --- a/api/@ohos.convertxml.d.ts +++ b/api/@ohos.convertxml.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 @@ -138,16 +138,36 @@ declare namespace xml { elementsKey: string; } + /** + * ConvertXML representation refers to extensible markup language. + * @name ConvertXML + * @since 8 + * @syscap SystemCapability.Utils.Lang + */ class ConvertXML { /** * To convert XML text to JavaScript object. * @since 8 + * @deprecated since 9 + * @useinstead ohos.convertxml.ConvertXML.convertToJSObject * @syscap SystemCapability.Utils.Lang * @param xml The xml text to be converted. * @param option Option Inputted by user to set. - * @return Returns a JavaScript object converting from XML text. + * @returns Returns a JavaScript object converting from XML text. */ convert(xml: string, options?: ConvertOptions) : Object; + + /** + * To convert XML text to JavaScript object. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param xml The xml text to be converted. + * @param option Option Inputted by user to set. + * @returns Returns a JavaScript object converting from XML text. + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200002 - Invalid xml string. + */ + convertToJSObject(xml: string, options?: ConvertOptions) : Object; } } export default xml; \ No newline at end of file diff --git a/api/@ohos.curves.d.ts b/api/@ohos.curves.d.ts index 4eb74e0d977ac97c89738ef3d99d906db1bd1945..bc7b2df505602c5fb99560099a5eee7d0174d796 100644 --- a/api/@ohos.curves.d.ts +++ b/api/@ohos.curves.d.ts @@ -76,6 +76,7 @@ declare namespace curves { * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 * @deprecated since 9 + * @useinstead initCurve */ function init(curve?: Curve): string; @@ -97,6 +98,7 @@ declare namespace curves { * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 * @deprecated since 9 + * @useinstead stepsCurve */ function steps(count: number, end: boolean): string; @@ -120,6 +122,7 @@ declare namespace curves { * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 * @deprecated since 9 + * @useinstead cubicBezierCurve */ function cubicBezier(x1: number, y1: number, x2: number, y2: number): string; @@ -145,6 +148,7 @@ declare namespace curves { * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 7 * @deprecated since 9 + * @useinstead springCurve */ function spring(velocity: number, mass: number, stiffness: number, damping: number): string; diff --git a/api/@ohos.data.DataShareResultSet.d.ts b/api/@ohos.data.DataShareResultSet.d.ts index f03f9547d880e8a1b2cdc64d4d7e3ffdf78bd59f..2841c350937d8a41c1dfb0339a021baaa35743b6 100644 --- a/api/@ohos.data.DataShareResultSet.d.ts +++ b/api/@ohos.data.DataShareResultSet.d.ts @@ -74,9 +74,9 @@ export enum DataType { export default interface DataShareResultSet { /** * Obtains the names of all columns or keys in a result set. - * - * @note The column or key names are returned as a string array, in which the strings are in the same order + * The column or key names are returned as a string array, in which the strings are in the same order * as the columns or keys in the result set. + * * @since 9 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi @@ -85,8 +85,8 @@ export default interface DataShareResultSet { /** * Obtains the number of columns or keys in the result set. + * The returned number is equal to the length of the string array returned by the columnCount method. * - * @note The returned number is equal to the length of the string array returned by the columnCount method. * @since 9 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi @@ -119,7 +119,7 @@ export default interface DataShareResultSet { * @since 9 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi - * @return Returns true if the result set is moved successfully; + * @returns Returns true if the result set is moved successfully; * returns false otherwise, for example, if the result set is empty. */ goToFirstRow(): boolean; @@ -130,7 +130,7 @@ export default interface DataShareResultSet { * @since 9 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi - * @return Returns true if the result set is moved successfully; + * @returns Returns true if the result set is moved successfully; * returns false otherwise, for example, if the result set is empty. */ goToLastRow(): boolean; @@ -141,7 +141,7 @@ export default interface DataShareResultSet { * @since 9 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi - * @return Returns true if the result set is moved successfully; + * @returns Returns true if the result set is moved successfully; * returns false otherwise, for example, if the result set is already in the last row. */ goToNextRow(): boolean; @@ -152,7 +152,7 @@ export default interface DataShareResultSet { * @since 9 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi - * @return Returns true if the result set is moved successfully; + * @returns Returns true if the result set is moved successfully; * returns false otherwise, for example, if the result set is already in the first row. */ goToPreviousRow(): boolean; @@ -165,7 +165,7 @@ export default interface DataShareResultSet { * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi * @param offset Indicates the offset relative to the current position. - * @return Returns true if the result set is moved successfully and does not go beyond the range; + * @returns Returns true if the result set is moved successfully and does not go beyond the range; * returns false otherwise. */ goTo(offset: number): boolean; @@ -177,107 +177,107 @@ export default interface DataShareResultSet { * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi * @param position Indicates the index of the specified row, which starts from 1. - * @return Returns true if the result set is moved successfully; returns false otherwise. + * @returns Returns true if the result set is moved successfully; returns false otherwise. */ goToRow(position: number): boolean; /** * Obtains the value of the specified column or key in the current row as a byte array. + * The implementation class determines whether to throw an exception if the value of the specified * - * @note The implementation class determines whether to throw an exception if the value of the specified * column or key in the current row is null or the specified column or key is not of the Blob type. * @since 9 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi * @param columnIndex Indicates the specified column index or key index, which starts from 0. - * @return Returns the value of the specified column or key as a byte array. + * @returns Returns the value of the specified column or key as a byte array. */ getBlob(columnIndex: number): Uint8Array; /** * Obtains the value of the specified column or key in the current row as string. + * The implementation class determines whether to throw an exception if the value of the specified * - * @note The implementation class determines whether to throw an exception if the value of the specified * column or key in the current row is null or the specified column or key is not of the string type. * @since 9 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi * @param columnIndex Indicates the specified column index or key index, which starts from 0. - * @return Returns the value of the specified column or key as a string. + * @returns Returns the value of the specified column or key as a string. */ getString(columnIndex: number): string; /** * Obtains the value of the specified column or key in the current row as long. - * - * @note The implementation class determines whether to throw an exception if the value of the specified + * The implementation class determines whether to throw an exception if the value of the specified * column or key in the current row is null, the specified column or key is not of the long type. + * * @since 9 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi * @param columnIndex Indicates the specified column index or key index, which starts from 0. - * @return Returns the value of the specified column or key as a long. + * @returns Returns the value of the specified column or key as a long. */ getLong(columnIndex: number): number; /** * Obtains the value of the specified column or key in the current row as double. + * The implementation class determines whether to throw an exception if the value of the specified * - * @note The implementation class determines whether to throw an exception if the value of the specified * column or key in the current row is null, the specified column or key is not of the double type. * @since 9 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi * @param columnIndex Indicates the specified column index or key index, which starts from 0. - * @return Returns the value of the specified column or key as a double. + * @returns Returns the value of the specified column or key as a double. */ getDouble(columnIndex: number): number; /** * Closes the result set. + * Calling this method on the result set will release all of its resources and makes it ineffective. * - * @note Calling this method on the result set will release all of its resources and makes it ineffective. * @since 9 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi - * @return Returns true if the result set is closed; returns false otherwise. + * @returns Returns true if the result set is closed; returns false otherwise. */ close(): void; /** * Obtains the column index or key index based on the specified column name or key name. + * The column name or key name is passed as an input parameter. * - * @note The column name or key name is passed as an input parameter. * @since 9 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi * @param columnName Indicates the name of the specified column or key in the result set. - * @return Returns the index of the specified column or key. + * @returns Returns the index of the specified column or key. */ getColumnIndex(columnName: string): number; /** * Obtains the column name or key name based on the specified column index or key index. + * The column index or key index is passed as an input parameter. * - * @note The column index or key index is passed as an input parameter. * @since 9 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi * @param columnIndex Indicates the index of the specified column or key in the result set. - * @return Returns the name of the specified column or key. + * @returns Returns the name of the specified column or key. */ getColumnName(columnIndex: number): string; /** * Obtains the dataType of the specified column or key. - * - * @note The implementation class determines whether to throw an exception if the value of the specified + * The implementation class determines whether to throw an exception if the value of the specified * column or key in the current row is null, the specified column or key is not in the data type. + * * @since 9 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi * @param columnIndex Indicates the specified column index or key index, which starts from 0. - * @return Returns the dataType of the specified column or key. + * @returns Returns the dataType of the specified column or key. */ getDataType(columnIndex: number): DataType; } \ No newline at end of file diff --git a/api/@ohos.data.dataAbility.d.ts b/api/@ohos.data.dataAbility.d.ts index f2eb226ff8748583ada659d23881327f2e3c4c33..670ef3d2f7568be913e567b0989acef2a2b79221 100644 --- a/api/@ohos.data.dataAbility.d.ts +++ b/api/@ohos.data.dataAbility.d.ts @@ -21,18 +21,17 @@ import rdb from './@ohos.data.rdb'; * * @since 7 * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @import import data_dataAbility from '@ohos.data.dataAbility'; */ declare namespace dataAbility { /** * Create an RdbPredicates by table name and DataAbilityPredicates. + * This method is similar to = of the SQL statement. * - * @note This method is similar to = of the SQL statement. * @since 7 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @param name Indicates the table name. * @param dataAbilityPredicates Indicates the dataAbility predicates. - * @return Returns an RdbPredicates. + * @returns Returns an RdbPredicates. */ function createRdbPredicates(name: string, dataAbilityPredicates: DataAbilityPredicates): rdb.RdbPredicates; @@ -41,236 +40,230 @@ declare namespace dataAbility { * * @since 7 * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @import import data_dataAbility from '@ohos.data.dataAbility'; */ class DataAbilityPredicates { /** - * Configures the DataAbilityPredicates to match the field whose data type is ValueType and value is equal + * Configure the DataAbilityPredicates to match the field whose data type is ValueType and value is equal * to a specified value. + * This method is similar to = of the SQL statement. * - * @note This method is similar to = of the SQL statement. * @since 7 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @param field Indicates the column name in the database table. * @param value Indicates the value to match with the DataAbilityPredicates. - * @return Returns the DataAbilityPredicates that match the specified field. + * @returns Returns the DataAbilityPredicates that match the specified field. */ equalTo(field: string, value: ValueType): DataAbilityPredicates; /** - * Configures the DataAbilityPredicates to match the field whose data type is ValueType and value is unequal to + * Configure the DataAbilityPredicates to match the field whose data type is ValueType and value is unequal to * a specified value. + * Configure the data capability predicate to match a field where the data type is a value type and the value is not equal to the specified value. + * This method is similar to != of the SQL statement. * - * @note This method is similar to != of the SQL statement. * @since 7 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @param field Indicates the column name in the database table. * @param value Indicates the value to match with the DataAbilityPredicates. - * @return Returns the DataAbilityPredicates that match the specified field. + * @returns Returns the DataAbilityPredicates that match the specified field. */ notEqualTo(field: string, value: ValueType): DataAbilityPredicates; /** * Adds a left parenthesis to the DataAbilityPredicates. + * This method is similar to ( of the SQL statement and needs to be used together with endWrap(). * - * @note This method is similar to ( of the SQL statement and needs to be used together with endWrap(). * @since 7 * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @return Returns the DataAbilityPredicates with the left parenthesis. + * @returns Returns the DataAbilityPredicates with the left parenthesis. */ beginWrap(): DataAbilityPredicates; /** * Adds a right parenthesis to the DataAbilityPredicates. + * This method is similar to ) of the SQL statement and needs to be used together * - * @note This method is similar to ) of the SQL statement and needs to be used together * with beginWrap(). * @since 7 * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @return Returns the DataAbilityPredicates with the right parenthesis. + * @returns Returns the DataAbilityPredicates with the right parenthesis. */ endWrap(): DataAbilityPredicates; /** * Adds an or condition to the DataAbilityPredicates. + * This method is similar to or of the SQL statement. * - * @note This method is similar to or of the SQL statement. * @since 7 * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @return Returns the DataAbilityPredicates with the or condition. + * @returns Returns the DataAbilityPredicates with the or condition. */ or(): DataAbilityPredicates; /** * Adds an and condition to the DataAbilityPredicates. + * This method is similar to and of the SQL statement. * - * @note This method is similar to and of the SQL statement. * @since 7 * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @return Returns the DataAbilityPredicates with the and condition. + * @returns Returns the DataAbilityPredicates with the and condition. */ and(): DataAbilityPredicates; /** - * Configures the DataAbilityPredicates to match the field whose data type is string and value + * Configure the DataAbilityPredicates to match the field whose data type is string and value * contains a specified value. + * This method is similar to contains of the SQL statement. * - * @note This method is similar to contains of the SQL statement. * @since 7 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @param field Indicates the column name in the database table. * @param value Indicates the value to match with the DataAbilityPredicates. - * @return Returns the DataAbilityPredicates that match the specified field. + * @returns Returns the DataAbilityPredicates that match the specified field. */ contains(field: string, value: string): DataAbilityPredicates; /** - * Configures the DataAbilityPredicates to match the field whose data type is string and value starts + * Configure the DataAbilityPredicates to match the field whose data type is string and value starts * with a specified string. + * This method is similar to value% of the SQL statement. * - * @note This method is similar to value% of the SQL statement. * @since 7 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @param field Indicates the column name in the database table. * @param value Indicates the value to match with the DataAbilityPredicates. - * @return Returns the DataAbilityPredicates that match the specified field. + * @returns Returns the DataAbilityPredicates that match the specified field. */ beginsWith(field: string, value: string): DataAbilityPredicates; /** - * Configures the DataAbilityPredicates to match the field whose data type is string and value + * Configure the DataAbilityPredicates to match the field whose data type is string and value * ends with a specified string. + * This method is similar to %value of the SQL statement. * - * @note This method is similar to %value of the SQL statement. * @since 7 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @param field Indicates the column name in the database table. * @param value Indicates the value to match with the DataAbilityPredicates. - * @return Returns the DataAbilityPredicates that match the specified field. + * @returns Returns the DataAbilityPredicates that match the specified field. */ endsWith(field: string, value: string): DataAbilityPredicates; /** - * Configures the DataAbilityPredicates to match the fields whose value is null. + * Configure the DataAbilityPredicates to match the fields whose value is null. + * This method is similar to is null of the SQL statement. * - * @note This method is similar to is null of the SQL statement. * @since 7 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @param field Indicates the column name in the database table. - * @return Returns the DataAbilityPredicates that match the specified field. + * @returns Returns the DataAbilityPredicates that match the specified field. */ isNull(field: string): DataAbilityPredicates; /** - * Configures the DataAbilityPredicates to match the specified fields whose value is not null. + * Configure the DataAbilityPredicates to match the specified fields whose value is not null. + * This method is similar to is not null of the SQL statement. * - * @note This method is similar to is not null of the SQL statement. * @since 7 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @param field Indicates the column name in the database table. - * @return Returns the DataAbilityPredicates that match the specified field. + * @returns Returns the DataAbilityPredicates that match the specified field. */ isNotNull(field: string): DataAbilityPredicates; /** - * Configures the DataAbilityPredicates to match the fields whose data type is string and value is + * Configure the DataAbilityPredicates to match the fields whose data type is string and value is * similar to a specified string. + * This method is similar to like of the SQL statement. * - * @note This method is similar to like of the SQL statement. * @since 7 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @param field Indicates the column name in the database table. * @param value Indicates the value to match with the DataAbilityPredicates. The percent sign (%) in the value * is a wildcard (like * in a regular expression). - * @return Returns the DataAbilityPredicates that match the specified field. + * @returns Returns the DataAbilityPredicates that match the specified field. */ like(field: string, value: string): DataAbilityPredicates; /** - * Configures DataAbilityPredicates to match the specified field whose data type is string and the value contains + * Configure DataAbilityPredicates to match the specified field whose data type is string and the value contains * a wildcard. + * Different from like, the input parameters of this method are case-sensitive. * - * @note Different from like, the input parameters of this method are case-sensitive. * @since 7 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @param field Indicates the column name in the database table. * @param value Indicates the value to match with DataAbilityPredicates. - * @return Returns the SQL statement with the specified DataAbilityPredicates. + * @returns Returns the SQL statement with the specified DataAbilityPredicates. */ glob(field: string, value: string): DataAbilityPredicates; /** * Restricts the value of the field to the range between low value and high value. * - * @note N/A * @since 7 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @param field Indicates the column name. * @param low Indicates the minimum value. * @param high Indicates the maximum value. - * @return Returns the SQL query statement with the specified DataAbilityPredicates. + * @returns Returns the SQL query statement with the specified DataAbilityPredicates. */ between(field: string, low: ValueType, high: ValueType): DataAbilityPredicates; /** - * Configures DataAbilityPredicates to match the specified field whose data type is int and value is + * Configure DataAbilityPredicates to match the specified field whose data type is int and value is * out of a given range. * - * @note N/A * @since 7 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @param field Indicates the column name in the database table. * @param low Indicates the minimum value to match with DataAbilityPredicates}. * @param high Indicates the maximum value to match with DataAbilityPredicates}. - * @return Returns the SQL query statement with the specified DataAbilityPredicates. + * @returns Returns the SQL query statement with the specified DataAbilityPredicates. */ notBetween(field: string, low: ValueType, high: ValueType): DataAbilityPredicates; /** * Restricts the value of the field to be greater than the specified value. * - * @note N/A * @since 7 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @param field Indicates the column name. * @param value Indicates the String field. - * @return Returns the SQL query statement with the specified DataAbilityPredicates. + * @returns Returns the SQL query statement with the specified DataAbilityPredicates. */ greaterThan(field: string, value: ValueType): DataAbilityPredicates; /** * Restricts the value of the field to be smaller than the specified value. * - * @note N/A * @since 7 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @param field Indicates the column name. * @param value Indicates the String field. - * @return Returns the SQL query statement with the specified DataAbilityPredicates. + * @returns Returns the SQL query statement with the specified DataAbilityPredicates. */ lessThan(field: string, value: ValueType): DataAbilityPredicates; /** * Restricts the value of the field to be greater than or equal to the specified value. * - * @note N/A * @since 7 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @param field Indicates the column name. * @param value Indicates the String field. - * @return Returns the SQL query statement with the specified DataAbilityPredicates. + * @returns Returns the SQL query statement with the specified DataAbilityPredicates. */ greaterThanOrEqualTo(field: string, value: ValueType): DataAbilityPredicates; /** * Restricts the value of the field to be smaller than or equal to the specified value. * - * @note N/A * @since 7 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @param field Indicates the column name. * @param value Indicates the String field. - * @return Returns the SQL query statement with the specified DataAbilityPredicates. + * @returns Returns the SQL query statement with the specified DataAbilityPredicates. */ lessThanOrEqualTo(field: string, value: ValueType): DataAbilityPredicates; @@ -278,11 +271,10 @@ declare namespace dataAbility { * Restricts the ascending order of the return list. When there are several orders, * the one close to the head has the highest priority. * - * @note N/A * @since 7 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @param field Indicates the column name for sorting the return list. - * @return Returns the SQL query statement with the specified DataAbilityPredicates. + * @returns Returns the SQL query statement with the specified DataAbilityPredicates. */ orderByAsc(field: string): DataAbilityPredicates; @@ -290,92 +282,86 @@ declare namespace dataAbility { * Restricts the descending order of the return list. When there are several orders, * the one close to the head has the highest priority. * - * @note N/A * @since 7 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @param field Indicates the column name for sorting the return list. - * @return Returns the SQL query statement with the specified DataAbilityPredicates. + * @returns Returns the SQL query statement with the specified DataAbilityPredicates. */ orderByDesc(field: string): DataAbilityPredicates; /** * Restricts each row of the query result to be unique. * - * @note N/A * @since 7 * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @return Returns the SQL query statement with the specified DataAbilityPredicates. + * @returns Returns the SQL query statement with the specified DataAbilityPredicates. */ distinct(): DataAbilityPredicates; /** * Restricts the max number of return records. * - * @note N/A * @since 7 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @param value Indicates the max length of the return list. - * @return Returns the SQL query statement with the specified DataAbilityPredicates. + * @returns Returns the SQL query statement with the specified DataAbilityPredicates. * @throws IllegalPredicateException Throws this exception if DataAbilityPredicates are added to a wrong position. */ limitAs(value: number): DataAbilityPredicates; /** - * Configures DataAbilityPredicates to specify the start position of the returned result. + * Configure DataAbilityPredicates to specify the start position of the returned result. + * Use this method together with limit(int). * - * @note Use this method together with limit(int). * @since 7 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @param rowOffset Indicates the start position of the returned result. The value is a positive integer. - * @return Returns the SQL query statement with the specified AbsPredicates. + * @returns Returns the SQL query statement with the specified AbsPredicates. */ offsetAs(rowOffset: number): DataAbilityPredicates; /** - * Configures DataAbilityPredicates to group query results by specified columns. + * Configure DataAbilityPredicates to group query results by specified columns. * - * @note N/A * @since 7 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @param fields Indicates the specified columns by which query results are grouped. - * @return Returns the DataAbilityPredicates with the specified columns by which query results are grouped. + * @returns Returns the DataAbilityPredicates with the specified columns by which query results are grouped. */ groupBy(fields: Array): DataAbilityPredicates; /** - * Configures DataAbilityPredicates to specify the index column. + * Configure DataAbilityPredicates to specify the index column. + * Before using this method, you need to create an index column. * - * @note Before using this method, you need to create an index column. * @since 7 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @param indexName Indicates the name of the index column. - * @return Returns DataAbilityPredicates with the specified index column. + * @returns Returns DataAbilityPredicates with the specified index column. */ indexedBy(field: string): DataAbilityPredicates; /** - * Configures DataAbilityPredicates to match the specified field whose data type is ValueType array and values + * Configure DataAbilityPredicates to match the specified field whose data type is ValueType array and values * are within a given range. * - * @note N/A * @since 7 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @param field Indicates the column name in the database table. * @param values Indicates the values to match with DataAbilityPredicates. - * @return Returns DataAbilityPredicates that matches the specified field. + * @returns Returns DataAbilityPredicates that matches the specified field. */ in(field: string, value: Array): DataAbilityPredicates; /** - * Configures {@code DataAbilityPredicates} to match the specified field whose data type is String array and values + * Configure {@code DataAbilityPredicates} to match the specified field whose data type is String array and values * are out of a given range. * - * @note N/A * @since 7 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @param field Indicates the column name in the database table. * @param values Indicates the values to match with DataAbilityPredicates. - * @return Returns DataAbilityPredicates that matches the specified field. + * @returns Returns DataAbilityPredicates that matches the specified field. */ notIn(field: string, value: Array): DataAbilityPredicates; } @@ -383,7 +369,6 @@ declare namespace dataAbility { * Indicates possible value types * @since 7 * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @import import data_rdb from '@ohos.data.rdb'; */ type ValueType = number | string | boolean; } diff --git a/api/@ohos.data.dataShare.d.ts b/api/@ohos.data.dataShare.d.ts index a773ff1954985421401321c39fe28f0b7069676a..2a55be2efcd4e75eeb970441ba5e270b029873a8 100644 --- a/api/@ohos.data.dataShare.d.ts +++ b/api/@ohos.data.dataShare.d.ts @@ -19,119 +19,219 @@ import DataShareResultSet from './@ohos.data.DataShareResultSet'; import dataSharePredicates from './@ohos.data.dataSharePredicates'; import { ValuesBucket } from './@ohos.data.ValuesBucket'; +/** +* This module provides the dataShare capability for consumer. +* @syscap SystemCapability.DistributedDataManager.DataShare.Consumer +* @systemapi +* @StageModelOnly +* @since 9 + */ declare namespace dataShare { /** * Obtains the dataShareHelper. - * @since 9 + * @param {Context} context - Indicates the application context. + * @param {string} uri - Indicates the path of the file to open. + * @param {AsyncCallback} callback - {DataShareHelper}: the dataShareHelper for consumer. + * @throws {BusinessError} 401 - the parameter check failed. + * @throws {BusinessError} 15700010 - the DataShareHelper is not initialized successfully. * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer * @systemapi - * @param context Indicates the application context. - * @param uri Indicates the path of the file to open. - * @return Returns the dataShareHelper. * @StageModelOnly + * @since 9 */ function createDataShareHelper(context: Context, uri: string, callback: AsyncCallback): void; + + /** + * Obtains the dataShareHelper. + * @param {Context} context - Indicates the application context. + * @param {string} uri - Indicates the path of the file to open. + * @returns {Promise} {DataShareHelper}: the dataShareHelper for consumer. + * @throws {BusinessError} 401 - the parameter check failed. + * @throws {BusinessError} 15700010 - the DataShareHelper is not initialized successfully. + * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer + * @systemapi + * @StageModelOnly + * @since 9 + */ function createDataShareHelper(context: Context, uri: string): Promise; /** * DataShareHelper - * @since 9 * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer * @systemapi * @StageModelOnly + * @since 9 */ interface DataShareHelper { /** * Registers an observer to observe data specified by the given uri. - * @since 9 + * @param {string} type - type must be 'dataChange'. + * @param {string} uri - Indicates the path of the data to operate. + * @param {AsyncCallback} callback - the callback of on. * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer * @systemapi - * @param type dataChange. - * @param uri Indicates the path of the data to operate. - * @param callback Indicates the callback when dataChange. - * @return - * @StageModelOnly + * @since 9 */ on(type: 'dataChange', uri: string, callback: AsyncCallback): void; /** * Deregisters an observer used for monitoring data specified by the given uri. - * @since 9 + * @param {string} type - type must be 'dataChange'. + * @param {string} uri - Indicates the path of the data to operate. + * @param {AsyncCallback} callback - the callback of off. * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer * @systemapi - * @param type dataChange. - * @param uri Indicates the path of the data to operate. - * @param callback Indicates the registered callback. - * @return - * @StageModelOnly + * @since 9 */ off(type: 'dataChange', uri: string, callback?: AsyncCallback): void; /** * Inserts a single data record into the database. - * @since 9 + * @param {string} uri - Indicates the path of the data to operate. + * @param {ValueBucket} value - Indicates the data record to insert. If this parameter is null, + * a blank row will be inserted. + * @param {AsyncCallback} callback - {number}: the index of the inserted data record. + * @throws {BusinessError} 401 - the parameter check failed. * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer * @systemapi - * @param uri Indicates the path of the data to operate. - * @param value 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. * @StageModelOnly + * @since 9 */ insert(uri: string, value: ValuesBucket, callback: AsyncCallback): void; + + /** + * Inserts a single data record into the database. + * @param {string} uri - Indicates the path of the data to operate. + * @param {ValueBucket} value - Indicates the data record to insert. If this parameter is null, + * a blank row will be inserted. + * @returns {Promise} {number}: the index of the inserted data record. + * @throws {BusinessError} 401 - the parameter check failed. + * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer + * @systemapi + * @StageModelOnly + * @since 9 + */ insert(uri: string, value: ValuesBucket): Promise; /** * Deletes one or more data records from the database. - * @since 9 + * @param {string} uri - Indicates the path of the data to operate. + * @param {dataSharePredicates.DataSharePredicates} predicates - Indicates filter criteria. + * You should define the processing logic when this parameter is null. + * @param {AsyncCallback} callback - {number}: the number of data records deleted. + * @throws {BusinessError} 401 - the parameter check failed. * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer * @systemapi - * @param uri Indicates the path of the data to operate. - * @param predicates Indicates filter criteria. You should define the processing logic when this parameter is null. - * @return Returns the number of data records deleted. * @StageModelOnly + * @since 9 */ delete(uri: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; + + /** + * Deletes one or more data records from the database. + * @param {string} uri - Indicates the path of the data to operate. + * @param {dataSharePredicates.DataSharePredicates} predicates - Indicates filter criteria. + * You should define the processing logic when this parameter is null. + * @returns {Promise} {number}: the number of data records deleted. + * @throws {BusinessError} 401 - the parameter check failed. + * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer + * @systemapi + * @StageModelOnly + * @since 9 + */ delete(uri: string, predicates: dataSharePredicates.DataSharePredicates): Promise; /** * Queries data in the database. + * @param {string} uri - Indicates the path of data to query. + * @param {dataSharePredicates.DataSharePredicates} predicates - Indicates filter criteria. + * You should define the processing logic when this parameter is null. + * @param {Array} columns - Indicates the columns to query. + * If this parameter is null, all columns are queried. + * @param {AsyncCallback} callback - {DataShareResultSet}: the query result. + * @throws {BusinessError} 401 - the parameter check failed. + * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer + * @systemapi + * @StageModelOnly * @since 9 + */ + query(uri: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array, + callback: AsyncCallback): void; + + /** + * Queries data in the database. + * @param {string} uri - Indicates the path of data to query. + * @param {dataSharePredicates.DataSharePredicates} predicates - Indicates filter criteria. + * You should define the processing logic when this parameter is null. + * @param {Array} columns - Indicates the columns to query. + * If this parameter is null, all columns are queried. + * @returns {Promise} {DataShareResultSet}: the query result. + * @throws {BusinessError} 401 - the parameter check failed. * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer * @systemapi - * @param uri Indicates the path of data to query. - * @param predicates Indicates filter criteria. You should define the processing logic when this parameter is null. - * @param columns Indicates the columns to query. If this parameter is null, all columns are queried. - * @return Returns the query result. * @StageModelOnly + * @since 9 */ - query(uri: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array, callback: AsyncCallback): void; - query(uri: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array): Promise; + query(uri: string, predicates: dataSharePredicates.DataSharePredicates, + columns: Array): Promise; /** * Updates data records in the database. + * @param {string} uri - Indicates the path of data to update. + * @param {dataSharePredicates.DataSharePredicates} predicates - Indicates filter criteria. + * You should define the processing logic when this parameter is null. + * @param {ValueBucket} value - Indicates the data to update. This parameter can be null. + * @param {AsyncCallback} callback - {number}: the number of data records updated. + * @throws {BusinessError} 401 - the parameter check failed. + * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer + * @systemapi + * @StageModelOnly * @since 9 + */ + update(uri: string, predicates: dataSharePredicates.DataSharePredicates, value: ValuesBucket, + callback: AsyncCallback): void; + + /** + * Updates data records in the database. + * @param {string} uri - Indicates the path of data to update. + * @param {dataSharePredicates.DataSharePredicates} predicates - Indicates filter criteria. + * You should define the processing logic when this parameter is null. + * @param {ValueBucket} value - Indicates the data to update. This parameter can be null. + * @returns {Promise} {number}: the number of data records updated. + * @throws {BusinessError} 401 - the parameter check failed. * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer * @systemapi - * @param uri Indicates the path of data to update. - * @param predicates Indicates filter criteria. You should define the processing logic when this parameter is null. - * @param value Indicates the data to update. This parameter can be null. - * @return Returns the number of data records updated. * @StageModelOnly + * @since 9 */ - update(uri: string, predicates: dataSharePredicates.DataSharePredicates, value: ValuesBucket, callback: AsyncCallback): void; update(uri: string, predicates: dataSharePredicates.DataSharePredicates, value: ValuesBucket): Promise; /** * Inserts multiple data records into the database. - * @since 9 + * @param {string} uri - Indicates the path of the data to operate. + * @param {Array} values - Indicates the data records to insert. + * @param {AsyncCallback} callback - {number}: the number of data records inserted. + * @throws {BusinessError} 401 - the parameter check failed. * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer * @systemapi - * @param uri Indicates the path of the data to operate. - * @param values Indicates the data records to insert. - * @return Returns the number of data records inserted. * @StageModelOnly + * @since 9 */ batchInsert(uri: string, values: Array, callback: AsyncCallback): void; + + /** + * Inserts multiple data records into the database. + * @param {string} uri - Indicates the path of the data to operate. + * @param {Array} values - Indicates the data records to insert. + * @returns {Promise} {number}: the number of data records inserted. + * @throws {BusinessError} 401 - the parameter check failed. + * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer + * @systemapi + * @StageModelOnly + * @since 9 + */ batchInsert(uri: string, values: Array): Promise; /** @@ -140,49 +240,81 @@ declare namespace dataShare { *

          To transfer a normalized uri from another environment to the current environment, you should call this * method again to re-normalize the uri for the current environment or call {@link #denormalizeUri(Uri)} * to convert it to a denormalized uri that can be used only in the current environment. - * @since 9 + * @param {string} uri - Indicates the {@link ohos.utils.net.Uri} object to normalize. + * @param {AsyncCallback} callback - {string}: the normalized Uri, + * if the DataShare supports uri normalization. * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer * @systemapi - * @param uri Indicates the {@link ohos.utils.net.Uri} object to normalize. - * @return Returns the normalized {@code Uri} object if the DataShare supports uri normalization; - * returns {@code null} otherwise. - * @throws DataShareRemoteException Throws this exception if the remote process exits. - * @throws NullPointerException Throws this exception if {@code uri} is null. - * @see #denormalizeUri * @StageModelOnly + * @since 9 */ normalizeUri(uri: string, callback: AsyncCallback): void; + + /** + * Converts the given {@code uri} that refers to the DataShare into a normalized {@link ohos.utils.net.Uri}. + * A normalized uri can be used across devices, persisted, backed up, and restored. + *

          To transfer a normalized uri from another environment to the current environment, you should call this + * method again to re-normalize the uri for the current environment or call {@link #denormalizeUri(Uri)} + * to convert it to a denormalized uri that can be used only in the current environment. + * @param {string} uri - Indicates the {@link ohos.utils.net.Uri} object to normalize. + * @returns {Promise} {string}: the normalized Uri if the DataShare supports uri normalization; + * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer + * @systemapi + * @StageModelOnly + * @since 9 + */ normalizeUri(uri: string): Promise; /** * Converts the given normalized {@code uri} generated by {@link #normalizeUri(Uri)} into a denormalized one. - * @since 9 + * @param {string} uri - Indicates the {@link ohos.utils.net.Uri} object to denormalize. + * @param {AsyncCallback} callback - {string}: the denormalized {@code Uri} object if + * the denormalization is successful; returns the original {@code Uri} passed to this method if + * there is nothing to do; returns {@code null} if the data identified by the normalized {@code Uri} + * cannot be found in the current environment. * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer * @systemapi - * @param uri Indicates the {@link ohos.utils.net.Uri} object to denormalize. - * @return Returns the denormalized {@code Uri} object if the denormalization is successful; returns the - * original {@code Uri} passed to this method if there is nothing to do; returns {@code null} if the data - * identified by the normalized {@code Uri} cannot be found in the current environment. - * @throws DataShareRemoteException Throws this exception if the remote process exits. - * @throws NullPointerException Throws this exception if {@code uri} is null. - * @see #normalizeUri * @StageModelOnly + * @since 9 */ denormalizeUri(uri: string, callback: AsyncCallback): void; + + /** + * Converts the given normalized {@code uri} generated by {@link #normalizeUri(Uri)} into a denormalized one. + * @param {string} uri - Indicates the {@link ohos.utils.net.Uri} object to denormalize. + * @returns {Promise} {string}: the denormalized {@code Uri} object if the denormalization + * is successful; returns the original {@code Uri} passed to this method if there is nothing to do; + * returns {@code null} if the data identified by the normalized {@code Uri} cannot be found in the + * current environment. + * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer + * @systemapi + * @StageModelOnly + * @since 9 + */ denormalizeUri(uri: string): Promise; /** * Notifies the registered observers of a change to the data resource specified by Uri. - * @since 9 + * @param {string} uri - Indicates the {@link ohos.utils.net.Uri} object to notifyChange. + * @param {AsyncCallback} callback - the callback of notifyChange. * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer * @systemapi - * @param uri Indicates the {@link ohos.utils.net.Uri} object to notifyChange. - * @return - * @StageModelOnly + * @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 {@link ohos.utils.net.Uri} object to notifyChange. + * @returns {Promise} the promise returned by the function. + * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer + * @systemapi + * @StageModelOnly + * @since 9 + */ notifyChange(uri: string): Promise; } } -export default dataShare; +export default dataShare; \ No newline at end of file diff --git a/api/@ohos.data.dataSharePredicates.d.ts b/api/@ohos.data.dataSharePredicates.d.ts index f11e1c96bf482f237d389181e85466b187e7090f..7d1f1406917ae4b8462259d918e4efeecdce5d75 100644 --- a/api/@ohos.data.dataSharePredicates.d.ts +++ b/api/@ohos.data.dataSharePredicates.d.ts @@ -22,188 +22,187 @@ declare namespace dataSharePredicates { * @since 9 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi - * @import import data_dataShare from '@ohos.data.dataShare'; */ class DataSharePredicates { /** - * Configures the DataSharePredicates to match the field whose data type is ValueType and value is equal + * Configure the DataSharePredicates to match the field whose data type is ValueType and value is equal * to a specified value. + * This method is similar to = of the SQL statement. * - * @note This method is similar to = of the SQL statement. * @since 9 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi * @param field Indicates the column name in the database table. * @param value Indicates the value to match with the DataSharePredicates. - * @return Returns the DataSharePredicates that match the specified field. + * @returns Returns the DataSharePredicates that match the specified field. */ equalTo(field: string, value: ValueType): DataSharePredicates; /** - * Configures the DataSharePredicates to match the field whose data type is ValueType and value is unequal to + * Configure the DataSharePredicates to match the field whose data type is ValueType and value is unequal to * a specified value. + * This method is similar to != of the SQL statement. * - * @note This method is similar to != of the SQL statement. * @since 9 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi * @param field Indicates the column name in the database table. * @param value Indicates the value to match with the DataSharePredicates. - * @return Returns the DataSharePredicates that match the specified field. + * @returns Returns the DataSharePredicates that match the specified field. */ notEqualTo(field: string, value: ValueType): DataSharePredicates; /** * Adds a left parenthesis to the DataSharePredicates. + * This method is similar to ( of the SQL statement and needs to be used together with endWrap(). * - * @note This method is similar to ( of the SQL statement and needs to be used together with endWrap(). * @since 9 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi - * @return Returns the DataSharePredicates with the left parenthesis. + * @returns Returns the DataSharePredicates with the left parenthesis. */ beginWrap(): DataSharePredicates; /** * Adds a right parenthesis to the DataSharePredicates. + * This method is similar to ) of the SQL statement and needs to be used together * - * @note This method is similar to ) of the SQL statement and needs to be used together * with beginWrap(). * @since 9 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi - * @return Returns the DataSharePredicates with the right parenthesis. + * @returns Returns the DataSharePredicates with the right parenthesis. */ endWrap(): DataSharePredicates; /** * Adds an or condition to the DataSharePredicates. + * This method is similar to or of the SQL statement. * - * @note This method is similar to or of the SQL statement. * @since 9 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi - * @return Returns the DataSharePredicates with the or condition. + * @returns Returns the DataSharePredicates with the or condition. */ or(): DataSharePredicates; /** * Adds an and condition to the DataSharePredicates. + * This method is similar to and of the SQL statement. * - * @note This method is similar to and of the SQL statement. * @since 9 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi - * @return Returns the DataSharePredicates with the and condition. + * @returns Returns the DataSharePredicates with the and condition. */ and(): DataSharePredicates; /** - * Configures the DataSharePredicates to match the field whose data type is string and value + * Configure the DataSharePredicates to match the field whose data type is string and value * contains a specified value. + * This method is similar to contains of the SQL statement. * - * @note This method is similar to contains of the SQL statement. * @since 9 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi * @param field Indicates the column name in the database table. * @param value Indicates the value to match with the DataSharePredicates. - * @return Returns the DataSharePredicates that match the specified field. + * @returns Returns the DataSharePredicates that match the specified field. */ contains(field: string, value: string): DataSharePredicates; /** - * Configures the DataSharePredicates to match the field whose data type is string and value starts + * Configure the DataSharePredicates to match the field whose data type is string and value starts * with a specified string. + * This method is similar to value% of the SQL statement. * - * @note This method is similar to value% of the SQL statement. * @since 9 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi * @param field Indicates the column name in the database table. * @param value Indicates the value to match with the DataSharePredicates. - * @return Returns the DataSharePredicates that match the specified field. + * @returns Returns the DataSharePredicates that match the specified field. */ beginsWith(field: string, value: string): DataSharePredicates; /** - * Configures the DataSharePredicates to match the field whose data type is string and value + * Configure the DataSharePredicates to match the field whose data type is string and value * ends with a specified string. + * This method is similar to %value of the SQL statement. * - * @note This method is similar to %value of the SQL statement. * @since 9 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi * @param field Indicates the column name in the database table. * @param value Indicates the value to match with the DataSharePredicates. - * @return Returns the DataSharePredicates that match the specified field. + * @returns Returns the DataSharePredicates that match the specified field. */ endsWith(field: string, value: string): DataSharePredicates; /** - * Configures the DataSharePredicates to match the fields whose value is null. + * Configure the DataSharePredicates to match the fields whose value is null. + * This method is similar to is null of the SQL statement. * - * @note This method is similar to is null of the SQL statement. * @since 9 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi * @param field Indicates the column name in the database table. - * @return Returns the DataSharePredicates that match the specified field. + * @returns Returns the DataSharePredicates that match the specified field. */ isNull(field: string): DataSharePredicates; /** - * Configures the DataSharePredicates to match the specified fields whose value is not null. + * Configure the DataSharePredicates to match the specified fields whose value is not null. + * This method is similar to is not null of the SQL statement. * - * @note This method is similar to is not null of the SQL statement. * @since 9 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi * @param field Indicates the column name in the database table. - * @return Returns the DataSharePredicates that match the specified field. + * @returns Returns the DataSharePredicates that match the specified field. */ isNotNull(field: string): DataSharePredicates; /** - * Configures the DataSharePredicates to match the fields whose data type is string and value is + * Configure the DataSharePredicates to match the fields whose data type is string and value is * similar to a specified string. + * This method is similar to like of the SQL statement. * - * @note This method is similar to like of the SQL statement. * @since 9 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi * @param field Indicates the column name in the database table. * @param value Indicates the value to match with the DataSharePredicates. The percent sign (%) in the value * is a wildcard (like * in a regular expression). - * @return Returns the DataSharePredicates that match the specified field. + * @returns Returns the DataSharePredicates that match the specified field. */ like(field: string, value: string): DataSharePredicates; /** - * Configures the DataSharePredicates to match the fields whose data type is string and value is + * Configure the DataSharePredicates to match the fields whose data type is string and value is * similar to a specified string. + * This method is similar to unlike of the SQL statement. * - * @note This method is similar to unlike of the SQL statement. * @since 9 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi * @param field Indicates the column name in the database table. * @param value Indicates the value to match with the DataSharePredicates. The percent sign (%) in the value * is a wildcard (like * in a regular expression). - * @return Returns the DataSharePredicates that match the specified field. + * @returns Returns the DataSharePredicates that match the specified field. */ unlike(field: string, value: string): DataSharePredicates; /** - * Configures DataSharePredicates to match the specified field whose data type is string and the value contains + * Configure DataSharePredicates to match the specified field whose data type is string and the value contains * a wildcard. + * Different from like, the input parameters of this method are case-sensitive. * - * @note Different from like, the input parameters of this method are case-sensitive. * @since 9 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi * @param field Indicates the column name in the database table. * @param value Indicates the value to match with DataSharePredicates. - * @return Returns the SQL statement with the specified DataSharePredicates. + * @returns Returns the SQL statement with the specified DataSharePredicates. */ glob(field: string, value: string): DataSharePredicates; @@ -216,12 +215,12 @@ declare namespace dataSharePredicates { * @param field Indicates the column name. * @param low Indicates the minimum value. * @param high Indicates the maximum value. - * @return Returns the SQL query statement with the specified DataSharePredicates. + * @returns Returns the SQL query statement with the specified DataSharePredicates. */ between(field: string, low: ValueType, high: ValueType): DataSharePredicates; /** - * Configures DataSharePredicates to match the specified field whose data type is int and value is + * Configure DataSharePredicates to match the specified field whose data type is int and value is * out of a given range. * * @since 9 @@ -230,7 +229,7 @@ declare namespace dataSharePredicates { * @param field Indicates the column name in the database table. * @param low Indicates the minimum value to match with DataSharePredicates. * @param high Indicates the maximum value to match with DataSharePredicates. - * @return Returns the SQL query statement with the specified DataSharePredicates. + * @returns Returns the SQL query statement with the specified DataSharePredicates. */ notBetween(field: string, low: ValueType, high: ValueType): DataSharePredicates; @@ -242,7 +241,7 @@ declare namespace dataSharePredicates { * @systemapi * @param field Indicates the column name. * @param value Indicates the String field. - * @return Returns the SQL query statement with the specified DataSharePredicates. + * @returns Returns the SQL query statement with the specified DataSharePredicates. */ greaterThan(field: string, value: ValueType): DataSharePredicates; @@ -254,7 +253,7 @@ declare namespace dataSharePredicates { * @systemapi * @param field Indicates the column name. * @param value Indicates the String field. - * @return Returns the SQL query statement with the specified DataSharePredicates. + * @returns Returns the SQL query statement with the specified DataSharePredicates. */ lessThan(field: string, value: ValueType): DataSharePredicates; @@ -266,7 +265,7 @@ declare namespace dataSharePredicates { * @systemapi * @param field Indicates the column name. * @param value Indicates the String field. - * @return Returns the SQL query statement with the specified DataSharePredicates. + * @returns Returns the SQL query statement with the specified DataSharePredicates. */ greaterThanOrEqualTo(field: string, value: ValueType): DataSharePredicates; @@ -278,7 +277,7 @@ declare namespace dataSharePredicates { * @systemapi * @param field Indicates the column name. * @param value Indicates the String field. - * @return Returns the SQL query statement with the specified DataSharePredicates. + * @returns Returns the SQL query statement with the specified DataSharePredicates. */ lessThanOrEqualTo(field: string, value: ValueType): DataSharePredicates; @@ -290,7 +289,7 @@ declare namespace dataSharePredicates { * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi * @param field Indicates the column name for sorting the return list. - * @return Returns the SQL query statement with the specified DataSharePredicates. + * @returns Returns the SQL query statement with the specified DataSharePredicates. */ orderByAsc(field: string): DataSharePredicates; @@ -302,7 +301,7 @@ declare namespace dataSharePredicates { * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi * @param field Indicates the column name for sorting the return list. - * @return Returns the SQL query statement with the specified DataSharePredicates. + * @returns Returns the SQL query statement with the specified DataSharePredicates. */ orderByDesc(field: string): DataSharePredicates; @@ -312,7 +311,7 @@ declare namespace dataSharePredicates { * @since 9 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi - * @return Returns the SQL query statement with the specified DataSharePredicates. + * @returns Returns the SQL query statement with the specified DataSharePredicates. */ distinct(): DataSharePredicates; @@ -324,35 +323,35 @@ declare namespace dataSharePredicates { * @systemapi * @param total Represents the specified number of results. * @param offset Indicates the starting position. - * @return Returns the query object. + * @returns Returns the query object. */ limit(total: number, offset: number): DataSharePredicates; /** - * Configures {@code DataSharePredicates} to group query results by specified columns. + * Configure {@code DataSharePredicates} to group query results by specified columns. * * @since 9 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi * @param fields Indicates the specified columns by which query results are grouped. - * @return Returns the DataSharePredicates with the specified columns by which query results are grouped. + * @returns Returns the DataSharePredicates with the specified columns by which query results are grouped. */ groupBy(fields: Array): DataSharePredicates; /** - * Configures {@code DataSharePredicates} to specify the index column. + * Configure {@code DataSharePredicates} to specify the index column. + * Before using this method, you need to create an index column. * - * @note Before using this method, you need to create an index column. * @since 9 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi * @param field Indicates the name of the index column. - * @return Returns DataSharePredicates with the specified index column. + * @returns Returns DataSharePredicates with the specified index column. */ indexedBy(field: string): DataSharePredicates; /** - * Configures {@code DataSharePredicates} to match the specified field whose data type is ValueType array and values + * Configure {@code DataSharePredicates} to match the specified field whose data type is ValueType array and values * are within a given range. * * @since 9 @@ -360,12 +359,12 @@ declare namespace dataSharePredicates { * @systemapi * @param field Indicates the column name in the database table. * @param values Indicates the values to match with DataSharePredicates. - * @return Returns DataSharePredicates that matches the specified field. + * @returns Returns DataSharePredicates that matches the specified field. */ in(field: string, value: Array): DataSharePredicates; /** - * Configures {@code DataSharePredicates} to match the specified field whose data type is String array and values + * Configure {@code DataSharePredicates} to match the specified field whose data type is String array and values * are out of a given range. * * @since 9 @@ -373,29 +372,29 @@ declare namespace dataSharePredicates { * @systemapi * @param field Indicates the column name in the database table. * @param values Indicates the values to match with DataSharePredicates. - * @return Returns DataSharePredicates that matches the specified field. + * @returns Returns DataSharePredicates that matches the specified field. */ notIn(field: string, value: Array): DataSharePredicates; /** - * Configures {@code DataSharePredicates} Creates a query condition using the specified key prefix. + * Configure {@code DataSharePredicates} Creates a query condition using the specified key prefix. * * @since 9 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi * @param prefix Represents the specified key prefix. - * @return Returns the query object. + * @returns Returns the query object. */ prefixKey(prefix: string): DataSharePredicates; /** - * Configures {@code DataSharePredicates} to match the specified value whose key is within a given range. + * Configure {@code DataSharePredicates} to match the specified value whose key is within a given range. * * @since 9 * @syscap SystemCapability.DistributedDataManager.DataShare.Core * @systemapi * @param keys Represents the key names. - * @return Returns the query object. + * @returns Returns the query object. */ inKeys(keys: Array): DataSharePredicates; } diff --git a/api/@ohos.data.distributedData.d.ts b/api/@ohos.data.distributedData.d.ts index e020a0403156886ce840b91c9e0a6fcb6cf666f1..e21dc7b043f7a966e43727284d01302769614799 100644 --- a/api/@ohos.data.distributedData.d.ts +++ b/api/@ohos.data.distributedData.d.ts @@ -13,52 +13,41 @@ * limitations under the License. */ -import { AsyncCallback, Callback } from './basic'; -import { ValuesBucket } from './@ohos.data.ValuesBucket'; -import dataSharePredicates from './@ohos.data.dataSharePredicates'; -import DataShareResultSet from './@ohos.data.DataShareResultSet'; -import Context from './application/Context'; +import {AsyncCallback, Callback} from './basic'; /** - * Providers interfaces to creat a {@link KVManager} istances. - * @since 7 + * Providers interfaces to creat a {@link KVManager} instance. * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore */ - declare namespace distributedData { /** * Provides configuration information for {@link KVManager} instances, * including the caller's package name and distributed network type. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVManagerConfig */ interface KVManagerConfig { /** * Indicates the user information - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 */ userInfo: UserInfo; /** * Indicates the bundleName - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVManagerConfig#bundleName */ bundleName: string; - - /** - * Indicates the ability or hap context - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A - * @Note: if swap the area, you should close all the KV store and use the new Context to create the KVManager - */ - context: Context; } /** @@ -67,24 +56,24 @@ declare namespace distributedData { *

          This class provides methods for obtaining the user ID and type, setting the user ID and type, * and checking whether two users are the same. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 */ interface UserInfo { - /** - * Indicates the user ID to set - * @since 7 + /** + * Indicates the user ID to set * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 */ userId?: string; - /** - * Indicates the user type to set - * @since 7 + /** + * Indicates the user type to set * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 */ userType?: UserType; } @@ -92,72 +81,80 @@ declare namespace distributedData { /** * Enumerates user types. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 */ enum UserType { - /** - * Indicates a user that logs in to different devices using the same account. - * @since 7 + /** + * Indicates a user that logs in to different devices using the same account. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 */ SAME_USER_ID = 0 } /** * KVStore constants - * @since 7 + * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Constants */ namespace Constants { /** * max key length. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Constants#MAX_KEY_LENGTH */ const MAX_KEY_LENGTH = 1024; /** * max value length. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Constants#MAX_VALUE_LENGTH */ const MAX_VALUE_LENGTH = 4194303; /** * max device coordinate key length. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Constants#MAX_KEY_LENGTH_DEVICEs */ const MAX_KEY_LENGTH_DEVICE = 896; /** * max store id length. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Constants#MAX_STORE_ID_LENGTH */ const MAX_STORE_ID_LENGTH = 128; /** * max query length. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Constants#MAX_QUERY_LENGTH */ const MAX_QUERY_LENGTH = 512000; /** * max batch operation size. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Constants#MAX_BATCH_SIZE */ const MAX_BATCH_SIZE = 128; } @@ -167,56 +164,63 @@ declare namespace distributedData { * *

          {@code ValueType} is obtained based on the value. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.ValueType */ enum ValueType { - /** - * Indicates that the value type is string. - * @since 7 + /** + * Indicates that the value type is string. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.ValueType#STRING */ STRING = 0, /** - * Indicates that the value type is int. - * @since 7 + * Indicates that the value type is int. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.ValueType#INTEGER */ INTEGER = 1, - /** - * Indicates that the value type is float. - * @since 7 + /** + * Indicates that the value type is float. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.ValueType#FLOAT */ FLOAT = 2, - /** - * Indicates that the value type is byte array. - * @since 7 + /** + * Indicates that the value type is byte array. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.ValueType#BYTE_ARRAY * */ BYTE_ARRAY = 3, - /** - * Indicates that the value type is boolean. - * @since 7 + /** + * Indicates that the value type is boolean. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.ValueType#BOOLEAN * */ BOOLEAN = 4, - /** - * Indicates that the value type is double. - * @since 7 + /** + * Indicates that the value type is double. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.ValueType#DOUBLE */ DOUBLE = 5 } @@ -224,26 +228,29 @@ declare namespace distributedData { /** * Obtains {@code Value} objects stored in a {@link KVStore} database. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Value */ interface Value { /** * Indicates value type - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @see ValueType * @type {number} * @memberof Value + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Value#type */ type: ValueType; /** * Indicates value - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Value#value */ value: Uint8Array | string | number | boolean; } @@ -251,23 +258,26 @@ declare namespace distributedData { /** * Provides key-value pairs stored in the distributed database. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Entry */ interface Entry { /** * Indicates key - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Entry#key */ key: string; /** * Indicates value - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Entry#value */ value: Value; } @@ -278,37 +288,42 @@ declare namespace distributedData { *

          If you have subscribed to {@code KVStore}, you will receive data change notifications and obtain the changed data * from the parameters in callback methods upon data insertion, update, or deletion. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.ChangeNotification */ interface ChangeNotification { - /** - * Indicates data addition records. - * @since 7 + /** + * Indicates data addition records. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.ChangeNotification#insertEntries */ insertEntries: Entry[]; - /** + /** * Indicates data update records. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.ChangeNotification#updateEntries */ updateEntries: Entry[]; - /** - * Indicates data deletion records. - * @since 7 + /** + * Indicates data deletion records. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.ChangeNotification#deleteEntries */ deleteEntries: Entry[]; /** * Indicates from device id. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.ChangeNotification#deviceId */ deviceId: string; } @@ -316,30 +331,34 @@ declare namespace distributedData { /** * Indicates the database synchronization mode. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SyncMode */ enum SyncMode { - /** + /** * Indicates that data is only pulled from the remote end. - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SyncMode#PULL_ONLY */ PULL_ONLY = 0, - /** - * Indicates that data is only pushed from the local end. - * @since 7 + /** + * Indicates that data is only pushed from the local end. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SyncMode#PUSH_ONLY */ PUSH_ONLY = 1, - /** - * Indicates that data is pushed from the local end, and then pulled from the remote end. - * @since 7 + /** + * Indicates that data is pushed from the local end, and then pulled from the remote end. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SyncMode#PUSH_PULL */ PUSH_PULL = 2 } @@ -347,32 +366,36 @@ declare namespace distributedData { /** * Describes the subscription type. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SubscribeType */ enum SubscribeType { - /** - * Subscription to local data changes - * @since 7 + /** + * Subscription to local data changes * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A - */ + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SubscribeType#SUBSCRIBE_TYPE_LOCAL + */ SUBSCRIBE_TYPE_LOCAL = 0, - /** - * Subscription to remote data changes - * @since 7 + /** + * Subscription to remote data changes * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A - */ + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SubscribeType#SUBSCRIBE_TYPE_REMOTE + */ SUBSCRIBE_TYPE_REMOTE = 1, - /** - * Subscription to both local and remote data changes - * @since 7 + /** + * Subscription to both local and remote data changes * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SubscribeType#SUBSCRIBE_TYPE_ALL */ SUBSCRIBE_TYPE_ALL = 2, } @@ -380,32 +403,35 @@ declare namespace distributedData { /** * Describes the {@code KVStore} type. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreType */ enum KVStoreType { - /** - * Device-collaborated database, as specified by {@code DeviceKVStore} - * @since 7 + /** + * Device-collaboration database, as specified by {@code DeviceKVStore} * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreType#DEVICE_COLLABORATION */ DEVICE_COLLABORATION = 0, - /** - * Single-version database, as specified by {@code SingleKVStore} - * @since 7 + /** + * Single-version database, as specified by {@code SingleKVStore} * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreType#SINGLE_VERSION */ SINGLE_VERSION = 1, - /** - * Multi-version database, as specified by {@code MultiKVStore} - * @since 7 + /** + * Multi-version database, as specified by {@code MultiKVStore} * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @import N/A + * @since 7 + * @deprecated since 9 */ MULTI_VERSION = 2, } @@ -413,17 +439,18 @@ declare namespace distributedData { /** * Describes the {@code KVStore} type. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SecurityLevel */ enum SecurityLevel { /** * NO_LEVEL: mains not set the security level. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @import N/A + * @since 7 + * @deprecated since 9 */ NO_LEVEL = 0, @@ -431,9 +458,9 @@ declare namespace distributedData { * S0: mains the db is public. * There is no impact even if the data is leaked. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 */ S0 = 1, @@ -441,9 +468,10 @@ declare namespace distributedData { * S1: mains the db is low level security * There are some low impact, when the data is leaked. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SecurityLevel#S1 */ S1 = 2, @@ -451,9 +479,10 @@ declare namespace distributedData { * S2: mains the db is middle level security * There are some major impact, when the data is leaked. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SecurityLevel#S2 */ S2 = 3, @@ -461,9 +490,10 @@ declare namespace distributedData { * S3: mains the db is high level security * There are some severity impact, when the data is leaked. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SecurityLevel#S3 */ S3 = 5, @@ -471,9 +501,10 @@ declare namespace distributedData { * S4: mains the db is critical level security * There are some critical impact, when the data is leaked. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SecurityLevel#S4 */ S4 = 6, } @@ -484,614 +515,746 @@ declare namespace distributedData { *

          You can determine whether to create another database if a {@code KVStore} database is missing, * whether to encrypt the database, and the database type. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Options */ interface Options { /** - * Indicates whether to createa database when the database file does not exist - * @since 7 + * Indicates whether to create a database when the database file does not exist * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Options#createIfMissing */ createIfMissing?: boolean; /** * Indicates setting whether database files are encrypted - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Options#encrypt */ encrypt?: boolean; /** * Indicates setting whether to back up database files - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Options#backup */ backup?: boolean; /** * Indicates setting whether database files are automatically synchronized - * @since 7 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @import N/A + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Options#autoSync */ autoSync?: boolean; /** - * Indicates setting the databse type - * @since 7 + * Indicates setting the database type * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Options#kvStoreType */ kvStoreType?: KVStoreType; /** * Indicates setting the database security level - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Options#securityLevel */ securityLevel?: SecurityLevel; /** - * Indicates schema object - * @since 8 + * Indicates schema object * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @import N/A + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Options#schema */ schema?: Schema; } /** * Represents the database schema. - * + * * You can create Schema objects and put them in Options when creating or opening the database. - * - * @since 8 + * * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @import N/A + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Schema */ class Schema { /** * A constructor used to create a Schema instance. - * - * @since 8 + * * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Schema#constructor */ constructor() + /** * Indicates the root json object. - * - * @since 8 + * * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Schema#root */ - root: FieldNode; + root: FieldNode; /** * Indicates the string array of json. - * - * @since 8 + * * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Schema#indexes */ - indexes: Array; + indexes: Array; /** * Indicates the mode of schema. - * - * @since 8 + * * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Schema#mode */ mode: number; /** - * Indicates the skipsize of schema. - * - * @since 8 + * Indicates the skip size of schema. + * * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Schema#skip */ skip: number; } /** * Represents a node of a {@link Schema} instance. - * + * *

          Through the {@link Schema} instance, you can define the fields contained in the values stored in a database. - * + * *

          A FieldNode of the {@link Schema} instance is either a leaf or a non-leaf node. - * + * *

          The leaf node must have a value; the non-leaf node must have a child {@code FieldNode}. - * - * @since 8 + * * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @import N/A + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.FieldNode */ class FieldNode { /** * A constructor used to create a FieldNode instance with the specified field. * name Indicates the field node name. - * - * @since 8 + * * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.FieldNode#constructor */ constructor(name: string) + /** * Adds a child node to this {@code FieldNode}. - * + * *

          Adding a child node makes this node a non-leaf node. Field value will be ignored if it has child node. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @param child The field node to append. + * + * @param child The field node to append. * @returns Returns true if the child node is successfully added to this {@code FieldNode}; returns false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.FieldNode#appendChild */ appendChild(child: FieldNode): boolean; + + /** + * Indicates the default value of field node. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.FieldNode#default + */ + default: string; /** - * Indicates the default value of fieldnode. - * + * Indicates the nullable of database field. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.FieldNode#nullable + */ + nullable: boolean; + /** + * Indicates the type of value. + * * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.FieldNode#type */ - default: string; - /** - * Indicates the nullable of database field. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - */ - nullable: boolean; - /** - * Indicates the type of value. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - */ - type: number; + type: number; } /** * Provide methods to obtain the result set of the {@code KvStore} database. - * + * *

          The result set is created by using the {@code getResultSet} method in the {@code DeviceKVStore} class. This interface also provides * methods for moving the data read position in the result set. - * - * @since 7 + * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet */ interface KvStoreResultSet { /** * Obtains the number of lines in a result set. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @returns Returns the number of lines. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#getCount */ getCount(): number; + /** * Obtains the current read position in a result set. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @returns Returns the current read position. The read position starts with 0. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#getPosition */ getPosition(): number; + /** * Moves the read position to the first line. - * + * *

          If the result set is empty, false is returned. - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @returns Returns true if the operation succeeds; return false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#moveToFirst */ moveToFirst(): boolean; + /** * Moves the read position to the last line. - * + * *

          If the result set is empty, false is returned. - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @returns Returns true if the operation succeeds; return false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#moveToLast */ moveToLast(): boolean; + /** * Moves the read position to the next line. - * + * *

          If the result set is empty or the data in the last line is being read, false is returned. - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @returns Returns true if the operation succeeds; return false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#moveToNext */ moveToNext(): boolean; + /** * Moves the read position to the previous line. - * + * *

          If the result set is empty or the data in the first line is being read, false is returned. - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @returns Returns true if the operation succeeds; return false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#moveToPrevious */ moveToPrevious(): boolean; + /** * Moves the read position by a relative offset to the current position. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param offset Indicates the relative offset to the current position. Anegative offset indicates moving backwards, and a - * positive offset indicates moving forewards. Forexample, if the current position is entry 1 and thisoffset is 2, - * the destination position will be entry 3; ifthe current position is entry 3 and this offset is -2, + * + * @param offset Indicates the relative offset to the current position. A negative offset indicates moving backwards, and a + * positive offset indicates moving forwards. For example, if the current position is entry 1 and this offset is 2, + * the destination position will be entry 3; if the current position is entry 3 and this offset is -2, * the destination position will be entry 1. The valid final position after moving forwards starts with 0. If the * final position is invalid, false will be returned. * @returns Returns true if the operation succeeds; return false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#move */ move(offset: number): boolean; + /** * Moves the read position from 0 to an absolute position. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @param position Indicates the absolute position. * @returns Returns true if the operation succeeds; return false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#moveToPosition */ moveToPosition(position: number): boolean; + /** * Checks whether the read position is the first line. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - + * * @returns Returns true if the read position is the first line; returns false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#isFirst */ isFirst(): boolean; + /** * Checks whether the read position is the last line. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @returns Returns true if the read position is the last line; returns false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#isLast */ isLast(): boolean; + /** * Checks whether the read position is before the last line. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @returns Returns true if the read position is before the first line; returns false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#isBeforeFirst */ isBeforeFirst(): boolean; + /** * Checks whether the read position is after the last line. - * - * @since 8 + * + * @returns Returns true if the read position is after the last line; returns false otherwise. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @returns Returns true if the read position is after the last line; returns false otherwise. + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#isAfterLast */ isAfterLast(): boolean; + /** * Obtains a key-value pair. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @returns Returns a key-value pair. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVStoreResultSet#getEntry */ getEntry(): Entry; } /** * Represents a database query using a predicate. - * + * *

          This class provides a constructor used to create a {@code Query} instance, which is used to query data matching specified * conditions in the database. - * + * *

          This class also provides methods for adding predicates to the {@code Query} instance. - * - * @since 8 + * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query */ class Query { /** * A constructor used to create a Query instance. - * - * @since 8 + * * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#constructor */ - constructor() + constructor() + /** * Resets this {@code Query} object. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @returns Returns the reset {@code Query} object. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#reset */ reset(): Query; + /** * Constructs a {@code Query} object to query entries with the specified field whose value is equal to the specified long value. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value IIndicates the long value. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#equalTo */ - equalTo(field: string, value: number|string|boolean): Query; + equalTo(field: string, value: number | string | boolean): Query; + /** * Constructs a {@code Query} object to query entries with the specified field whose value is not equal to the specified int value. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value Indicates the int value. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#notEqualTo */ - notEqualTo(field: string, value: number|string|boolean): Query; + notEqualTo(field: string, value: number | string | boolean): Query; + /** * Constructs a {@code Query} object to query entries with the specified field whose value is greater than or equal to the * specified int value. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value Indicates the int value. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#greaterThan */ - greaterThan(field: string, value: number|string|boolean): Query; + greaterThan(field: string, value: number | string | boolean): Query; + /** * Constructs a {@code Query} object to query entries with the specified field whose value is less than the specified int value. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value Indicates the int value. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#lessThan */ - lessThan(field: string, value: number|string): Query; + lessThan(field: string, value: number | string): Query; + /** * Constructs a {@code Query} object to query entries with the specified field whose value is greater than or equal to the * specified int value. - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value Indicates the int value. * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#greaterThanOrEqualTo */ - greaterThanOrEqualTo(field: string, value: number|string): Query; + greaterThanOrEqualTo(field: string, value: number | string): Query; + /** * Constructs a {@code Query} object to query entries with the specified field whose value is less than or equal to the * specified int value. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value Indicates the int value. - * @returns Returns the {@coed Query} object. + * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#lessThanOrEqualTo */ - lessThanOrEqualTo(field: string, value: number|string): Query; + lessThanOrEqualTo(field: string, value: number | string): Query; + /** * Constructs a {@code Query} object to query entries with the specified field whose value is null. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. - * @returns Returns the {@coed Query} object. + * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#isNull */ isNull(field: string): Query; + /** * Constructs a {@code Query} object to query entries with the specified field whose value is within the specified int value list. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param valueList Indicates the int value list. - * @returns Returns the {@coed Query} object. + * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#inNumber */ inNumber(field: string, valueList: number[]): Query; + /** * Constructs a {@code Query} object to query entries with the specified field whose value is within the specified string value list. - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param valueList Indicates the string value list. - * @returns Returns the {@coed Query} object. + * @returns Returns the {@coed Query} object. * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#inString */ inString(field: string, valueList: string[]): Query; + /** * Constructs a {@code Query} object to query entries with the specified field whose value is not within the specified int value list. - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param valueList Indicates the int value list. * @returns Returns the {@coed Query} object. - * @throws Throws this exception if input is invalid. + * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#notInNumber */ notInNumber(field: string, valueList: number[]): Query; + /** * Constructs a {@code Query} object to query entries with the specified field whose value is not within the specified string value list. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param valueList Indicates the string value list. - * @returns Returns the {@coed Query} object. - * @throws Throws this exception if input is invalid. + * @returns Returns the {@coed Query} object. + * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#notInString */ notInString(field: string, valueList: string[]): Query; + /** * Constructs a {@code Query} object to query entries with the specified field whose value is similar to the specified string value. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value Indicates the string value. - * @returns Returns the {@coed Query} object. - * @throws Throws this exception if input is invalid. + * @returns Returns the {@coed Query} object. + * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#like */ like(field: string, value: string): Query; + /** * Constructs a {@code Query} object to query entries with the specified field whose value is not similar to the specified string value. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @param value Indicates the string value. - * @returns Returns the {@coed Query} object. - * @throws Throws this exception if input is invalid. + * @returns Returns the {@coed Query} object. + * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#unlike */ unlike(field: string, value: string): Query; + /** * Constructs a {@code Query} object with the and condition. - * + * *

          Multiple predicates should be connected using the and or or condition. - * - * @since 8 + * + * @returns Returns the {@coed Query} object. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A - * @returns Returns the {@coed Query} object. + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#and */ and(): Query; + /** * Constructs a {@code Query} object with the or condition. - * + * *

          Multiple predicates should be connected using the and or or condition. - * - * @since 8 + * + * @returns Returns the {@coed Query} object. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A - * @returns Returns the {@coed Query} object. + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#or */ or(): Query; + /** * Constructs a {@code Query} object to sort the query results in ascending order. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. - * @returns Returns the {@coed Query} object. - * @throws Throws this exception if input is invalid. + * @returns Returns the {@coed Query} object. + * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#orderByAsc */ orderByAsc(field: string): Query; + /** * Constructs a {@code Query} object to sort the query results in descending order. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the field, which must start with $. and cannot contain ^. * @returns Returns the {@coed Query} object. - * @throws Throws this exception if input is invalid. + * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#orderByDesc */ orderByDesc(field: string): Query; + /** * Constructs a {@code Query} object to specify the number of results and the start position. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param total Indicates the number of results. * @param offset Indicates the start position. * @returns Returns the {@coed Query} object. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#limit */ limit(total: number, offset: number): Query; + /** * Creates a {@code query} condition with a specified field that is not null. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param field Indicates the specified field. * @returns Returns the {@coed Query} object. - * @throws Throws this exception if input is invalid. + * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#isNotNull */ isNotNull(field: string): Query; + /** * Creates a query condition group with a left bracket. - * + * *

          Multiple query conditions in an {@code Query} object can be grouped. The query conditions in a group can be used as a * whole to combine with other query conditions. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @returns Returns the {@coed Query} object. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#beginGroup */ beginGroup(): Query; + /** * Creates a query condition group with a right bracket. - * + * *

          Multiple query conditions in an {@code Query} object can be grouped. The query conditions in a group can be used as a * whole to combine with other query conditions. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @returns Returns the {@coed Query} object. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#endGroup */ endGroup(): Query; + /** * Creates a query condition with a specified key prefix. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param prefix Indicates the specified key prefix. * @returns Returns the {@coed Query} object. - * @throws Throws this exception if input is invalid. + * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#prefixKey */ prefixKey(prefix: string): Query; + /** * Sets a specified index that will be preferentially used for query. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @param index Indicates the index to set. * @returns Returns the {@coed Query} object. - * @throws Throws this exception if input is invalid. + * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#setSuggestIndex */ setSuggestIndex(index: string): Query; - /** - * Add device ID key prefix.Used by {@code DeviceKVStore}. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A - * @param deviceId Specify device id to query from. - * @return Returns the {@code Query} object with device ID prefix added. - * @throw Throws this exception if input is invalid. - */ - deviceId(deviceId:string):Query; - /** - * Get a String that repreaents this {@code Query}. - * - *

          The String would be parsed to DB query format. - * The String length should be no longer than 500kb. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A - * @return String representing this {@code Query}. - */ - getSqlLike():string; + + /** + * Add device ID key prefix.Used by {@code DeviceKVStore}. + * + * @param deviceId Specify device id to query from. + * @returns Returns the {@code Query} object with device ID prefix added. + * @throws Throws this exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#deviceId + */ + deviceId(deviceId: string): Query; + + /** + * Get a String that represents this {@code Query}. + * + *

          The String would be parsed to DB query format. + * The String length should be no longer than 500kb. + * + * @returns String representing this {@code Query}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.Query#getSqlLike + */ + getSqlLike(): string; } /** @@ -1102,227 +1265,196 @@ declare namespace distributedData { * with input parameter {@code Options}. Distributed database types are defined in {@code KVStoreType}, * including {@code SingleKVStore}. * - * @since 7 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @version 1 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore */ interface KVStore { /** * Writes a key-value pair of the string type into the {@code KvStore} database. * *

          If you do not want to synchronize this key-value pair to other devices, set the write option in the local database. - * - * @since 7 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @param key Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. * Spaces before and after the key will be cleared. * @param value Indicates the string value, which must be less than 4 MB as a UTF-8 byte array. - * @throws Throws this exception if any of the following errors - * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and - * {@code DB_ERROR}. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#put */ put(key: string, value: Uint8Array | string | number | boolean, callback: AsyncCallback): void; put(key: string, value: Uint8Array | string | number | boolean): Promise; - /** - * Writes a value of the valuesbucket type into the {@code KvStore} database. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @systemapi - * @param value Indicates the data record to put. - * Spaces before and after the key will be cleared. - * @throws Throws this exception if any of the following errors - * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and - * {@code DB_ERROR}. - */ - putBatch(value: Array, callback: AsyncCallback): void; - putBatch(value: Array): Promise; - /** * Deletes the key-value pair based on a specified key. * - * @since 7 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param key Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. * Spaces before and after the key will be cleared. - * @throws Throws this exception if any of the following errors + * @throws Throws this exception if any of the following errors * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and * {@code DB_ERROR}, and {@code KEY_NOT_FOUND}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#delete */ delete(key: string, callback: AsyncCallback): void; delete(key: string): Promise; - /** - * Deletes the key-value pair based on a specified key. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @systemapi - * @param predicates Indicates the datasharePredicates. - * Spaces before and after the key will be cleared. - * @throws Throws this exception if any of the following errors - * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and - * {@code DB_ERROR}. - */ - delete(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback); - delete(predicates: dataSharePredicates.DataSharePredicates): Promise; - /** - * Backs up a database in a specified name. + * Registers a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback in + * {@code KvStoreObserver} will be invoked. * - * @since 9 + * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. + * @param listener Indicates the observer of data change events in the distributed database. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, + * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param file Indicates the name that saves the database backup. + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#on */ - backup(file:string, callback: AsyncCallback):void; - backup(file:string): Promise; + on(event: 'dataChange', type: SubscribeType, listener: Callback): void; /** - * Restores a database from a specified database file. + * Subscribe the {@code KvStore} database based on the specified subscribeType and {@code KvStoreObserver}. * - * @since 9 + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, + * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param file Indicates the name that saves the database file. + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#on */ - restore(file:string, callback: AsyncCallback):void; - restore(file:string): Promise; + on(event: 'syncComplete', syncCallback: Callback>): void; /** - * Delete a backup files based on a specified name. + * Unsubscribe the {@code KvStore} database based on the specified subscribeType and {@code KvStoreObserver}. * - * @since 9 + * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. + * @throws Throws this exception if any of the following errors + * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, + * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param files list Indicates the name that backup file to delete. + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#off */ - deleteBackup(files:Array, callback: AsyncCallback>):void; - deleteBackup(files:Array): Promise>; + off(event: 'dataChange', listener?: Callback): void; /** - * Registers a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback in - * {@code KvStoreObserver} will be invoked. + * UnRegister the {@code KvStore} database synchronization callback. * - * @since 7 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. - * @param listener Indicates the observer of data change events in the distributed database. - * @throws Throws this exception if any of the following errors + * @param syncCallback Indicates the callback used to send the synchronization result to caller. + * @throws Throws this exception if any of the following errors * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. - */ - on(event: 'dataChange', type: SubscribeType, listener: Callback): void; - - /** - * Subscribes from the {@code KvStore} database based on the specified subscribeType and {@code KvStoreObserver}. - * - * @since 7 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @throws Throws this exception if any of the following errors - * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, - * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. - */ - on(event: 'syncComplete', syncCallback: Callback>): void; - - /** - * Unsubscribes from the {@code KvStore} database based on the specified subscribeType and {@code KvStoreObserver}. - * * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. - * @throws Throws this exception if any of the following errors - * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, - * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. - */ - off(event:'dataChange', listener?: Callback): void; - - /** - * UnRegister Synchronizes {@code KvStore} database callback. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param syncCallback Indicates the callback used to send the synchronization result to caller. - * @throws Throws this exception if any of the following errors - * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, - * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#off */ off(event: 'syncComplete', syncCallback?: Callback>): void; /** * Inserts key-value pairs into the {@code KvStore} database in batches. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @param entries Indicates the key-value pairs to be inserted in batches. * @throws Throws this exception if a database error occurs. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#putBatch */ putBatch(entries: Entry[], callback: AsyncCallback): void; putBatch(entries: Entry[]): Promise; /** * Deletes key-value pairs in batches from the {@code KvStore} database. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @param keys Indicates the key-value pairs to be deleted in batches. * @throws Throws this exception if a database error occurs. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#deleteBatch */ deleteBatch(keys: string[], callback: AsyncCallback): void; deleteBatch(keys: string[]): Promise; /** * Starts a transaction operation in the {@code KvStore} database. - * + * *

          After the database transaction is started, you can submit or roll back the operation. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @throws Throws this exception if a database error occurs. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#startTransaction */ startTransaction(callback: AsyncCallback): void; startTransaction(): Promise; /** * Submits a transaction operation in the {@code KvStore} database. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param callback + * + * @param callback * @throws Throws this exception if a database error occurs. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#commit */ commit(callback: AsyncCallback): void; commit(): Promise; /** * Rolls back a transaction operation in the {@code KvStore} database. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @throws Throws this exception if a database error occurs. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#rollback */ rollback(callback: AsyncCallback): void; rollback(): Promise; /** * Sets whether to enable synchronization. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @param enabled Specifies whether to enable synchronization. The value true means to enable * synchronization, and false means the opposite. * @throws Throws this exception if an internal service error occurs. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#enableSync */ enableSync(enabled: boolean, callback: AsyncCallback): void; enableSync(enabled: boolean): Promise; /** * Sets synchronization range labels. - * + * *

          The labels determine the devices with which data will be synchronized. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @param localLabels Indicates the synchronization labels of the local device. * @param remoteSupportLabels Indicates the labels of the devices with which data will be synchronized. * @throws Throws this exception if an internal service error occurs. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#setSyncRange */ setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: AsyncCallback): void; setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise; @@ -1338,49 +1470,53 @@ declare namespace distributedData { * The {@code SingleKVStore} database does not support * synchronous transactions, or data search using snapshots. * - * @since 7 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @version 1 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore */ interface SingleKVStore extends KVStore { /** * Obtains the {@code String} value of a specified key. - * - * @since 7 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param key Indicates the key of the boolean value to be queried. * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}, and {@code KEY_NOT_FOUND}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#get */ get(key: string, callback: AsyncCallback): void; get(key: string): Promise; /** * Obtains all key-value pairs that match a specified key prefix. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param keyPrefix Indicates the key prefix to match. * @returns Returns the list of all key-value pairs that match the specified key prefix. * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#getEntries */ getEntries(keyPrefix: string, callback: AsyncCallback): void; getEntries(keyPrefix: string): Promise; /** * Obtains the list of key-value pairs matching the specified {@code Query} object. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param query Indicates the {@code Query} object. * @returns Returns the list of key-value pairs matching the specified {@code Query} object. * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#getEntries */ getEntries(query: Query, callback: AsyncCallback): void; getEntries(query: Query): Promise; @@ -1391,463 +1527,445 @@ declare namespace distributedData { * {@code KvStoreResultSet} objects at the same time. If you have created four objects, calling this method will return a * failure. Therefore, you are advised to call the closeResultSet method to close unnecessary {@code KvStoreResultSet} objects * in a timely manner. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param keyPrefix Indicates the key prefix to match. * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#getResultSet */ getResultSet(keyPrefix: string, callback: AsyncCallback): void; getResultSet(keyPrefix: string): Promise; /** * Obtains the {@code KvStoreResultSet} object matching the specified {@code Query} object. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param query Indicates the {@code Query} object. * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#getResultSet */ getResultSet(query: Query, callback: AsyncCallback): void; getResultSet(query: Query): Promise; - /** - * Obtains the KvStoreResultSet object matching the specified Predicate object. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @systemapi - * @param predicates Indicates the datasharePredicates. - * Spaces before and after the key will be cleared. - * @throws Throws this exception if any of the following errors - * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and - * {@code DB_ERROR}. - */ - getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; - getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise; - /** * Closes a {@code KvStoreResultSet} object returned by getResultSet. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param resultSet Indicates the {@code KvStoreResultSet} object to close. * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#closeResultSet */ closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback): void; closeResultSet(resultSet: KvStoreResultSet): Promise; /** * Obtains the number of results matching the specified {@code Query} object. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * * @param query Indicates the {@code Query} object. * @returns Returns the number of results matching the specified {@code Query} object. * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#getResultSize */ getResultSize(query: Query, callback: AsyncCallback): void; getResultSize(query: Query): Promise; /** * void removeDeviceData​({@link String} deviceId) throws {@link KvStoreException} - * - * @since 8 + * * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#removeDeviceData */ removeDeviceData(deviceId: string, callback: AsyncCallback): void; removeDeviceData(deviceId: string): Promise; /** - * Synchronizes the database to the specified devices with the specified delay allowed. + * Synchronize the database to the specified devices with the specified delay allowed. * - * @since 7 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param deviceIds Indicates the list of devices to which to synchronize the database. * @param mode Indicates the synchronization mode. The value can be {@code PUSH}, {@code PULL}, or {@code PUSH_PULL}. * @param delayMs Indicates the delay allowed for the synchronization, in milliseconds. * @throws Throws this exception if any of the following errors * @permission ohos.permission.DISTRIBUTED_DATASYNC - * occurs: {@code INVALID_ARGUMENT}, + * occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. - */ - sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void - - /** - * Synchronizes the database to the specified devices with the specified delay allowed. - * - * @since 9 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param deviceIds Indicates the list of devices to which to synchronize the database. - * @param mode Indicates the synchronization mode. The value can be {@code PUSH}, {@code PULL}, or {@code PUSH_PULL}. - * @param delayMs Indicates the delay allowed for the synchronization, in milliseconds. - * @param query Indicates the {@code Query} object. - * @throws Throws this exception if any of the following errors - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * occurs: {@code INVALID_ARGUMENT}, - * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#sync */ - sync(deviceIds: string[], query: Query, mode: SyncMode, delayMs?: number): void; - + sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void; + /** - * Registers a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback in - * {@code KvStoreObserver} will be invoked. + * Register a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback + * in the {@code KvStoreObserver} will be invoked. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. * @param listener Indicates the observer of data change events in the distributed database. * @throws Throws this exception if no {@code SingleKvStore} database is available. * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#on */ - on(event: 'dataChange', type: SubscribeType, listener: Callback): void; + on(event: 'dataChange', type: SubscribeType, listener: Callback): void; /** - * Register Synchronizes SingleKvStore databases callback. + * Register a SingleKvStore database synchronization callback. *

          Sync result is returned through asynchronous callback. - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @param syncCallback Indicates the callback used to send the synchronization result to the caller. * @throws Throws this exception if no {@code SingleKvStore} database is available. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#on */ - on(event: 'syncComplete', syncCallback: Callback>): void; + on(event: 'syncComplete', syncCallback: Callback>): void; /** - * Unsubscribes from the SingleKvStore database based on the specified subscribeType and {@code KvStoreObserver}. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * Unsubscribe the SingleKvStore database based on the specified subscribeType and {@code KvStoreObserver}. + * * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. - * @throws Throws this exception if any of the following errors + * @throws Throws this exception if any of the following errors * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#off */ - off(event:'dataChange', listener?: Callback): void; + off(event: 'dataChange', listener?: Callback): void; /** - * UnRegister Synchronizes SingleKvStore databases callback. + * UnRegister the SingleKvStore database synchronization callback. + * + * @throws Throws this exception if no {@code SingleKvStore} database is available. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#off + */ + off(event: 'syncComplete', syncCallback?: Callback>): void; + + /** + * Sets the default delay allowed for database synchronization + * + * @param defaultAllowedDelayMs Indicates the default delay allowed for the database synchronization, in milliseconds. + * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, + * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @throws Throws this exception if no {@code SingleKvStore} database is available. + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#setSyncParam */ - off(event: 'syncComplete', syncCallback?: Callback>): void; - - - /** - * Sets the default delay allowed for database synchronization - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param defaultAllowedDelayMs Indicates the default delay allowed for the database synchronization, in milliseconds. - * @throws Throws this exception if any of the following errors occurs:{@code INVALID_ARGUMENT}, - * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and {@code DB_ERROR}. - */ - setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback): void; - setSyncParam(defaultAllowedDelayMs: number): Promise; - - /** - * Get the security level of the database. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @returns SecurityLevel {@code SecurityLevel} the security level of the database. - * @throws Throws this exception if any of the following errors occurs:{@code SERVER_UNAVAILABLE}, - * {@code IPC_ERROR}, and {@code DB_ERROR}. - */ - getSecurityLevel(callback: AsyncCallback): void; - getSecurityLevel(): Promise; + setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback): void; + setSyncParam(defaultAllowedDelayMs: number): Promise; + + /** + * Get the security level of the database. + * + * @returns SecurityLevel {@code SecurityLevel} the security level of the database. + * @throws Throws this exception if any of the following errors occurs:{@code SERVER_UNAVAILABLE}, + * {@code IPC_ERROR}, and {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.SingleKVStore#getSecurityLevel + */ + getSecurityLevel(callback: AsyncCallback): void; + getSecurityLevel(): Promise; } /** * Manages distributed data by device in a distributed system. - * + * *

          To create a {@code DeviceKVStore} database, you can use the {@link data.distributed.common.KVManager.getKvStore(Options, String)} * method with {@code KvStoreType} set to {@code DEVICE_COLLABORATION} for the input parameter Options. This database manages distributed * data by device, and cannot modify data synchronized from remote devices. When an application writes a key-value pair entry * into the database, the system automatically adds the ID of the device running the application to the key. - * - * @since 8 + * * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @import N/A + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore */ interface DeviceKVStore extends KVStore { /** * Obtains the {@code String} value matching a specified device ID and key. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @param deviceId Indicates the device to be queried. * @param key Indicates the key of the value to be queried. - * @return Returns the value matching the given criteria. + * @returns Returns the value matching the given criteria. * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}, and {@code KEY_NOT_FOUND}. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#get */ - get(deviceId: string, key: string, callback: AsyncCallback): void; - get(deviceId: string, key: string): Promise; - - /** - * Obtains all key-value pairs matching a specified device ID and key prefix. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @param deviceId Identifies the device whose data is to be queried. - * @param keyPrefix Indicates the key prefix to match. - * @returns Returns the list of all key-value pairs meeting the given criteria. - * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, - * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. - */ - getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; - getEntries(deviceId: string, keyPrefix: string): Promise; - - /** - * Obtains the list of key-value pairs matching the specified {@code Query} object. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @param query Indicates the {@code Query} object. - * @returns Returns the list of key-value pairs matching the specified {@code Query} object. - * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, - * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. - */ - getEntries(query: Query, callback: AsyncCallback): void; - getEntries(query: Query): Promise; - - /** - * Obtains the list of key-value pairs matching a specified device ID and {@code Query} object. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @param deviceId Indicates the ID of the device to which the key-value pairs belong. - * @param query Indicates the {@code Query} object. - * @returns Returns the list of key-value pairs matching the specified {@code Query} object. - */ - getEntries(deviceId: string, query: Query, callback: AsyncCallback): void; - getEntries(deviceId: string, query: Query): Promise; - - /** - * Obtains the {@code KvStoreResultSet} object matching the specified device ID and key prefix. - * - *

          The {@code KvStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. Each {@code KvStore} - * instance can have a maximum of four {@code KvStoreResultSet} objects at the same time. If you have created four objects, - * calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close unnecessary - * {@code KvStoreResultSet} objects in a timely manner. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @param deviceId Identifies the device whose data is to be queried. - * @param keyPrefix Indicates the key prefix to match. - * @returns Returns the {@code KvStoreResultSet} objects. - * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, - * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. - */ - getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; - getResultSet(deviceId: string, keyPrefix: string): Promise; - - /** - * Obtains the {@code KvStoreResultSet} object matching the specified {@code Query} object. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @param query Indicates the {@code Query} object. - * @returns Returns the {@code KvStoreResultSet} object matching the specified {@code Query} object. - * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, - * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. - */ - getResultSet(query: Query, callback: AsyncCallback): void; - getResultSet(query: Query): Promise; - - /** - * Obtains the {@code KvStoreResultSet} object matching a specified device ID and {@code Query} object. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @param deviceId Indicates the ID of the device to which the {@code KvStoreResultSet} object belongs. - * @param query Indicates the {@code Query} object. - * @returns Returns the {@code KvStoreResultSet} object matching the specified {@code Query} object. - */ - getResultSet(deviceId: string, query: Query, callback: AsyncCallback): void; - getResultSet(deviceId: string, query: Query): Promise; - - /** - * Obtains the KvStoreResultSet object matching the specified Predicate object. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param predicates Indicates the datasharePredicates. - * @systemapi - * Spaces before and after the key will be cleared. - * @throws Throws this exception if any of the following errors - * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and - * {@code DB_ERROR}. + get(deviceId: string, key: string, callback: AsyncCallback): void; + get(deviceId: string, key: string): Promise; + + /** + * Obtains all key-value pairs matching a specified device ID and key prefix. + * + * @param deviceId Identifies the device whose data is to be queried. + * @param keyPrefix Indicates the key prefix to match. + * @returns Returns the list of all key-value pairs meeting the given criteria. + * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, + * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getEntries */ - getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; - getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise; + getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; + getEntries(deviceId: string, keyPrefix: string): Promise; /** - * Obtains the KvStoreResultSet object matching a specified Device ID and Predicate object. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @systemapi - * @param predicates Indicates the key. + * Obtains the list of key-value pairs matching the specified {@code Query} object. + * + * @param query Indicates the {@code Query} object. + * @returns Returns the list of key-value pairs matching the specified {@code Query} object. + * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, + * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getEntries + */ + getEntries(query: Query, callback: AsyncCallback): void; + getEntries(query: Query): Promise; + + /** + * Obtains the list of key-value pairs matching a specified device ID and {@code Query} object. + * + * @param deviceId Indicates the ID of the device to which the key-value pairs belong. + * @param query Indicates the {@code Query} object. + * @returns Returns the list of key-value pairs matching the specified {@code Query} object. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getEntries + */ + getEntries(deviceId: string, query: Query, callback: AsyncCallback): void; + getEntries(deviceId: string, query: Query): Promise; + + /** + * Obtains the {@code KvStoreResultSet} object matching the specified device ID and key prefix. + * + *

          The {@code KvStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. Each {@code KvStore} + * instance can have a maximum of four {@code KvStoreResultSet} objects at the same time. If you have created four objects, + * calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close unnecessary + * {@code KvStoreResultSet} objects in a timely manner. + * + * @param deviceId Identifies the device whose data is to be queried. + * @param keyPrefix Indicates the key prefix to match. + * @returns Returns the {@code KvStoreResultSet} objects. + * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, + * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getResultSet + */ + getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; + getResultSet(deviceId: string, keyPrefix: string): Promise; + + /** + * Obtains the {@code KvStoreResultSet} object matching the specified {@code Query} object. + * + * @param query Indicates the {@code Query} object. + * @returns Returns the {@code KvStoreResultSet} object matching the specified {@code Query} object. + * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, + * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getResultSet + */ + getResultSet(query: Query, callback: AsyncCallback): void; + getResultSet(query: Query): Promise; + + /** + * Obtains the {@code KvStoreResultSet} object matching a specified device ID and {@code Query} object. + * + * @param deviceId Indicates the ID of the device to which the {@code KvStoreResultSet} object belongs. + * @param query Indicates the {@code Query} object. + * @returns Returns the {@code KvStoreResultSet} object matching the specified {@code Query} object. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getResultSet + */ + getResultSet(deviceId: string, query: Query, callback: AsyncCallback): void; + getResultSet(deviceId: string, query: Query): Promise; + + /** + * Closes a {@code KvStoreResultSet} object returned by getResultSet. + * + * @param resultSet Indicates the {@code KvStoreResultSet} object to close. + * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, + * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#closeResultSet + */ + closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback): void; + closeResultSet(resultSet: KvStoreResultSet): Promise; + + /** + * Obtains the number of results matching the specified {@code Query} object. + * + * @param query Indicates the {@code Query} object. + * @returns Returns the number of results matching the specified {@code Query} object. + * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, + * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getResultSize + */ + getResultSize(query: Query, callback: AsyncCallback): void; + getResultSize(query: Query): Promise; + + /** + * Obtains the number of results matching a specified device ID and {@code Query} object. + * * @param deviceId Indicates the ID of the device to which the results belong. - * Spaces before and after the key will be cleared. - * @throws Throws this exception if any of the following errors - * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, and - * {@code DB_ERROR}. - */ - getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; - getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates): Promise; - - /** - * Closes a {@code KvStoreResultSet} object returned by getResultSet. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @param resultSet Indicates the {@code KvStoreResultSet} object to close. - * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, - * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. - */ - closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback): void; - closeResultSet(resultSet: KvStoreResultSet): Promise; - - /** - * Obtains the number of results matching the specified {@code Query} object. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @param query Indicates the {@code Query} object. - * @returns Returns the number of results matching the specified {@code Query} object. - * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, - * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. - */ - getResultSize(query: Query, callback: AsyncCallback): void; - getResultSize(query: Query): Promise; - - /** - * Obtains the number of results matching a specified device ID and {@code Query} object. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @param deviceId Indicates the ID of the device to which the results belong. - * @param query Indicates the {@code Query} object. - * @returns Returns the number of results matching the specified {@code Query} object. - */ - getResultSize(deviceId: string, query: Query, callback: AsyncCallback): void; - getResultSize(deviceId: string, query: Query): Promise; - - /** - * Removes data of a specified device from the current database. This method is used to remove only the data - * synchronized from remote devices. This operation does not synchronize data to other databases or affect - * subsequent data synchronization. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore - * @param deviceId Identifies the device whose data is to be removed. The value cannot be the current device ID. - * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, - * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. - */ - removeDeviceData(deviceId: string, callback: AsyncCallback): void; - removeDeviceData(deviceId: string): Promise; - - /** - * Synchronizes {@code DeviceKVStore} databases. + * @param query Indicates the {@code Query} object. + * @returns Returns the number of results matching the specified {@code Query} object. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#getResultSize + */ + getResultSize(deviceId: string, query: Query, callback: AsyncCallback): void; + getResultSize(deviceId: string, query: Query): Promise; + + /** + * Removes data of a specified device from the current database. This method is used to remove only the data + * synchronized from remote devices. This operation does not synchronize data to other databases or affect + * subsequent data synchronization. * - *

          This method returns immediately and sync result will be returned through asynchronous callback. + * @param deviceId Identifies the device whose data is to be removed. The value cannot be the current device ID. + * @throws Throws this exception if any of the following errors occurs: {@code INVALID_ARGUMENT}, + * {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, {@code DB_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param deviceIds Indicates the list of IDs of devices whose - * @param delayMs Indicates the delay allowed for the synchronization, in milliseconds. - * {@code DeviceKVStore} databases are to be synchronized. - * @param mode Indicates the synchronization mode, {@code PUSH}, {@code PULL}, or - * {@code PUSH_PULL}. - * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @throws Throws this exception if no DeviceKVStore database is available. + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#removeDeviceData */ - sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void; + removeDeviceData(deviceId: string, callback: AsyncCallback): void; + removeDeviceData(deviceId: string): Promise; /** - * Synchronizes {@code DeviceKVStore} databases. + * Synchronize the {@code DeviceKVStore} databases. * *

          This method returns immediately and sync result will be returned through asynchronous callback. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC * @param deviceIds Indicates the list of IDs of devices whose * @param delayMs Indicates the delay allowed for the synchronization, in milliseconds. * {@code DeviceKVStore} databases are to be synchronized. - * @param query Indicates the {@code Query} object. * @param mode Indicates the synchronization mode, {@code PUSH}, {@code PULL}, or * {@code PUSH_PULL}. - * @permission ohos.permission.DISTRIBUTED_DATASYNC * @throws Throws this exception if no DeviceKVStore database is available. - */ - sync(deviceIds: string[], query: Query, mode: SyncMode, delayMs?: number): void; - - /** - * Register Synchronizes DeviceKVStore databases callback. - * - *

          Sync result is returned through asynchronous callback. - * @since 8 * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @param syncCallback Indicates the callback used to send the synchronization result to the caller. - * @throws Throws this exception if no DeviceKVStore database is available. + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#sync */ - on(event: 'syncComplete', syncCallback: Callback>): void; - + sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void; + /** - * Registers a {@code KvStoreObserver} for the database. When data in the distributed database changes, the callback in - * {@code KvStoreObserver} will be invoked. + * Register a {@code KvStoreObserver} for the database. When data in the distributed database changes, the + * callback in the {@code KvStoreObserver} will be invoked. * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. * @param listener Indicates the observer of data change events in the distributed database. - * @throws Throws this exception if any of the following errors + * @throws Throws this exception if any of the following errors * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#on */ - on(event: 'dataChange', type: SubscribeType, listener: Callback): void; + on(event: 'dataChange', type: SubscribeType, listener: Callback): void; + /** - * Unsubscribes from the DeviceKVStore database based on the specified subscribeType and {@code KvStoreObserver}. + * Register a DeviceKVStore database synchronization callback. * - * @since 9 + *

          Sync result is returned through asynchronous callback. + * + * @param syncCallback Indicates the callback used to send the synchronization result to the caller. + * @throws Throws this exception if no DeviceKVStore database is available. * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#on + */ + on(event: 'syncComplete', syncCallback: Callback>): void; + + /** + * Unsubscribe the DeviceKVStore database based on the specified subscribeType and {@code KvStoreObserver}. + * * @param listener Indicates the data change observer registered by {#subscribe(SubscribeType, KvStoreObserver)}. - * @throws Throws this exception if any of the following errors + * @throws Throws this exception if any of the following errors * occurs: {@code SERVER_UNAVAILABLE}, {@code IPC_ERROR}, * {@code DB_ERROR}, and {@code STORE_ALREADY_SUBSCRIBE}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#off */ - off(event:'dataChange', listener?: Callback): void; + off(event: 'dataChange', listener?: Callback): void; /** - * UnRegister Synchronizes DeviceKVStore databases callback. - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * UnRegister the DeviceKVStore database synchronization callback. + * * @throws Throws this exception if no DeviceKVStore database is available. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.DeviceKVStore#off */ off(event: 'syncComplete', syncCallback?: Callback>): void; } - + /** * Creates a {@link KVManager} instance based on the configuration information. * *

          You must pass {@link KVManagerConfig} to provide configuration information * for creating the {@link KVManager} instance. * - * @since 7 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param config Indicates the {@link KVStore} configuration information, * including the user information and package name. - * @return Returns the {@code KVManager} instance. + * @returns Returns the {@code KVManager} instance. * @throws Throws exception if input is invalid. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore#createKVManager */ function createKVManager(config: KVManagerConfig, callback: AsyncCallback): void; function createKVManager(config: KVManagerConfig): Promise; @@ -1855,63 +1973,71 @@ declare namespace distributedData { /** * Provides interfaces to manage a {@code KVStore} database, including obtaining, closing, and deleting the {@code KVStore}. * - * @since 7 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @import N/A * @version 1 + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVManager */ interface KVManager { /** * Creates and obtains a {@code KVStore} database by specifying {@code Options} and {@code storeId}. * - * @since 7 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core * @param options Indicates the options used for creating and obtaining the {@code KVStore} database, * including {@code isCreateIfMissing}, {@code isEncrypt}, and {@code KVStoreType}. * @param storeId Identifies the {@code KVStore} database. * The value of this parameter must be unique for the same application, * and different applications can share the same value. - * @return Returns a {@code KVStore}, or {@code SingleKVStore}. + * @returns Returns a {@code KVStore}, or {@code SingleKVStore}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVManager#getKVStore */ getKVStore(storeId: string, options: Options): Promise; getKVStore(storeId: string, options: Options, callback: AsyncCallback): void; /** * Closes the {@code KvStore} database. - * + * *

          Warning: This method is not thread-safe. If you call this method to stop a KvStore database that is running, your * thread may crash. - * - *

          The {@code KvStore} database to close must be an object created by using the {@code getKvStore} method. Before using this + * + *

          The {@code KvStore} database to close must be an object created by using the {@code getKvStore} method. Before using this * method, release the resources created for the database, for example, {@code KvStoreResultSet} for {@code SingleKvStore}, * otherwise closing the database will fail. If you are attempting to close a database that is already closed, an error * will be returned. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @param kvStore Indicates the {@code KvStore} database to close. * @throws Throws this exception if any of the following errors - * occurs:{@code INVALID_ARGUMENT}, {@code ERVER_UNAVAILABLE}, + * occurs:{@code INVALID_ARGUMENT}, {@code SERVER_UNAVAILABLE}, * {@code STORE_NOT_OPEN}, {@code STORE_NOT_FOUND}, {@code DB_ERROR}, * {@code PERMISSION_DENIED}, and {@code IPC_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVManager#closeKVStore */ closeKVStore(appId: string, storeId: string, kvStore: KVStore, callback: AsyncCallback): void; closeKVStore(appId: string, storeId: string, kvStore: KVStore): Promise; /** * Deletes the {@code KvStore} database identified by storeId. - * + * *

          Before using this method, close all {@code KvStore} instances in use that are identified by the same storeId. - * + * *

          You can use this method to delete a {@code KvStore} database not in use. After the database is deleted, all its data will be * lost. - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * * @param storeId Identifies the {@code KvStore} database to delete. - * @throws Throws this exception if any of the following errors + * @throws Throws this exception if any of the following errors * occurs: {@code INVALID_ARGUMENT}, * {@code SERVER_UNAVAILABLE}, {@code STORE_NOT_FOUND}, * {@code DB_ERROR}, {@code PERMISSION_DENIED}, and {@code IPC_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVManager#deleteKVStore */ deleteKVStore(appId: string, storeId: string, callback: AsyncCallback): void; deleteKVStore(appId: string, storeId: string): Promise; @@ -1919,34 +2045,40 @@ declare namespace distributedData { /** * Obtains the storeId of all {@code KvStore} databases that are created by using the {@code getKvStore} method and not deleted by * calling the {@code deleteKvStore} method. - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.Core - * @returns Returns the storeId of all created {@code KvStore} databases. - * @throws Throws this exception if any of the following errors + * + * @returns Returns the storeId of all created {@code KvStore} databases. + * @throws Throws this exception if any of the following errors * occurs: {@code SERVER_UNAVAILABLE}, {@code DB_ERROR}, * {@code PERMISSION_DENIED}, and {@code IPC_ERROR}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVManager#getAllKVStoreId */ getAllKVStoreId(appId: string, callback: AsyncCallback): void; getAllKVStoreId(appId: string): Promise; /** * register DeviceChangeCallback to get notification when device's status changed - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * * @param deathCallback device change callback {@code DeviceChangeCallback} - * @throws exception maybe occurs. + * @throws exception maybe occurs. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVManager#on */ on(event: 'distributedDataServiceDie', deathCallback: Callback): void; /** * unRegister DeviceChangeCallback and can not receive notification - * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * * @param deathCallback device change callback {@code DeviceChangeCallback} which has been registered. * @throws exception maybe occurs. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.distributedKVStore.KVManager#off */ off(event: 'distributedDataServiceDie', deathCallback?: Callback): void; } diff --git a/api/@ohos.data.distributedDataObject.d.ts b/api/@ohos.data.distributedDataObject.d.ts index ac9d6683f1bfa88b7ca9f9a398a471afa948cb91..55715e51aad6571c15119fa96d834ca437f0103c 100644 --- a/api/@ohos.data.distributedDataObject.d.ts +++ b/api/@ohos.data.distributedDataObject.d.ts @@ -14,44 +14,68 @@ */ import {AsyncCallback, Callback} from './basic'; +import Context from './application/Context'; /** - * Provides interfaces to sync distributed object + * Provides interfaces to sync distributed object. * - * @name distributedDataObject - * @since 8 * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 8 */ declare namespace distributedDataObject { + /** - * Create distributed object + * Create distributed object. * - * @param source Init data of distributed object - * @return Returns the distributed object + * @param {object} source - source Init data of distributed object. + * @returns {DistributedObject} - return the distributed object. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject * @since 8 + * @deprecated since 9 + * @useinstead ohos.distributedDataObject.create */ function createDistributedObject(source: object): DistributedObject; /** - * Generate a random sessionId + * Create distributed object. * - * @return Returns the random sessionId + * @param {Context} context - Indicates the application context. + * @param {object} source - source Init data of distributed object. + * @returns {DistributedObjectV9} - return the distributed object. + * @throws {BusinessError} 401 - the parameter check failed. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 9 + */ + function create(context: Context, source: object): DistributedObjectV9; + + /** + * Generate a random sessionId. + * + * @returns {string} - return generated sessionId. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject * @since 8 */ function genSessionId(): string; /** + * The response of save. + * Contains the parameter information of the save object. + * + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject * @since 9 */ interface SaveSuccessResponse { + /** * sessionId of saved object + * * @since 9 */ sessionId: string; /** * version of saved object, can compare with DistributedObject.__version + * * @since 9 */ version: number; @@ -60,16 +84,24 @@ declare namespace distributedDataObject { * deviceid that data saved * data is "local", means save in local device * otherwise, means the networkId of device + * * @since 9 */ deviceId: string; } /** + * The response of revokeSave. + * Contains the sessionId of the changed object. + * + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject * @since 9 */ interface RevokeSaveSuccessResponse { + /** + * The sessionId of the changed object. + * * @since 9 */ sessionId: string; @@ -80,76 +112,262 @@ declare namespace distributedDataObject { * * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject * @since 8 + * @deprecated since 9 + * @useinstead ohos.distributedDataObject.DistributedObjectV9 */ interface DistributedObject { - /* + + /** * Change object session * - * @param sessionId The sessionId to be joined, if empty, leave all session - * @return Operation result, true is success, false is failed * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param {string} sessionId - sessionId The sessionId to be joined, if empty, leave all session. + * @returns {boolean} - return a result of function. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject * @since 8 + * @deprecated since 9 + * @useinstead ohos.distributedDataObject.DistributedObjectV9.setSessionId */ setSessionId(sessionId?: string): boolean; /** * On watch of change - * - * @param callback The callback of change + * + * @param {string} type - event type, fixed as' change ', indicates data change. + * @param {Callback<{sessionId: string, fields: Array}>} callback + * indicates the observer of object data changed. + * {string} sessionId - the sessionId of the changed object. + * {Array} fields - changed data. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject * @since 8 + * @deprecated since 9 + * @useinstead ohos.distributedDataObject.DistributedObjectV9.on */ on(type: 'change', callback: Callback<{ sessionId: string, fields: Array }>): void; /** * Off watch of change - * - * @param callback If not null, off the callback, if undefined, off all callbacks + * + * @param {string} type - event type, fixed as' change ', indicates data change. + * @param {Callback<{sessionId: string, fields: Array}>} callback + * indicates the observer of object data changed. + * {string} sessionId - the sessionId of the changed object. + * {Array} fields - changed data. + * callback If not null, off the callback, if undefined, off all callbacks. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject * @since 8 + * @deprecated since 9 + * @useinstead ohos.distributedDataObject.DistributedObjectV9.off */ off(type: 'change', callback?: Callback<{ sessionId: string, fields: Array }>): void; /** * On watch of status - * - * @param callback Indicates the observer of object status changed. - * sessionId: The sessionId of the changed object - * networkId: NetworkId of the changed device - * status: 'online' The object became online on the device and data can be synced to the device - * 'offline' The object became offline on the device and the object can not sync any data + * + * @param {string} type - event type, fixed as' status', indicates the online and offline of the object. + * @param {Callback<{sessionId: string, networkId: string, status: 'online' | 'offline'}>} callback + * indicates the observer of object status changed. + * {string} sessionId - the sessionId of the changed object. + * {string} networkId - networkId of the changed device. + * {string} status + * 'online' The object became online on the device and data can be synced to the device. + * 'offline' The object became offline on the device and the object can not sync any data. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject * @since 8 + * @deprecated since 9 + * @useinstead ohos.distributedDataObject.DistributedObjectV9.on */ - on(type: 'status', callback: Callback<{ sessionId: string, networkId: string, status: 'online' | 'offline' }>): void; + on(type: 'status', + callback: Callback<{ sessionId: string, networkId: string, status: 'online' | 'offline' }>): void; /** * Off watch of status - * - * @param callback If not null, off the callback, if undefined, off all callbacks + * + * @param {string} type - event type, fixed as' status', indicates the online and offline of the object. + * @param {Callback<{sessionId: string, networkId: string, status: 'online' | 'offline'}>} callback + * Indicates the observer of object status changed. + * {string} sessionId - the sessionId of the changed object. + * {string} networkId - networkId of the changed device. + * {string} status + * 'online' The object became online on the device and data can be synced to the device. + * 'offline' The object became offline on the device and the object can not sync any data. + * callback If not null, off the callback, if undefined, off all callbacks. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject * @since 8 + * @deprecated since 9 + * @useinstead ohos.distributedDataObject.DistributedObjectV9.off + */ + off(type: 'status', + callback?: Callback<{ sessionId: string, deviceId: string, status: 'online' | 'offline' }>): void; + } + + /** + * Object create by {@link create}. + * + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 9 + */ + interface DistributedObjectV9 { + + /* + * Change object session. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param {string} sessionId - sessionId The sessionId to be joined, if empty, leave all session. + * @param {AsyncCallback} callback - the callback of setSessionId. + * @throws {BusinessError} 201 - the permissions check failed. + * @throws {BusinessError} 401 - the parameter check failed. + * @throws {BusinessError} 15400001 - create table failed. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 9 + */ + setSessionId(sessionId: string, callback: AsyncCallback): void; + setSessionId(callback: AsyncCallback): void; + + /* + * Change object session. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param {string} sessionId - sessionId The sessionId to be joined, if empty, leave all session. + * @returns {Promise} - the promise returned by the function. + * @throws {BusinessError} 201 - the permissions check failed. + * @throws {BusinessError} 401 - the parameter check failed. + * @throws {BusinessError} 15400001 - create table failed. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 9 + */ + setSessionId(sessionId?: string): Promise; + + /** + * On watch of change. + * + * @param {string} type - event type, fixed as' change ', indicates data change. + * @param {Callback<{sessionId: string, fields: Array}>} callback + * indicates the observer of object data changed. + * {string} sessionId - the sessionId of the changed object. + * {Array} fields - changed data. + * sessionId the sessionId of the changed object. + * @throws {BusinessError} 401 - the parameter check failed. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 9 + */ + on(type: 'change', callback: Callback<{ sessionId: string, fields: Array }>): void; + + /** + * Off watch of change. + * + * @param {string} type - event type, fixed as' change ', indicates data change. + * @param {Callback<{sessionId: string, fields: Array}>} callback + * indicates the observer of object data changed. + * {string} sessionId - the sessionId of the changed object. + * {Array} fields - changed data. + * callback If not null, off the callback, if undefined, off all callbacks. + * @throws {BusinessError} 401 - the parameter check failed. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 9 + */ + off(type: 'change', callback?: Callback<{ sessionId: string, fields: Array }>): void; + + /** + * On watch of status. + * + * @param {string} type - event type, fixed as' status', indicates the online and offline of the object. + * @param {Callback<{ sessionId: string, networkId: string, status: 'online' | 'offline' }>} callback + * indicates the observer of object status changed. + * {string} sessionId - the sessionId of the changed object. + * {string} networkId - networkId of the changed device. + * {string} status + * 'online' The object became online on the device and data can be synced to the device. + * 'offline' The object became offline on the device and the object can not sync any data. + * 'restored' The object restored success. + * @throws {BusinessError} 401 - the parameter check failed. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 9 */ - off(type: 'status', callback?: Callback<{ sessionId: string, deviceId: string, status: 'online' | 'offline' }>): void; + on(type: 'status', + callback: Callback<{ sessionId: string, networkId: string, status: 'online' | 'offline' }>): void; /** - * Save object, after save object data successfully, the object data will not release when app existed, and resume data on saved device after app existed - * the saved data secure level is S0, it is not safe, can only save public data, if there is privacy data, you should encrypt it + * Off watch of status. * - * the saved data will be released when - * 1. saved after 24h - * 2. app uninstalled - * 3. after resume data success, system will auto delete the saved data + * @param {string} type - event type, fixed as' status', indicates the online and offline of the object. + * @param {Callback<{sessionId: string, networkId: string, status: 'online' | 'offline'}>} callback + * Indicates the observer of object status changed. + * {string} sessionId - the sessionId of the changed object. + * {string} networkId - networkId of the changed device. + * {string} status + * 'online' The object became online on the device and data can be synced to the device. + * 'offline' The object became offline on the device and the object can not sync any data. + * callback If not null, off the callback, if undefined, off all callbacks. + * @throws {BusinessError} 401 - the parameter check failed. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 9 + */ + off(type: 'status', + callback?: Callback<{ sessionId: string, deviceId: string, status: 'online' | 'offline' }>): void; + + /** + * Save object, after save object data successfully, the object data will not release when app existed, + * and resume data on saved device after app existed. + * the saved data secure level is S0, it is not safe, can only save public data, if there is privacy data, + * you should encrypt it * - * @param deviceId Indicates the device that will resume the object data + * The saved data will be released when + * 1. saved after 24h. + * 2. app uninstalled. + * 3. after resume data success, system will auto delete the saved data. + * + * @param {string} deviceId - Indicates the device that will resume the object data. + * @param {AsyncCallback} callback + * {SaveSuccessResponse}: the response of save. + * @throws {BusinessError} 401 - the parameter check failed. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject * @since 9 */ save(deviceId: string, callback: AsyncCallback): void; + + /** + * Save object, after save object data successfully, the object data will not release when app existed, + * and resume data on saved device after app existed. + * the saved data secure level is S0, it is not safe, can only save public data, if there is privacy data, + * you should encrypt it. + * + * The saved data will be released when + * 1. saved after 24h. + * 2. app uninstalled. + * 3. after resume data success, system will auto delete the saved data. + * + * @param {string} deviceId - Indicates the device that will resume the object data. + * @returns {Promise} {SaveSuccessResponse}: the response of save. + * @throws {BusinessError} 401 - the parameter check failed. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 9 + */ save(deviceId: string): Promise; /** - * Revoke save object, delete saved object immediately, if object is saved in local device, it will delete saved data on all trusted device + * Revoke save object, delete saved object immediately, if object is saved in local device, + * it will delete saved data on all trusted device. * if object is saved in other device, it will delete data in local device. - * + * + * @param {AsyncCallback} callback + * {RevokeSaveSuccessResponse}: the response of revokeSave. + * @throws {BusinessError} 401 - the parameter check failed. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject * @since 9 */ revokeSave(callback: AsyncCallback): void; + + /** + * Revoke save object, delete saved object immediately, if object is saved in local device, + * it will delete saved data on all trusted device. + * if object is saved in other device, it will delete data in local device. + * + * @returns {Promise} {RevokeSaveSuccessResponse}: the response of revokeSave. + * @throws {BusinessError} 401 - the parameter check failed. + * @syscap SystemCapability.DistributedDataManager.DataObject.DistributedObject + * @since 9 + */ revokeSave(): Promise; } } diff --git a/api/@ohos.data.distributedKVStore.d.ts b/api/@ohos.data.distributedKVStore.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9f076e0da9d1a3c42993b702467080da89f41167 --- /dev/null +++ b/api/@ohos.data.distributedKVStore.d.ts @@ -0,0 +1,2402 @@ +/* + * 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, Callback} from './basic'; +import {ValuesBucket} from './@ohos.data.ValuesBucket'; +import dataSharePredicates from './@ohos.data.dataSharePredicates'; +import Context from './application/Context'; + +/** + * Provider interfaces to create a {@link KVManager} instance. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ +declare namespace distributedKVStore { + /** + * Provides configuration information to create a {@link KVManager} instance, + * which includes the caller's package name and ability or hap context. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + interface KVManagerConfig { + /** + * Indicates the bundleName + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + bundleName: string; + + /** + * Indicates the ability or hap context + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * if swap the area, you should close all the KV store and use the new Context to create the KVManager + * @since 9 + */ + context: Context; + } + + /** + * KVStore constants + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + namespace Constants { + /** + * Max key length. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + const MAX_KEY_LENGTH = 1024; + + /** + * Max value length. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + const MAX_VALUE_LENGTH = 4194303; + + /** + * Max device coordinate key length. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + const MAX_KEY_LENGTH_DEVICE = 896; + + /** + * Max store id length. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + const MAX_STORE_ID_LENGTH = 128; + + /** + * Max query length. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + const MAX_QUERY_LENGTH = 512000; + + /** + * Max batch operation size. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + const MAX_BATCH_SIZE = 128; + } + + /** + * Indicates the {@code ValueType}. + * + *

          {@code ValueType} is obtained based on the value. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + enum ValueType { + /** + * Indicates that the value type is string. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + STRING, + + /** + * Indicates that the value type is int. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + INTEGER, + + /** + * Indicates that the value type is float. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + FLOAT, + + /** + * Indicates that the value type is byte array. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + * */ + BYTE_ARRAY, + + /** + * Indicates that the value type is boolean. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + * */ + BOOLEAN, + + /** + * Indicates that the value type is double. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + DOUBLE, + } + + /** + * Obtains {@code Value} objects stored in a {@link SingleKVStore} or {@link DeviceKVStore} database. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + interface Value { + /** + * Indicates the value type + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @see ValueType + * @since 9 + */ + type: ValueType; + + /** + * Indicates the value + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + value: Uint8Array | string | number | boolean; + } + + /** + * Provides key-value pairs stored in the distributedKVStore. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + interface Entry { + /** + * Indicates the key + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + key: string; + + /** + * Indicates the value + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + value: Value; + } + + /** + * Receive notifications of all data changes, including data insertion, update, and deletion. + * + *

          If you have subscribed to {@code SingleKVStore} or {@code DeviceKVStore}, you will receive + * data change notifications and obtain the changed data from the parameters in callback methods + * upon data insertion, update or deletion. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + interface ChangeNotification { + /** + * Indicates data insertion records. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + insertEntries: Entry[]; + + /** + * Indicates data update records. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + updateEntries: Entry[]; + + /** + * Indicates data deletion records. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + deleteEntries: Entry[]; + + /** + * Indicates the device id which brings the data change. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + deviceId: string; + } + + /** + * Indicates the database synchronization mode. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + enum SyncMode { + /** + * Indicates that data is only pulled from the remote end. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + PULL_ONLY, + + /** + * Indicates that data is only pushed from the local end. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + PUSH_ONLY, + + /** + * Indicates that data is pushed from the local end, and then pulled from the remote end. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + PUSH_PULL, + } + + /** + * Describes the subscription type. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + enum SubscribeType { + /** + * Subscription to local data changes + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + SUBSCRIBE_TYPE_LOCAL, + + /** + * Subscription to remote data changes + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + SUBSCRIBE_TYPE_REMOTE, + + /** + * Subscription to both local and remote data changes + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + SUBSCRIBE_TYPE_ALL, + } + + /** + * Describes the KVStore type. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + enum KVStoreType { + /** + * Device-collaboration database, as specified by {@code DeviceKVStore} + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + DEVICE_COLLABORATION, + + /** + * Single-version database, as specified by {@code SingleKVStore} + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + SINGLE_VERSION, + } + + /** + * Describes the KVStore security level. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + enum SecurityLevel { + /** + * S1: means the db is in the low security level + * There are some low impact when the data is leaked. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + S1, + + /** + * S2: means the db is in the middle security level + * There are some major impact when the data is leaked. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + S2, + + /** + * S3: means the db is in the high security level + * There are some severity impact when the data is leaked. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + S3, + + /** + * S4: means the db is in the critical security level + * There are some critical impact when the data is leaked. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + S4, + } + + /** + * Provides configuration options to create a {@code SingleKVStore} or {@code DeviceKVStore}. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + interface Options { + /** + * Indicates whether to create a database when the database file does not exist + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + createIfMissing?: boolean; + + /** + * Indicates whether database files to be encrypted + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + encrypt?: boolean; + + /** + * Indicates whether to back up database files + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + backup?: boolean; + + /** + * Indicates whether database files are automatically synchronized + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + autoSync?: boolean; + + /** + * Indicates the database type + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + kvStoreType?: KVStoreType; + + /** + * Indicates the database security level + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + securityLevel: SecurityLevel; + + /** + * Indicates the database schema + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + schema?: Schema; + } + + /** + * Represents the database schema. + * + * You can set the schema object in options when create or open the database. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + class Schema { + /** + * A constructor used to create a Schema instance. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + constructor() + + /** + * Indicates the root json object. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + root: FieldNode; + + /** + * Indicates the string array of json. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + indexes: Array; + + /** + * Indicates the mode of schema. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + mode: number; + + /** + * Indicates the skip size of schema. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + skip: number; + } + + /** + * Represents a node of a {@link Schema} instance. + * + *

          With a {@link Schema} instance, you can define the value fields which stored in the database. + * + *

          A FieldNode of the {@link Schema} instance is either a leaf or a non-leaf node. + * + *

          The leaf node must have a value; the non-leaf node must have a child {@code FieldNode}. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + class FieldNode { + /** + * A constructor used to create a FieldNode instance with the specified field. + * name Indicates the field node name. + * + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + constructor(name: string) + + /** + * Adds a child node to this {@code FieldNode}. + * + *

          Add a child node to makes this node a non-leaf node and field value will be ignored if it has a child node. + * + * @param {FieldNode} child - The field node to append. + * @returns Returns true if the child node is successfully added to this {@code FieldNode} and false otherwise. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + appendChild(child: FieldNode): boolean; + + /** + * Indicates the default value of field node. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + default: string; + + /** + * Indicates the nullable of database field. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + nullable: boolean; + + /** + * Indicates the type of value. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + type: number; + } + + /** + * Provides methods to operate the result set of the {@code SingleKVStore} or {@code DeviceKVStore} database. + * + *

          The result set is created by using the {@code getResultSet} method in the {@code SingleKVStore} or + * {@code DeviceKVStore} class. This interface also provides methods to move the data read + * position in the result set. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + interface KVStoreResultSet { + /** + * Obtains the number of lines in a result set. + * + * @returns Returns the number of lines. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getCount(): number; + + /** + * Obtains the current read position in a result set. + * + * @returns Returns the current read position. The read position starts with 0. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getPosition(): number; + + /** + * Moves the read position to the first line. + * + *

          If the result set is empty, false is returned. + * + * @returns Returns true if the operation succeeds; return false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + moveToFirst(): boolean; + + /** + * Moves the read position to the last line. + * + *

          If the result set is empty, false is returned. + * + * @returns Returns true if the operation succeeds; return false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + moveToLast(): boolean; + + /** + * Moves the read position to the next line. + * + *

          If the result set is empty or the data in the last line is being read, false is returned. + * + * @returns Returns true if the operation succeeds; return false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + moveToNext(): boolean; + + /** + * Moves the read position to the previous line. + * + *

          If the result set is empty or the data in the first line is being read, false is returned. + * + * @returns Returns true if the operation succeeds; return false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + moveToPrevious(): boolean; + + /** + * Moves the read position by a relative offset to the current position. + * + * @param {number} offset - Indicates the relative offset to the current position. A negative offset indicates moving + * backwards, and a positive offset indicates moving forwards. For example, if the current position is entry 1 and + * this offset is 2, the destination position will be entry 3; if the current position is entry 3 and this offset is -2, + * the destination position will be entry 1. The valid final position after moving forwards starts with 0. If the + * final position is invalid, false will be returned. + * @returns Returns true if the operation succeeds; return false otherwise. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + move(offset: number): boolean; + + /** + * Moves the read position from 0 to an absolute position. + * + * @param {number} position - Indicates the absolute position. + * @returns Returns true if the operation succeeds; return false otherwise. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + moveToPosition(position: number): boolean; + + /** + * Checks whether the read position is the first line. + * + * @returns Returns true if the read position is the first line; returns false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + isFirst(): boolean; + + /** + * Checks whether the read position is the last line. + * + * @returns Returns true if the read position is the last line; returns false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + isLast(): boolean; + + /** + * Checks whether the read position is before the last line. + * + * @returns Returns true if the read position is before the first line; returns false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + isBeforeFirst(): boolean; + + /** + * Checks whether the read position is after the last line. + * + * @returns Returns true if the read position is after the last line; returns false otherwise. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + isAfterLast(): boolean; + + /** + * Obtains a key-value pair. + * + * @returns Returns a key-value pair. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getEntry(): Entry; + } + + /** + * Represents a database query using predicates. + * + *

          This class provides a constructor used to create a {@code Query} instance, which is used to query data + * matching specified conditions in the database. + * + *

          This class also provides methods to add predicates to the {@code Query} instance. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + class Query { + /** + * A constructor used to create a Query instance. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + constructor() + + /** + * Resets this {@code Query} object. + * + * @returns Returns the reset {@code Query} object. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + reset(): Query; + + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is equal to the specified long value. + * + * @param {string} field - Indicates the field, which must start with $. and cannot contain ^. + * @param {number|string|boolean} value - Indicates the value to be compared. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + equalTo(field: string, value: number | string | boolean): Query; + + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is not equal to the specified int value. + * + * @param {string} field - Indicates the field, which must start with $. and cannot contain ^. + * @param {number|string|boolean} value - Indicates the value to be compared. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + notEqualTo(field: string, value: number | string | boolean): Query; + + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is greater than or equal to the + * specified int value. + * + * @param {string} field - Indicates the field, which must start with $. and cannot contain ^. + * @param {number|string|boolean} value - Indicates the value to be compared. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + greaterThan(field: string, value: number | string | boolean): Query; + + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is less than the specified int value. + * + * @param {string} field - Indicates the field, which must start with $. and cannot contain ^. + * @param {number|string} value - Indicates the value to be compared. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + lessThan(field: string, value: number | string): Query; + + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is greater than or + * equal to the specified int value. + * + * @param {string} field - Indicates the field, which must start with $. and cannot contain ^. + * @param {number|string} value - Indicates the value to be compared. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + greaterThanOrEqualTo(field: string, value: number | string): Query; + + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is less than or equal to the + * specified int value. + * + * @param {string} field - Indicates the field, which must start with $. and cannot contain ^. + * @param {number|string} value - Indicates the value to be compared. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + lessThanOrEqualTo(field: string, value: number | string): Query; + + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is null. + * + * @param {string} field - Indicates the field, which must start with $. and cannot contain ^. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + isNull(field: string): Query; + + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is within the specified int value list. + * + * @param {string} field - Indicates the field, which must start with $. and cannot contain ^. + * @param {number[]} valueList - Indicates the int value list. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + inNumber(field: string, valueList: number[]): Query; + + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is within the specified string value list. + * + * @param {string} field - Indicates the field, which must start with $. and cannot contain ^. + * @param {string[]} valueList - Indicates the string value list. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + inString(field: string, valueList: string[]): Query; + + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is not within the specified int value list. + * + * @param {string} field - Indicates the field, which must start with $. and cannot contain ^. + * @param {number[]} valueList - Indicates the int value list. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + notInNumber(field: string, valueList: number[]): Query; + + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is not within the specified string value list. + * + * @param {string} field - Indicates the field, which must start with $. and cannot contain ^. + * @param {string[]} valueList - Indicates the string value list. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + notInString(field: string, valueList: string[]): Query; + + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is similar to the specified string value. + * + * @param {string} field - Indicates the field, which must start with $. and cannot contain ^. + * @param {string} value - Indicates the string value. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + like(field: string, value: string): Query; + + /** + * Constructs a {@code Query} object to query entries with the specified field whose value is not similar to the specified string value. + * + * @param {string} field - Indicates the field, which must start with $. and cannot contain ^. + * @param {string} value - Indicates the string value. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + unlike(field: string, value: string): Query; + + /** + * Constructs a {@code Query} object with the and condition. + * + *

          Multiple predicates should be connected using the and or or condition. + * + * @returns Returns the {@coed Query} object. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + and(): Query; + + /** + * Constructs a {@code Query} object with the or condition. + * + *

          Multiple predicates should be connected using the and or or condition. + * + * @returns Returns the {@coed Query} object. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + or(): Query; + + /** + * Constructs a {@code Query} object to sort the query results in ascending order. + * + * @param {string} field - Indicates the field, which must start with $. and cannot contain ^. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + orderByAsc(field: string): Query; + + /** + * Constructs a {@code Query} object to sort the query results in descending order. + * + * @param {string} field - Indicates the field, which must start with $. and cannot contain ^. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + orderByDesc(field: string): Query; + + /** + * Constructs a {@code Query} object to specify the number of results and the start position. + * + * @param {number} total - Indicates the number of results. + * @param {number} offset - Indicates the start position. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + limit(total: number, offset: number): Query; + + /** + * Creates a {@code Query} condition with a specified field that is not null. + * + * @param {string} field - Indicates the specified field. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + isNotNull(field: string): Query; + + /** + * Creates a query condition group with a left bracket. + * + *

          Multiple query conditions in an {@code Query} object can be grouped. The query conditions in a group can be used as a + * whole to combine with other query conditions. + * + * @returns Returns the {@coed Query} object. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + beginGroup(): Query; + + /** + * Creates a query condition group with a right bracket. + * + *

          Multiple query conditions in an {@code Query} object can be grouped. The query conditions in a group can be used as a + * whole to combine with other query conditions. + * + * @returns Returns the {@coed Query} object. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + endGroup(): Query; + + /** + * Creates a query condition with a specified key prefix. + * + * @param {string} prefix - Indicates the specified key prefix. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + prefixKey(prefix: string): Query; + + /** + * Sets a specified index that will be preferentially used for query. + * + * @param {string} index - Indicates the index to set. + * @returns Returns the {@coed Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + setSuggestIndex(index: string): Query; + + /** + * Add device ID key prefix.Used by {@code DeviceKVStore}. + * + * @param {string} deviceId - Specify device id to query from. + * @returns Returns the {@code Query} object with device ID prefix added. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + deviceId(deviceId: string): Query; + + /** + * Get a String that represents this {@code Query}. + * + *

          The String would be parsed to DB query format. + * The String length should be no longer than 500kb. + * + * @returns String representing this {@code Query}. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getSqlLike(): string; + } + + /** + * Provides methods related to single-version distributed databases. + * + *

          To create a {@code SingleKVStore} database, + * you can use the {@link data.distributed.common.KVManager#getKVStore​(Options, String)} method + * with {@code KVStoreType} set to {@code SINGLE_VERSION} for the input parameter {@code Options}. + * This database synchronizes data to other databases in time sequence. + * The {@code SingleKVStore} database does not support + * synchronous transactions, or data search using snapshots. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + interface SingleKVStore { + /** + * Writes a key-value pair of the string type into the {@code SingleKVStore} database. + * + *

          If you do not want to synchronize this key-value pair to other devices, set the write option in the local database. + * + * @param {string} key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}. + * Spaces before and after the key will be cleared. + * @param {Uint8Array|string|number|boolean} value - Indicates the value to be inserted. + * @param {AsyncCallback} callback - the callback of put. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + put(key: string, value: Uint8Array | string | number | boolean, callback: AsyncCallback): void; + + /** + * Writes a key-value pair of the string type into the {@code SingleKVStore} database. + * + *

          If you do not want to synchronize this key-value pair to other devices, set the write option in the local database. + * + * @param {string} key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}. + * Spaces before and after the key will be cleared. + * @param {Uint8Array|string|number|boolean} value - Indicates the value to be inserted. + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + put(key: string, value: Uint8Array | string | number | boolean): Promise; + + /** + * Inserts key-value pairs into the {@code SingleKVStore} database in batches. + * + * @param {Entry[]} entries - Indicates the key-value pairs to be inserted in batches. + * @param {AsyncCallback} callback - the callback of putBatch. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + putBatch(entries: Entry[], callback: AsyncCallback): void; + + /** + * Inserts key-value pairs into the {@code SingleKVStore} database in batches. + * + * @param {Entry[]} entries - Indicates the key-value pairs to be inserted in batches. + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + putBatch(entries: Entry[]): Promise; + + /** + * Writes values of ValuesBucket type into the {@code SingleKVStore} database. + * + * @param {Array} value - Indicates the ValuesBucket array to be inserted. + * @param {AsyncCallback} callback - the callback of putBatch. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @systemapi + * @since 9 + */ + putBatch(value: Array, callback: AsyncCallback): void; + + /** + * Writes values of ValuesBucket type into the {@code SingleKVStore} database. + * + * @param {Array} value - Indicates the ValuesBucket array to be inserted. + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @systemapi + * @since 9 + */ + putBatch(value: Array): Promise; + + /** + * Deletes the key-value pair based on a specified key. + * + * @param {string} key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}. + * Spaces before and after the key will be cleared. + * @param {AsyncCallback} callback - the callback of delete. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + delete(key: string, callback: AsyncCallback): void; + + /** + * Deletes the key-value pair based on a specified key. + * + * @param {string} key - Indicates the key. Length must be less than {@code MAX_KEY_LENGTH}. + * Spaces before and after the key will be cleared. + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + delete(key: string): Promise; + + /** + * Deletes the key-value pairs based on the dataSharePredicates. + * + * @param {dataSharePredicates.DataSharePredicates} predicates - Indicates the dataSharePredicates. + * @param {AsyncCallback} callback - the callback of delete. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.DataShare.Provider + * @systemapi + * @since 9 + */ + delete(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback); + + /** + * Deletes the key-value pairs based on the dataSharePredicates. + * + * @param {dataSharePredicates.DataSharePredicates} predicates - Indicates the dataSharePredicates. + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.DataShare.Provider + * @systemapi + * @since 9 + */ + delete(predicates: dataSharePredicates.DataSharePredicates): Promise; + + /** + * Deletes key-value pairs in batches from the {@code SingleKVStore} database. + * + * @param {string[]} keys - Indicates the key-value pairs to be deleted in batches. + * @param {AsyncCallback} callback - the callback of deleteBatch. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + deleteBatch(keys: string[], callback: AsyncCallback): void; + + /** + * Deletes key-value pairs in batches from the {@code SingleKVStore} database. + * + * @param {string[]} keys - Indicates the key-value pairs to be deleted in batches. + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + deleteBatch(keys: string[]): Promise; + + /** + * Removes data of the specified device from current database. This method is used to remove only the data + * synchronized from remote devices. This operation does not synchronize data to other databases or affect + * subsequent data synchronization. + * + * @param {string} deviceId - Identifies the device whose data is to be removed and the value cannot be the current device ID. + * @param {AsyncCallback} callback - the callback of removeDeviceData. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + removeDeviceData(deviceId: string, callback: AsyncCallback): void; + + /** + * Removes data of the specified device from current database. This method is used to remove only the data + * synchronized from remote devices. This operation does not synchronize data to other databases or affect + * subsequent data synchronization. + * + * @param {string} deviceId - Identifies the device whose data is to be removed and the value cannot be the current device ID. + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + removeDeviceData(deviceId: string): Promise; + + /** + * Obtains the value of a specified key. + * + * @param {string} key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. + * @param {AsyncCallback} callback - + * {Uint8Array|string|boolean|number}: the returned value specified by the key. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the data not exist when query data. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + get(key: string, callback: AsyncCallback): void; + + /** + * Obtains the value of a specified key. + * + * @param {string} key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. + * @returns {Promise} + * {Uint8Array|string|boolean|number}: the returned value specified by the key. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the data not exist when query data. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + get(key: string): Promise; + + /** + * Obtains all key-value pairs that match a specified key prefix. + * + * @param {string} keyPrefix - Indicates the key prefix to match. + * @param {AsyncCallback} callback - {Entry[]}: the list of all key-value pairs + * that match the specified key prefix. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getEntries(keyPrefix: string, callback: AsyncCallback): void; + + /** + * Obtains all key-value pairs that match a specified key prefix. + * + * @param {string} keyPrefix - Indicates the key prefix to match. + * @returns {Promise} {Entry[]}: the list of all key-value pairs that match the + * specified key prefix. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getEntries(keyPrefix: string): Promise; + + /** + * Obtains the list of key-value pairs matching the specified {@code Query} object. + * + * @param {Query} query - Indicates the {@code Query} object. + * @param {AsyncCallback} callback - {Entry[]}: the list of all key-value pairs + * matching the specified {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getEntries(query: Query, callback: AsyncCallback): void; + + /** + * Obtains the list of key-value pairs matching the specified {@code Query} object. + * + * @param {Query} query - Indicates the {@code Query} object. + * @returns {Promise} {Entry[]}: the list of all key-value pairs matching the + * specified {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getEntries(query: Query): Promise; + + /** + * Obtains the result set with a specified prefix from a {@code SingleKVStore} database. The {@code KVStoreResultSet} + * object can be used to query all key-value pairs that meet the search criteria. Each {@code SingleKVStore} + * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created + * four objects, calling this method will return a failure. Therefore, you are advised to call the closeResultSet + * method to close unnecessary {@code KVStoreResultSet} objects in a timely manner. + * + * @param {string} keyPrefix - Indicates the key prefix to match. + * @param {AsyncCallback} callback - {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified keyPrefix. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getResultSet(keyPrefix: string, callback: AsyncCallback): void; + + /** + * Obtains the result set with a specified prefix from a {@code SingleKVStore} database. The {@code KVStoreResultSet} + * object can be used to query all key-value pairs that meet the search criteria. Each {@code SingleKVStore} + * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created + * four objects, calling this method will return a failure. Therefore, you are advised to call the closeResultSet + * method to close unnecessary {@code KVStoreResultSet} objects in a timely manner. + * + * @param {string} keyPrefix - Indicates the key prefix to match. + * @returns {Promise} {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified keyPrefix. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getResultSet(keyPrefix: string): Promise; + + /** + * Obtains the {@code KVStoreResultSet} object matching the specified {@code Query} object. + * + * @param {Query} query - Indicates the {@code Query} object. + * @param {AsyncCallback} callback - {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getResultSet(query: Query, callback: AsyncCallback): void; + + /** + * Obtains the {@code KVStoreResultSet} object matching the specified {@code Query} object. + * + * @param {Query} query - Indicates the {@code Query} object. + * @returns {Promise} {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getResultSet(query: Query): Promise; + + /** + * Obtains the KVStoreResultSet object matching the specified predicate object. + * + * @param {dataSharePredicates.DataSharePredicates} predicates - Indicates the datasharePredicates. + * @param {AsyncCallback} callback - {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified {@code dataSharePredicates.DataSharePredicates} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.DataShare.Provider + * @systemapi + * @since 9 + */ + getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; + + /** + * Obtains the KVStoreResultSet object matching the specified predicate object. + * + * @param {dataSharePredicates.DataSharePredicates} predicates - Indicates the datasharePredicates. + * @returns {Promise} {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified {@code dataSharePredicates.DataSharePredicates} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.DataShare.Provider + * @systemapi + * @since 9 + */ + getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise; + + /** + * Closes a {@code KVStoreResultSet} object returned by getResultSet method. + * + * @param {KVStoreResultSet} resultSet - Indicates the {@code KVStoreResultSet} object to close. + * @param {AsyncCallback} callback - the callback of closeResultSet. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + closeResultSet(resultSet: KVStoreResultSet, callback: AsyncCallback): void; + + /** + * Closes a {@code KVStoreResultSet} object returned by getResultSet method. + * + * @param {KVStoreResultSet} resultSet - Indicates the {@code KVStoreResultSet} object to close. + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + closeResultSet(resultSet: KVStoreResultSet): Promise; + + /** + * Obtains the number of results matching the specified {@code Query} object. + * + * @param {Query} query - Indicates the {@code Query} object. + * @param {AsyncCallback} callback - {number}: the number of results matching the + * specified {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getResultSize(query: Query, callback: AsyncCallback): void; + + /** + * Obtains the number of results matching the specified {@code Query} object. + * + * @param {Query} query - Indicates the {@code Query} object. + * @returns {Promise} {number}: the number of results matching the specified + * {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getResultSize(query: Query): Promise; + + /** + * Backs up a database in the specified filename. + * + * @param {string} file - Indicates the database backup filename. + * @param {AsyncCallback} callback - the callback of backup. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + backup(file: string, callback: AsyncCallback): void; + + /** + * Backs up a database in the specified filename. + * + * @param {string} file - Indicates the database backup filename. + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + backup(file: string): Promise; + + /** + * Restores a database from a specified database file. + * + * @param {string} file - Indicates the database backup filename. + * @param {AsyncCallback} callback - the callback of restore. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + restore(file: string, callback: AsyncCallback): void; + + /** + * Restores a database from a specified database file. + * + * @param {string} file - Indicates the database backup filename. + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + restore(file: string): Promise; + + /** + * Delete database backup files based on the specified filenames. + * + * @param {Array} files - Indicates the backup filenames to be deleted. + * @param {AsyncCallback>} callback - {Array<[string, number]>}: + * the list of backup file and it's corresponding delete result which 0 means delete success + * and otherwise failed. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + deleteBackup(files: Array, callback: AsyncCallback>): void; + + /** + * Delete database backup files based on the specified filenames. + * + * @param {Array} files - Indicates the backup filenames to be deleted. + * @returns {Promise>} {Array<[string, number]>}: the list of backup + * file and it's corresponding delete result which 0 means delete success and otherwise failed. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + deleteBackup(files: Array): Promise>; + + /** + * Starts a transaction operation in the {@code SingleKVStore} database. + * + *

          After the database transaction is started, you can submit or roll back the operation. + * + * @param {AsyncCallback} callback - the callback of startTransaction. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + startTransaction(callback: AsyncCallback): void; + + /** + * Starts a transaction operation in the {@code SingleKVStore} database. + * + *

          After the database transaction is started, you can submit or roll back the operation. + * + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + startTransaction(): Promise; + + /** + * Submits a transaction operation in the {@code SingleKVStore} database. + * + * @param {AsyncCallback} callback - the callback of commit. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + commit(callback: AsyncCallback): void; + + /** + * Submits a transaction operation in the {@code SingleKVStore} database. + * + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + commit(): Promise; + + /** + * Rolls back a transaction operation in the {@code SingleKVStore} database. + * + * @param {AsyncCallback} callback - the callback of rollback. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + rollback(callback: AsyncCallback): void; + + /** + * Rolls back a transaction operation in the {@code SingleKVStore} database. + * + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + rollback(): Promise; + + /** + * Sets whether to enable synchronization. + * + * @param {boolean} enabled - Specifies whether to enable synchronization. The value true + * means to enable synchronization, and false means the opposite. + * @param {AsyncCallback} callback - the callback of enableSync. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + enableSync(enabled: boolean, callback: AsyncCallback): void; + + /** + * Sets whether to enable synchronization. + * + * @param {boolean} enabled - Specifies whether to enable synchronization. The value true + * means to enable synchronization, and false means the opposite. + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + enableSync(enabled: boolean): Promise; + + /** + * Sets synchronization range labels. + * + *

          The labels determine the devices with which data will be synchronized. + * + * @param {string[]} localLabels - Indicates the synchronization labels of the local device. + * @param {string[]} remoteSupportLabels - Indicates the labels of the devices with which + * data will be synchronized. + * @param {AsyncCallback} callback - the callback of setSyncRange. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: AsyncCallback): void; + + /** + * Sets synchronization range labels. + * + *

          The labels determine the devices with which data will be synchronized. + * + * @param {string[]} localLabels - Indicates the synchronization labels of the local device. + * @param {string[]} remoteSupportLabels - Indicates the labels of the devices with which + * data will be synchronized. + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise; + + /** + * Sets the default delay allowed for database synchronization + * + * @param {number} defaultAllowedDelayMs - Indicates the default delay allowed for the + * database synchronization, in milliseconds. + * @param {AsyncCallback} callback - the callback of setSyncParam. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback): void; + + /** + * Sets the default delay allowed for database synchronization + * + * @param {number} defaultAllowedDelayMs - Indicates the default delay allowed for the + * database synchronization, in milliseconds. + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + setSyncParam(defaultAllowedDelayMs: number): Promise; + + /** + * Synchronize the database to the specified devices with the specified delay allowed. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param {string[]} deviceIds - Indicates the list of devices to which to synchronize the database. + * @param {SyncMode} mode - Indicates the synchronization mode. The value can be {@code PUSH}, + * {@code PULL}, or {@code PUSH_PULL}. + * @param {number} delayMs - Indicates the delay allowed for the synchronization, in milliseconds. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the database not exist when sync data. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void + + /** + * Synchronize the database to the specified devices with the specified delay allowed. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param {string[]} deviceIds - Indicates the list of devices to which to synchronize the database. + * @param {Query} query - Indicates the {@code Query} object. + * @param {SyncMode} mode - Indicates the synchronization mode. The value can be {@code PUSH}, + * {@code PULL}, or {@code PUSH_PULL}. + * @param {number} delayMs - Indicates the delay allowed for the synchronization, in milliseconds. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the database not exist when sync data. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + sync(deviceIds: string[], query: Query, mode: SyncMode, delayMs?: number): void; + + /** + * Register a callback to the database and when data in the distributed database has changed, + * the callback will be invoked. + * + * @param {SubscribeType} type - Indicates the subscription type, which is defined in {@code SubscribeType}. + * @param {Callback} listener - {ChangeNotification}: the {@code ChangeNotification} + * object indicates the data change events in the distributed database. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100001 - if the database has been subscribed over the max subscription time limit. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + on(event: 'dataChange', type: SubscribeType, listener: Callback): void; + + /** + * Register a databases synchronization callback to the database. + *

          Sync result is returned through asynchronous callback. + * + * @param {Callback>} syncCallback - {Array<[string, number]>}: the + * deviceId and it's corresponding synchronization result which 0 means synchronization success + * and otherwise failed. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + on(event: 'syncComplete', syncCallback: Callback>): void; + + /** + * Unsubscribe from the SingleKVStore database based on the specified subscribeType and listener. + * + * @param {Callback} listener - {ChangeNotification}: the {@code ChangeNotification} + * object indicates the data change events in the distributed database. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + off(event: 'dataChange', listener?: Callback): void; + + /** + * Unregister the database synchronization callback. + * + * @param {Callback>} syncCallback - {Array<[string, number]>}: the + * deviceId and it's corresponding synchronization result which 0 means synchronization success + * and otherwise failed. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + off(event: 'syncComplete', syncCallback?: Callback>): void; + + /** + * Get the security level of the database. + * + * @param {AsyncCallback} callback - {SecurityLevel}: the {@code SecurityLevel} + * object indicates the security level of the database. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getSecurityLevel(callback: AsyncCallback): void; + + /** + * Get the security level of the database. + * + * @returns {Promise} {SecurityLevel}: the {@code SecurityLevel} object indicates + * the security level of the database. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getSecurityLevel(): Promise; + } + + /** + * Provides methods related to device-collaboration distributed databases. + * + *

          To create a {@code DeviceKVStore} database, you can use the {@link data.distributed.common.KVManager.getKVStore(Options, String)} + * method with {@code KVStoreType} set to {@code DEVICE_COLLABORATION} for the input parameter Options. This database manages distributed + * data by device, and cannot modify data synchronized from remote devices. When an application writes a key-value pair entry + * into the database, the system automatically adds the ID of the device running the application to the key. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + interface DeviceKVStore extends SingleKVStore { + /** + * Obtains the value matching the local device ID and specified key. + * + * @param {string} key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. + * @param {AsyncCallback} callback - + * {Uint8Array|string|boolean|number}: the returned value specified by the local device ID and specified key. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the data not exist when query data. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + get(key: string, callback: AsyncCallback): void; + + /** + * Obtains the value matching the local device ID and specified key. + * + * @param {string} key - Indicates the key. The length must be less than {@code MAX_KEY_LENGTH}. + * @returns {Promise} + * {Uint8Array|string|boolean|number}: the returned value specified by the local device ID and specified key. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the data not exist when query data. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + get(key: string): Promise; + + /** + * Obtains the value matching a specified device ID and key. + * + * @param {string} deviceId - Indicates the device to be queried. + * @param {string} key - Indicates the key of the value to be queried. + * @param {AsyncCallback} callback - + * {boolean|string|number|Uint8Array}: the returned value specified by the deviceId and key. + * @returns Returns the value matching the given criteria. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the data not exist when query data. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + get(deviceId: string, key: string, callback: AsyncCallback): void; + + /** + * Obtains the value matching a specified device ID and key. + * + * @param {string} deviceId - Indicates the device to be queried. + * @param {string} key - Indicates the key of the value to be queried. + * @returns {Promise} + * {Uint8Array|string|boolean|number}: the returned value specified by the deviceId and key. + * @returns Returns the value matching the given criteria. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100004 - if the data not exist when query data. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + get(deviceId: string, key: string): Promise; + + /** + * Obtains all key-value pairs that match the local device ID and specified key prefix. + * + * @param {string} keyPrefix - Indicates the key prefix to match. + * @param {AsyncCallback} callback - {Entry[]}: the list of all key-value pairs + * that match the local device ID and specified key prefix. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getEntries(keyPrefix: string, callback: AsyncCallback): void; + + /** + * Obtains all key-value pairs that match the local device ID and specified key prefix. + * + * @param {string} keyPrefix - Indicates the key prefix to match. + * @returns {Promise} {Entry[]}: the list of all key-value pairs that match the + * local device ID and specified key prefix. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getEntries(keyPrefix: string): Promise; + + /** + * Obtains all key-value pairs matching a specified device ID and key prefix. + * + * @param {string} deviceId - Identifies the device whose data is to be queried. + * @param {string} keyPrefix - Indicates the key prefix to match. + * @param {AsyncCallback} callback - {Entry[]}: the list of all key-value pairs + * that match the specified deviceId and key prefix. + * @returns Returns the list of all key-value pairs meeting the given criteria. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; + + /** + * Obtains all key-value pairs matching a specified device ID and key prefix. + * + * @param {string} deviceId - Identifies the device whose data is to be queried. + * @param {string} keyPrefix - Indicates the key prefix to match. + * @returns {Promise} {Entry[]}: the list of all key-value pairs that match the + * specified deviceId and key prefix. + * @returns Returns the list of all key-value pairs meeting the given criteria. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + getEntries(deviceId: string, keyPrefix: string): Promise; + + /** + * Obtains the list of key-value pairs matching the local device ID and specified {@code Query} object. + * + * @param {Query} query - Indicates the {@code Query} object. + * @param {AsyncCallback} callback - {Entry[]}: the list of all key-value pairs + * matching the local device ID and specified {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getEntries(query: Query, callback: AsyncCallback): void; + + /** + * Obtains the list of key-value pairs matching the local device ID and specified {@code Query} object. + * + * @param {Query} query - Indicates the {@code Query} object. + * @returns {Promise} {Entry[]}: the list of all key-value pairs matching the local device ID and + * specified {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getEntries(query: Query): Promise; + + /** + * Obtains the list of key-value pairs matching a specified device ID and {@code Query} object. + * + * @param {string} deviceId - Indicates the ID of the device to which the key-value pairs belong. + * @param {string} query - Indicates the {@code Query} object. + * @param {AsyncCallback} callback - {Entry[]}: the list of all key-value pairs + * matching the specified deviceId and {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + getEntries(deviceId: string, query: Query, callback: AsyncCallback): void; + + /** + * Obtains the list of key-value pairs matching a specified device ID and {@code Query} object. + * + * @param {string} deviceId - Indicates the ID of the device to which the key-value pairs belong. + * @param {string} query - Indicates the {@code Query} object. + * @returns {Promise} {Entry[]}: the list of all key-value pairs matching the + * specified deviceId and {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + getEntries(deviceId: string, query: Query): Promise; + + /** + * Obtains the result set with the local device ID and specified prefix from a {@code SingleKVStore} database. + * The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. + * Each {@code SingleKVStore} instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. + * If you have created four objects, calling this method will return a failure. Therefore, you are advised to + * call the closeResultSet method to close unnecessary {@code KVStoreResultSet} objects in a timely manner. + * + * @param {string} keyPrefix - Indicates the key prefix to match. + * @param {AsyncCallback} callback - {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the local device ID and specified keyPrefix. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getResultSet(keyPrefix: string, callback: AsyncCallback): void; + + /** + * Obtains the result set with the local device ID and specified prefix from a {@code SingleKVStore} database. + * The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. + * Each {@code SingleKVStore} instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. + * If you have created four objects, calling this method will return a failure. Therefore, you are advised to + * call the closeResultSet method to close unnecessary {@code KVStoreResultSet} objects in a timely manner. + * + * @param {string} keyPrefix - Indicates the key prefix to match. + * @returns {Promise} {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the local device ID and specified keyPrefix. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getResultSet(keyPrefix: string): Promise; + + /** + * Obtains the {@code KVStoreResultSet} object matching the specified device ID and key prefix. + * + *

          The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. Each {@code SingleKVStore} + * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created four objects, + * calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close unnecessary + * {@code KVStoreResultSet} objects in a timely manner. + * + * @param {string} deviceId - Identifies the device whose data is to be queried. + * @param {string} keyPrefix - Indicates the key prefix to match. + * @param {AsyncCallback} callback - {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified deviceId and keyPrefix. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback): void; + + /** + * Obtains the {@code KVStoreResultSet} object matching the specified device ID and key prefix. + * + *

          The {@code KVStoreResultSet} object can be used to query all key-value pairs that meet the search criteria. Each {@code SingleKVStore} + * instance can have a maximum of four {@code KVStoreResultSet} objects at the same time. If you have created four objects, + * calling this method will return a failure. Therefore, you are advised to call the closeResultSet method to close unnecessary + * {@code KVStoreResultSet} objects in a timely manner. + * + * @param {string} deviceId - Identifies the device whose data is to be queried. + * @param {string} keyPrefix - Indicates the key prefix to match. + * @returns {Promise} {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified deviceId and keyPrefix. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + getResultSet(deviceId: string, keyPrefix: string): Promise; + + /** + * Obtains the {@code KVStoreResultSet} object matching the local device ID and specified {@code Query} object. + * + * @param {Query} query - Indicates the {@code Query} object. + * @param {AsyncCallback} callback - {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the local device ID and specified {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getResultSet(query: Query, callback: AsyncCallback): void; + + /** + * Obtains the {@code KVStoreResultSet} object matching the local device ID and specified {@code Query} object. + * + * @param {Query} query - Indicates the {@code Query} object. + * @returns {Promise} {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the local device ID and specified {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getResultSet(query: Query): Promise; + + /** + * Obtains the {@code KVStoreResultSet} object matching a specified device ID and {@code Query} object. + * + * @param {string} deviceId - Indicates the ID of the device to which the {@code KVStoreResultSet} object belongs. + * @param {Query} query - Indicates the {@code Query} object. + * @param {AsyncCallback} callback - {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified deviceId and {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + getResultSet(deviceId: string, query: Query, callback: AsyncCallback): void; + + /** + * Obtains the {@code KVStoreResultSet} object matching a specified device ID and {@code Query} object. + * + * @param {string} deviceId - Indicates the ID of the device to which the {@code KVStoreResultSet} object belongs. + * @param {Query} query - Indicates the {@code Query} object. + * @returns {Promise} {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified deviceId and {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + getResultSet(deviceId: string, query: Query): Promise; + + /** + * Obtains the KVStoreResultSet object matching the local device ID and specified predicate object. + * + * @param {dataSharePredicates.DataSharePredicates} predicates - Indicates the datasharePredicates. + * @param {AsyncCallback} callback - {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the local device ID and specified {@code dataSharePredicates.DataSharePredicates} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.DataShare.Provider + * @systemapi + * @since 9 + */ + getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; + + /** + * Obtains the KVStoreResultSet object matching the local device ID and specified predicate object. + * + * @param {dataSharePredicates.DataSharePredicates} predicates - Indicates the datasharePredicates. + * @returns {Promise} {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the local device ID and specified {@code dataSharePredicates.DataSharePredicates} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.DataShare.Provider + * @systemapi + * @since 9 + */ + getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise; + + /** + * Obtains the KVStoreResultSet object matching a specified Device ID and Predicate object. + * + * @param deviceId Indicates the ID of the device to which the results belong. + * @param {dataSharePredicates.DataSharePredicates} predicates - Indicates the dataSharePredicates. + * @param {AsyncCallback} callback - {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified deviceId and {@code dataSharePredicates.DataSharePredicates} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.DataShare.Provider + * @systemapi + * @since 9 + */ + getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; + + /** + * Obtains the KVStoreResultSet object matching a specified Device ID and Predicate object. + * + * @param deviceId Indicates the ID of the device to which the results belong. + * @param {dataSharePredicates.DataSharePredicates} predicates - Indicates the dataSharePredicates. + * @returns {Promise} {KVStoreResultSet}: the {@code KVStoreResultSet} + * object matching the specified deviceId and {@code dataSharePredicates.DataSharePredicates} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.DataShare.Provider + * @systemapi + * @since 9 + */ + getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates): Promise; + + /** + * Obtains the number of results matching the local device ID and specified {@code Query} object. + * + * @param {Query} query - Indicates the {@code Query} object. + * @param {AsyncCallback} callback - {number}: the number of results matching the + * local device ID and specified {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getResultSize(query: Query, callback: AsyncCallback): void; + + /** + * Obtains the number of results matching the local device ID and specified {@code Query} object. + * + * @param {Query} query - Indicates the {@code Query} object. + * @returns {Promise} {number}: the number of results matching the local device ID and specified + * {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getResultSize(query: Query): Promise; + + /** + * Obtains the number of results matching a specified device ID and {@code Query} object. + * + * @param {string} deviceId - Indicates the ID of the device to which the results belong. + * @param {Query} query - Indicates the {@code Query} object. + * @param {AsyncCallback} callback - {number}: the number of results matching the + * specified deviceId and {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + getResultSize(deviceId: string, query: Query, callback: AsyncCallback): void; + + /** + * Obtains the number of results matching a specified device ID and {@code Query} object. + * + * @param {string} deviceId - Indicates the ID of the device to which the results belong. + * @param {Query} query - Indicates the {@code Query} object. + * @returns {Promise} {number}: the number of results matching the specified + * deviceId and {@code Query} object. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @throws {BusinessError} 15100005 - if the database or result set has been closed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + getResultSize(deviceId: string, query: Query): Promise; + } + + /** + * Creates a {@link KVManager} instance based on the configuration information. + * + *

          You must pass {@link KVManagerConfig} to provide configuration information + * to create a {@link KVManager} instance. + * + * @param {KVManagerConfig} config - Indicates the KVStore configuration information, + * including the package name and context. + * @param {AsyncCallback} callback - {KVManager}: the {@code KVManager} instance. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + function createKVManager(config: KVManagerConfig, callback: AsyncCallback): void; + + /** + * Creates a {@link KVManager} instance based on the configuration information. + * + *

          You must pass {@link KVManagerConfig} to provide configuration information + * to create a {@link KVManager} instance. + * + * @param {KVManagerConfig} config - Indicates the KVStore configuration information, + * including the package name and context. + * @returns {Promise} {KVManager}: the {@code KVManager} instance. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + function createKVManager(config: KVManagerConfig): Promise; + + /** + * Provides interfaces to manage a {@code SingleKVStore} database, including obtaining, closing, and deleting the {@code SingleKVStore}. + * + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + interface KVManager { + /** + * Creates and obtains a KVStore database by specifying {@code Options} and {@code storeId}. + * + * @param {string} storeId - Identifies the KVStore database. The value of this parameter must be unique + * for the same application, and different applications can share the same value. + * @param {Options} options - Indicates the {@code Options} object used for creating and + * obtaining the KVStore database. + * @param {AsyncCallback} callback - {T}: the {@code SingleKVStore} or {@code DeviceKVStore} instance. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100002 - if open existed database with changed options. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getKVStore(storeId: string, options: Options, callback: AsyncCallback): void; + + /** + * Creates and obtains a KVStore database by specifying {@code Options} and {@code storeId}. + * + * @param {string} storeId - Identifies the KVStore database. The value of this parameter must be unique + * for the same application, and different applications can share the same value. + * @param {Options} options - Indicates the {@code Options} object used for creating and + * obtaining the KVStore database. + * @returns {Promise} {T}: the {@code SingleKVStore} or {@code DeviceKVStore} instance. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100002 - if open existed database with changed options. + * @throws {BusinessError} 15100003 - if the database is corrupted. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getKVStore(storeId: string, options: Options): Promise; + + /** + * Closes the KVStore database. + * + *

          Warning: This method is not thread-safe. If you call this method to stop a KVStore database that is running, your + * thread may crash. + * + *

          The KVStore database to close must be an object created by using the {@code getKVStore} method. Before using this + * method, release the resources created for the database, for example, {@code KVStoreResultSet} for KVStore, otherwise + * closing the database will fail. + * + * @param {string} appId - Identifies the application that the database belong to. + * @param {string} storeId - Identifies the KVStore database to close. + * @param {AsyncCallback} callback - the callback of closeKVStore. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + closeKVStore(appId: string, storeId: string, callback: AsyncCallback): void; + + /** + * Closes the KVStore database. + * + *

          Warning: This method is not thread-safe. If you call this method to stop a KVStore database that is running, your + * thread may crash. + * + *

          The KVStore database to close must be an object created by using the {@code getKVStore} method. Before using this + * method, release the resources created for the database, for example, {@code KVStoreResultSet} for KVStore, otherwise + * closing the database will fail. + * + * @param {string} appId - Identifies the application that the database belong to. + * @param {string} storeId - Identifies the KVStore database to close. + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + closeKVStore(appId: string, storeId: string): Promise; + + /** + * Deletes the KVStore database identified by storeId. + * + *

          Before using this method, close all KVStore instances in use that are identified by the same storeId. + * + *

          You can use this method to delete a KVStore database not in use. After the database is deleted, all its data will be + * lost. + * + * @param {string} appId - Identifies the application that the database belong to. + * @param {string} storeId - Identifies the KVStore database to delete. + * @param {AsyncCallback} callback - the callback of deleteKVStore. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100004 - if the database not exist when delete database. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + deleteKVStore(appId: string, storeId: string, callback: AsyncCallback): void; + + /** + * Deletes the KVStore database identified by storeId. + * + *

          Before using this method, close all KVStore instances in use that are identified by the same storeId. + * + *

          You can use this method to delete a KVStore database not in use. After the database is deleted, all its data will be + * lost. + * + * @param {string} appId - Identifies the application that the database belong to. + * @param {string} storeId - Identifies the KVStore database to delete. + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 401 - if parameter check failed. + * @throws {BusinessError} 15100004 - if the database not exist when delete database. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + deleteKVStore(appId: string, storeId: string): Promise; + + /** + * Obtains the storeId of all KVStore databases that are created by using the {@code getKVStore} method and not deleted by + * calling the {@code deleteKVStore} method. + * + * @param {string} appId - Identifies the application that obtains the databases. + * @param {AsyncCallback} callback - {string[]}: the storeId of all created KVStore databases. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getAllKVStoreId(appId: string, callback: AsyncCallback): void; + + /** + * Obtains the storeId of all KVStore databases that are created by using the {@code getKVStore} method and not deleted by + * calling the {@code deleteKVStore} method. + * + * @param {string} appId - Identifies the application that obtains the databases. + * @returns {Promise} {string[]}: the storeId of all created KVStore databases. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.Core + * @since 9 + */ + getAllKVStoreId(appId: string): Promise; + + /** + * Register a death callback to get notification when service died. + * + * @param {Callback} deathCallback - the service died callback. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @throws {BusinessError} 401 - if parameter check failed. + * @since 9 + */ + on(event: 'distributedDataServiceDie', deathCallback: Callback): void; + + /** + * Unregister the death callback and can not receive service died notification any more. + * + * @param {Callback} deathCallback - the service died callback which has been registered. + * @throws {BusinessError} 401 - if parameter check failed. + * @syscap SystemCapability.DistributedDataManager.KVStore.DistributedKVStore + * @since 9 + */ + off(event: 'distributedDataServiceDie', deathCallback?: Callback): void; + } +} + +export default distributedKVStore; \ No newline at end of file diff --git a/api/@ohos.data.fileAccess.d.ts b/api/@ohos.data.fileAccess.d.ts index 46b8b6c591312332443fbad34b684f7975f8be43..9c31c93412a181b8c3f3fd90f03170827879c594 100644 --- a/api/@ohos.data.fileAccess.d.ts +++ b/api/@ohos.data.fileAccess.d.ts @@ -31,7 +31,7 @@ declare namespace fileAccess { * @syscap SystemCapability.FileManagement.UserFileService * @StageModelOnly * @systemapi - * @permission ohos.permission.FILE_ACCESS_MANAGER + * @permission ohos.permission.FILE_ACCESS_MANAGER and ohos.permission.GET_BUNDLE_INFO_PRIVILEGED * @return Returns the wants. */ function getFileAccessAbilityInfo(callback: AsyncCallback>): void; @@ -43,7 +43,7 @@ declare namespace fileAccess { * @syscap SystemCapability.FileManagement.UserFileService * @StageModelOnly * @systemapi - * @permission ohos.permission.FILE_ACCESS_MANAGER + * @permission ohos.permission.FILE_ACCESS_MANAGER and ohos.permission.GET_BUNDLE_INFO_PRIVILEGED * @param context Indicates the application context. * @return Returns the fileAccessHelper. */ @@ -55,7 +55,7 @@ declare namespace fileAccess { * @syscap SystemCapability.FileManagement.UserFileService * @StageModelOnly * @systemapi - * @permission ohos.permission.FILE_ACCESS_MANAGER + * @permission ohos.permission.FILE_ACCESS_MANAGER and ohos.permission.GET_BUNDLE_INFO_PRIVILEGED * @param context Indicates the application context. * @param want Represents the connected data provider. * @return Returns the fileAccessHelper. diff --git a/api/@ohos.data.preferences.d.ts b/api/@ohos.data.preferences.d.ts index 7355e75a0dffcc60643dba1a72af1d1b431e7225..dabe5d7527732f37da97c97481ce853fe7469b76 100644 --- a/api/@ohos.data.preferences.d.ts +++ b/api/@ohos.data.preferences.d.ts @@ -12,8 +12,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { AsyncCallback, Callback } from './basic'; -import Context from "./application/Context"; +import {AsyncCallback, Callback} from './basic'; +import Context from "./application/BaseContext"; /** * Provides interfaces to obtain and modify preferences data. @@ -30,13 +30,27 @@ declare namespace preferences { *

          The {@link references} instance loads all data of the preferences file and * resides in the memory. You can use removePreferencesFromCache to remove the instance from the memory. * - * @param context Indicates the context of application or capability. - * @param name Indicates the preferences file name. - * @return Returns the {@link Preferences} instance matching the specified preferences file name. - * @throws BusinessError if invoked failed - * @since 9 + * @param {Context} context - Indicates the context of application or capability. + * @param {string} name - Indicates the preferences file name. + * @param {AsyncCallback} callback - the {@link Preferences} instance matching the specified + * preferences file name. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @since 9 */ function getPreferences(context: Context, name: string, callback: AsyncCallback): void; + + /** + * Obtains a {@link Preferences} instance matching a specified preferences file name. + * + *

          The {@link references} instance loads all data of the preferences file and + * resides in the memory. You can use removePreferencesFromCache to remove the instance from the memory. + * + * @param {Context} context - Indicates the context of application or capability. + * @param {string} name - Indicates the preferences file name. + * @returns {Promise} the {@link Preferences} instance matching the specified preferences file name. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @since 9 + */ function getPreferences(context: Context, name: string): Promise; /** @@ -48,12 +62,31 @@ declare namespace preferences { * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency * will occur. * - * @param context Indicates the context of application or capability. - * @param name Indicates the preferences file name. - * @throws BusinessError if invoked failed + * @param {Context} context - Indicates the context of application or capability. + * @param {string} name - Indicates the preferences file name. + * @param {AsyncCallback} callback - Indicates the callback function. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @throws {BusinessError} 15500010 - if failed to delete preferences file. * @since 9 */ function deletePreferences(context: Context, name: string, callback: AsyncCallback): void; + + /** + * Deletes a {@link Preferences} instance matching a specified preferences file name + * from the cache which is performed by removePreferencesFromCache and deletes the + * preferences file. + * + *

          When deleting the {@link Preferences} instance, you must release all references + * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency + * will occur. + * + * @param {Context} context - Indicates the context of application or capability. + * @param {string} name - Indicates the preferences file name. + * @returns {Promise} a promise object. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @throws {BusinessError} 15500010 - if failed to delete preferences file. + * @since 9 + */ function deletePreferences(context: Context, name: string): Promise; /** @@ -64,12 +97,28 @@ declare namespace preferences { * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency * will occur. * - * @param context Indicates the context of application or capability. - * @param name Indicates the preferences file name. - * @throws BusinessError if invoked failed + * @param {Context} context - Indicates the context of application or capability. + * @param {string} name - Indicates the preferences file name. + * @param {AsyncCallback} callback - Indicates the callback function. + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @since 9 */ function removePreferencesFromCache(context: Context, name: string, callback: AsyncCallback): void; + + /** + * Deletes a {@link Preferences} instance matching a specified preferences file name + * from the cache. + * + *

          When deleting the {@link Preferences} instance, you must release all references + * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency + * will occur. + * + * @param {Context} context - Indicates the context of application or capability. + * @param {string} name - Indicates the preferences file name. + * @returns {Promise} a promise object. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @since 9 + */ function removePreferencesFromCache(context: Context, name: string): Promise; /** @@ -77,7 +126,7 @@ declare namespace preferences { * *

          The preferences data is stored in a file, which matches only one {@link Preferences} instance in the memory. * You can use getPreferences to obtain the {@link Preferences} instance matching - * the file that stores preferences data, and use emovePreferencesFromCache + * the file that stores preferences data, and use movePreferencesFromCache * to remove the {@link Preferences} instance from the memory. * * @syscap SystemCapability.DistributedDataManager.Preferences.Core @@ -86,39 +135,71 @@ declare namespace preferences { */ interface Preferences { /** - * Obtains the value of a preferences in the int format. - * - *

          If the value is {@code null} or not in the int format, the default value is returned. - * - * @param key Indicates the key of the preferences. It cannot be {@code null} or empty. - * @param defValue Indicates the default value to return. - * @return Returns the value matching the specified key if it is found; returns the default value otherwise. - * @throws BusinessError if invoked failed - * @since 9 - */ + * Obtains the value of a preferences in the int format. + * + *

          If the value is {@code null} or not in the int format, the default value is returned. + * + * @param {string} key - Indicates the key of the preferences. It cannot be {@code null} or empty. + * @param {ValueType} defValue - Indicates the default value to return. + * @param {AsyncCallback} callback - the value matching the specified key if it is found; + * returns the default value otherwise. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @since 9 + */ get(key: string, defValue: ValueType, callback: AsyncCallback): void; + + /** + * Obtains the value of a preferences in the int format. + * + *

          If the value is {@code null} or not in the int format, the default value is returned. + * + * @param {string} key - Indicates the key of the preferences. It cannot be {@code null} or empty. + * @param {ValueType} defValue - Indicates the default value to return. + * @returns {Promise} the value matching the specified key if it is found; + * returns the default value otherwise. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @since 9 + */ get(key: string, defValue: ValueType): Promise; /** - * Obtains all the keys and values of a preferences in an object. - * - * @return Returns the values and keys in an object. - * @throws BusinessError if invoked failed - * @since 9 - */ + * Obtains all the keys and values of a preferences in an object. + * + * @param {AsyncCallback} callback - the values and keys in an object. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @since 9 + */ getAll(callback: AsyncCallback): void; + + /** + * Obtains all the keys and values of a preferences in an object. + * + * @returns {Promise} the values and keys in an object. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @since 9 + */ getAll(): Promise; /** * Checks whether the {@link Preferences} object contains a preferences matching a specified key. * - * @param key Indicates the key of the preferences to check for. - * @return Returns {@code true} if the {@link Preferences} object contains a preferences with the specified key; - * returns {@code false} otherwise. - * @throws BusinessError if invoked failed + * @param {string} key - Indicates the key of the preferences to modify. It cannot be {@code null} or empty. + * @param {AsyncCallback} callback - {@code true} if the {@link Preferences} object contains a preferences + * with the specified key;returns {@code false} otherwise. + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @since 9 */ has(key: string, callback: AsyncCallback): void; + + /** + * Checks whether the {@link Preferences} object contains a preferences matching a specified key. + * + * @param {string} key - Indicates the key of the preferences to modify. It cannot be {@code null} or empty. + * @returns {Promise} {@code true} if the {@link Preferences} object contains + * a preferences with the specified key; returns {@code false} otherwise. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @since 9 + */ has(key: string): Promise; /** @@ -127,13 +208,28 @@ declare namespace preferences { *

          You can call the {@link #flush} method to save the {@link Preferences} object to the * file. * - * @param key Indicates the key of the preferences to modify. It cannot be {@code null} or empty. - * @param value Indicates the value of the preferences. - * MAX_KEY_LENGTH. - * @throws BusinessError if invoked failed + * @param {string} key - Indicates the key of the preferences to modify. It cannot be {@code null} or empty. + * @param {ValueType} value - Indicates the value of the preferences. + * MAX_KEY_LENGTH. + * @param {AsyncCallback} callback - Indicates the callback function. + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @since 9 */ put(key: string, value: ValueType, callback: AsyncCallback): void; + + /** + * Sets an int value for the key in the {@link Preferences} object. + * + *

          You can call the {@link #flush} method to save the {@link Preferences} object to the + * file. + * + * @param {string} key - Indicates the key of the preferences to modify. It cannot be {@code null} or empty. + * @param {ValueType} value - Indicates the value of the preferences. + * MAX_KEY_LENGTH. + * @returns {Promise} a promise object. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @since 9 + */ put(key: string, value: ValueType): Promise; /** @@ -142,40 +238,70 @@ declare namespace preferences { *

          You can call the {@link #flush} method to save the {@link Preferences} object to the * file. * - * @param key Indicates the key of the preferences to delete. It cannot be {@code null} or empty. - * MAX_KEY_LENGTH. - * @throws BusinessError if invoked failed + * @param {string} key - Indicates the key of the preferences to delete. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @param {AsyncCallback} callback - Indicates the callback function. + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @since 9 */ delete(key: string, callback: AsyncCallback): void; - delete(key: string): Promise; /** - * Clears all preferences from the {@link Preferences} object. + * Deletes the preferences with a specified key from the {@link Preferences} object. * *

          You can call the {@link #flush} method to save the {@link Preferences} object to the * file. * - * @throws BusinessError if invoked failed + * @param {string} key - Indicates the key of the preferences to delete. It cannot be {@code null} or empty. + * MAX_KEY_LENGTH. + * @returns {Promise} a promise object. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @since 9 + */ + delete(key: string): Promise; + + /** + * Clears all preferences from the {@link Preferences} object. + * + *

          You can call the {@link #flush} method to save the {@link Preferences} object to the file. + * + * @param {AsyncCallback} callback - Indicates the callback function. * @since 9 */ clear(callback: AsyncCallback): void; + + /** + * Clears all preferences from the {@link Preferences} object. + * + *

          You can call the {@link #flush} method to save the {@link Preferences} object to the file. + * + * @returns {Promise} a promise object. + * @since 9 + */ clear(): Promise; /** * Asynchronously saves the {@link Preferences} object to the file. * - * @throws BusinessError if invoked failed + * @param {AsyncCallback} callback - Indicates the callback function. * @since 9 */ flush(callback: AsyncCallback): void; + + /** + * Asynchronously saves the {@link Preferences} object to the file. + * + * @returns {Promise} a promise object. + * @since 9 + */ flush(): Promise; /** * Registers an observer to listen for the change of a {@link Preferences} object. * - * @param callback Indicates the callback when preferences changes. - * @throws BusinessError if invoked failed + * @param {Callback} callback - indicates the callback when preferences changes. + * @param {Callback<{key: string}>} callback - Indicates the callback function. + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @since 9 */ on(type: 'change', callback: Callback<{ key: string }>): void; @@ -183,8 +309,9 @@ declare namespace preferences { /** * Unregisters an existing observer. * - * @param callback Indicates the registered callback. - * @throws BusinessError if invoked failed + * @param {Callback} callback - indicates the callback when preferences changes. + * @param {Callback<{key: string}>} callback - Indicates the callback function. + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @since 9 */ off(type: 'change', callback?: Callback<{ key: string }>): void; diff --git a/api/@ohos.data.rdb.d.ts b/api/@ohos.data.rdb.d.ts index 9ae430851bb9a4c578c907474d72fbfaec73dec4..8e7a2b49b168c5cdc3bdc8279a8ac6e097e08fbc 100644 --- a/api/@ohos.data.rdb.d.ts +++ b/api/@ohos.data.rdb.d.ts @@ -13,48 +13,141 @@ * limitations under the License. */ -import {AsyncCallback, Callback} from './basic'; -import { ResultSet as _ResultSet } from './data/rdb/resultSet'; +import{ AsyncCallback, Callback } from './basic'; +import{ ResultSet as _ResultSet } from './data/rdb/resultSet'; +import{ ResultSetV9 as _ResultSetV9 } from './data/rdb/resultSet'; import Context from "./application/BaseContext"; import dataSharePredicates from './@ohos.data.dataSharePredicates'; /** * Provides methods for rdbStore create and delete. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @import import data_rdb from '@ohos.data.rdb'; + * @since 7 */ -declare namespace rdb { +declare namespace rdb +{ /** * Obtains an RDB store. * * You can set parameters of the RDB store as required. In general, this method is recommended * to obtain a rdb store. * - * @since 7 + * @param {Context} context - Indicates the context of application or capability. + * @param {StoreConfig} config - Indicates the {@link StoreConfig} configuration of the database related to this RDB store. + * @param {number} version - Indicates the database version for upgrade or downgrade. + * @param {AsyncCallback} callback - the RDB store {@link RdbStore}. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param context Indicates the context of application or capability. - * @param config Indicates the configuration of the database related to this RDB store. The configurations include - * the database path, storage mode, and whether the database is read-only. - * @param version Indicates the database version for upgrade or downgrade. - * @return Returns an RDB store {@link ohos.data.rdb.RdbStore}. + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.getRdbStoreV9 */ function getRdbStore(context: Context, config: StoreConfig, version: number, callback: AsyncCallback): void; + + /** + * Obtains an RDB store. + * + * You can set parameters of the RDB store as required. In general, this method is recommended + * to obtain a rdb store. + * + * @param {Context} context - Indicates the context of application or capability. + * @param {StoreConfig} config - Indicates the {@link StoreConfig} configuration of the database related to this RDB store. + * @param {number} version - Indicates the database version for upgrade or downgrade. + * @returns {Promise} the RDB store {@link RdbStore}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.getRdbStoreV9 + */ function getRdbStore(context: Context, config: StoreConfig, version: number): Promise; + /** + * Obtains an RDB store. + * + * You can set parameters of the RDB store as required. In general, this method is recommended + * to obtain a rdb store. + * + * @param {Context} context - Indicates the context of application or capability. + * @param {StoreConfigV9} config - Indicates the {@link StoreConfigV9} configuration of the database related to this RDB store. + * @param {number} version - Indicates the database version for upgrade or downgrade. + * @param {AsyncCallback} callback - the RDB store {@link RdbStoreV9}. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @throws {BusinessError} 14800010 - if failed open database by invalid database name + * @throws {BusinessError} 14800011 - if failed open database by database corrupted + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + function getRdbStoreV9(context: Context, config: StoreConfigV9, version: number, callback: AsyncCallback): void; + + /** + * Obtains an RDB store. + * + * You can set parameters of the RDB store as required. In general, this method is recommended + * to obtain a rdb store. + * + * @param {Context} context - Indicates the context of application or capability. + * @param {StoreConfigV9} config - Indicates the {@link StoreConfigV9} configuration of the database related to this RDB store. + * @param {number} version - Indicates the database version for upgrade or downgrade. + * @returns {Promise} the RDB store {@link RdbStoreV9}. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @throws {BusinessError} 14800010 - if failed open database by invalid database name + * @throws {BusinessError} 14800011 - if failed open database by database corrupted + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + function getRdbStoreV9(context: Context, config: StoreConfigV9, version: number): Promise; + /** * Deletes the database with a specified name. * - * @since 7 + * @param {Context} context - Indicates the context of application or capability. + * @param {string} name - Indicates the database name. + * @param {AsyncCallback} callback - the callback of deleteRdbStore. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param context Indicates the context of application or capability. - * @param name Indicates the database name. - * @return Returns true if the database is deleted; returns false otherwise. + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.deleteRdbStoreV9 */ function deleteRdbStore(context: Context, name: string, callback: AsyncCallback): void; + /** + * Deletes the database with a specified name. + * + * @param {Context} context - Indicates the context of application or capability. + * @param {string} name - Indicates the database name. + * @returns {Promise} the promise returned by the function. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.deleteRdbStoreV9 + */ function deleteRdbStore(context: Context, name: string): Promise; + /** + * Deletes the database with a specified name. + * + * @param {Context} context - Indicates the context of application or capability. + * @param {string} name - Indicates the database name. + * @param {AsyncCallback} callback - the callback of deleteRdbStore. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @throws {BusinessError} 14800010 - if failed delete database by invalid database name + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + function deleteRdbStoreV9(context: Context, name: string, callback: AsyncCallback): void; + + /** + * Deletes the database with a specified name. + * + * @param {Context} context - Indicates the context of application or capability. + * @param {string} name - Indicates the database name. + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @throws {BusinessError} 14800010 - if failed delete database by invalid database name + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + function deleteRdbStoreV9(context: Context, name: string): Promise; + /** * Indicates the database synchronization mode. * @@ -95,661 +188,1700 @@ declare namespace rdb { SUBSCRIBE_TYPE_REMOTE = 0, } + /** + * Describes the {@code RdbStoreV9} type. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + enum SecurityLevel { + /** + * S1: mains the db is low level security + * There are some low impact, when the data is leaked. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + S1 = 1, + + /** + * S2: mains the db is middle level security + * There are some major impact, when the data is leaked. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + S2 = 2, + + /** + * S3: mains the db is high level security + * There are some severity impact, when the data is leaked. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + S3 = 3, + + /** + * S4: mains the db is critical level security + * There are some critical impact, when the data is leaked. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + S4 = 4, + } + /** * Provides methods for managing the relational database (RDB). * * This class provides methods for creating, querying, updating, and deleting RDBs. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @import import data_rdb from '@ohos.data.rdb'; + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbStoreV9 */ interface RdbStore { /** * Inserts a row of data into the target table. * - * @since 7 + * @param {string} table - Indicates the row of data to be inserted into the table. + * @param {ValuesBucket} values - Indicates the row of data {@link ValuesBucket} to be inserted into the table. + * @param {AsyncCallback} callback - the row ID if the operation is successful. returns -1 otherwise. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param table Indicates the target table. - * @param values Indicates the row of data to be inserted into the table. - * @return Returns the row ID if the operation is successful; returns -1 otherwise. + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbStoreV9.insert */ insert(table: string, values: ValuesBucket, callback: AsyncCallback): void; + + /** + * Inserts a row of data into the target table. + * + * @param {string} table - Indicates the row of data to be inserted into the table. + * @param {ValuesBucket} values - Indicates the row of data {@link ValuesBucket} to be inserted into the table. + * @returns {Promise} return the row ID if the operation is successful. return -1 otherwise. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbStoreV9.insert + */ insert(table: string, values: ValuesBucket): Promise; /** * Inserts a batch of data into the target table. * - * @since 9 + * @param {string} table - Indicates the target table. + * @param {Array} values - Indicates the rows of data {@link ValuesBucket} to be inserted into the table. + * @param {AsyncCallback} callback - the number of values that were inserted if the operation is successful. returns -1 otherwise. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param table Indicates the target table. - * @param values Indicates the rows of data to be inserted into the table. - * @return Returns the number of values that were inserted if the operation is successful; returns -1 otherwise. + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbStoreV9.batchInsert */ batchInsert(table: string, values: Array, callback: AsyncCallback): void; - batchInsert(table: string, values: Array): Promise; /** - * Updates data in the database based on a a specified instance object of rdbPredicates. + * Inserts a batch of data into the target table. * + * @param {string} table - Indicates the target table. + * @param {Array} values - Indicates the rows of data {@link ValuesBucket} to be inserted into the table. + * @returns {Promise} return the number of values that were inserted if the operation is successful. returns -1 otherwise. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbStoreV9.batchInsert + */ + batchInsert(table: string, values: Array): Promise; + + /** + * Updates data in the database based on a a specified instance object of RdbPredicates. + * + * @param {ValuesBucket} values - Indicates Indicates the row of data to be updated in the database.The key-value pairs are associated with column names of the database table. + * @param {RdbPredicates} predicates - Indicates the specified update condition by the instance object of {@link RdbPredicates}. + * @param {AsyncCallback} callback - the number of affected rows. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param values Indicates the row of data to be updated in the database.The key-value pairs are associated with column names of the database table. - * @param predicates Indicates the specified update condition by the instance object of RdbPredicates. - * @return Returns the number of affected rows. + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbStoreV9.update */ update(values: ValuesBucket, predicates: RdbPredicates, callback: AsyncCallback): void; - update(values: ValuesBucket, predicates: RdbPredicates): Promise; /** - * Updates data in the database based on a a specified instance object of DataSharePredicates. + * Updates data in the database based on a a specified instance object of RdbPredicates. * - * @since 9 + * @param {ValuesBucket} values - Indicates Indicates the row of data to be updated in the database.The key-value pairs are associated with column names of the database table. + * @param {RdbPredicates} predicates - Indicates the specified update condition by the instance object of {@link RdbPredicates}. + * @returns {Promise} return the number of affected rows. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @systemapi - * @param table Indicates the target table. - * @param values Indicates the row of data to be updated in the database.The key-value pairs are associated with column names of the database table. - * @param predicates Indicates the specified update condition by the instance object of DataSharePredicates. - * @return Returns the number of affected rows. + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbStoreV9.update */ - update(table: string, values: ValuesBucket, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; - update(table: string, values: ValuesBucket, predicates: dataSharePredicates.DataSharePredicates): Promise; - + update(values: ValuesBucket, predicates: RdbPredicates): Promise; + /** - * Deletes data from the database based on a specified instance object of rdbPredicates. + * Deletes data from the database based on a specified instance object of RdbPredicates. * - * @since 7 + * @param {RdbPredicates} predicates - the specified delete condition by the instance object of {@link RdbPredicates}. + * @param {AsyncCallback} callback - the number of affected rows. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param predicates Indicates the specified delete condition by the instance object of RdbPredicates. - * @return Returns the number of affected rows. + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbStoreV9.delete */ delete(predicates: RdbPredicates, callback: AsyncCallback): void; - delete(predicates: RdbPredicates): Promise; /** - * Deletes data from the database based on a specified instance object of DataSharePredicates. + * Deletes data from the database based on a specified instance object of RdbPredicates. * - * @since 9 + * @param {RdbPredicates} predicates - the specified delete condition by the instance object of {@link RdbPredicates}. + * @returns {Promise} return the number of affected rows. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @systemapi - * @param table Indicates the target table. - * @param predicates Indicates the specified delete condition by the instance object of DataSharePredicates. - * @return Returns the number of affected rows. + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbStoreV9.delete */ - delete(table: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; - delete(table: string, predicates: dataSharePredicates.DataSharePredicates): Promise; + delete(predicates: RdbPredicates): Promise; /** * Queries data in the database based on specified conditions. * - * @since 7 + * @param {RdbPredicates} predicates - the specified query condition by the instance object of {@link RdbPredicates}. + * @param {Array} columns - the columns to query. If the value is empty array, the query applies to all columns. + * @param {AsyncCallback} callback - the {@link ResultSet} object if the operation is successful. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param predicates Indicates the specified query condition by the instance object of RdbPredicates. - * @param columns Indicates the columns to query. If the value is null, the query applies to all columns. - * @return Returns a ResultSet object if the operation is successful; + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbStoreV9.query */ query(predicates: RdbPredicates, columns: Array, callback: AsyncCallback): void; - query(predicates: RdbPredicates, columns?: Array): Promise; /** * Queries data in the database based on specified conditions. * - * @since 9 + * @param {RdbPredicates} predicates - the specified query condition by the instance object of {@link RdbPredicates}. + * @param {Array} columns - the columns to query. If the value is null, the query applies to all columns. + * @returns {Promise} return the {@link ResultSet} object if the operation is successful. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @systemapi - * @param table Indicates the target table. - * @param predicates Indicates the specified query condition by the instance object of DataSharePredicates. - * @param columns Indicates the columns to query. If the value is null, the query applies to all columns. - * @return Returns a ResultSet object if the operation is successful; + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbStoreV9.query */ - query(table: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array, callback: AsyncCallback): void; - query(table: string, predicates: dataSharePredicates.DataSharePredicates, columns?: Array): Promise; - - /** - * Queries remote data in the database based on specified conditions before Synchronizing Data. + query(predicates: RdbPredicates, columns ?: Array): Promise; + + /** + * Deletes data from the database based on a specified instance object of RdbPredicates. * - * @since 9 + * @param {string} sql - Indicates the SQL statement to execute. + * @param {Array} bindArgs - Indicates the {@link ValueType} values of the parameters in the SQL statement. The values are strings. + * @returns {Promise} return the {@link ResultSet} object if the operation is successful. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param device Indicates specified remote device. - * @param table Indicates the target table. - * @param predicates Indicates the specified remote query condition by the instance object of RdbPredicates. - * @param columns Indicates the columns to remote query. If the value is null, the remote query applies to all columns. - * @return Returns a ResultSet object if the operation is successful; + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbStoreV9.querySql */ - remoteQuery(device: string, table: string, predicates: RdbPredicates, columns: Array, callback: AsyncCallback): void; - remoteQuery(device: string, table: string, predicates: RdbPredicates, columns: Array): Promise; - + querySql(sql: string, bindArgs: Array, callback: AsyncCallback): void; /** - * Queries data in the database based on SQL statement. + * Deletes data from the database based on a specified instance object of RdbPredicates. * - * @since 8 + * @param {string} sql - Indicates the SQL statement to execute. + * @param {Array} bindArgs - Indicates the {@link ValueType} values of the parameters in the SQL statement. The values are strings. + * @returns {Promise} return the {@link ResultSet} object if the operation is successful. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param sql Indicates the SQL statement to execute. - * @param bindArgs Indicates the values of the parameters in the SQL statement. The values are strings. - * @return Returns a ResultSet object if the operation is successful; + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbStoreV9.querySql */ - querySql(sql: string, bindArgs: Array, callback: AsyncCallback): void; - querySql(sql: string, bindArgs?: Array): Promise; + querySql(sql: string, bindArgs ?: Array): Promise; /** * Executes an SQL statement that contains specified parameters but returns no value. * - * @since 7 + * @param {string} sql - Indicates the SQL statement to execute. + * @param {Array} bindArgs - Indicates the {@link ValueType} values of the parameters in the SQL statement. The values are strings. + * @param {AsyncCallback} callback - the callback of executeSql. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param sql Indicates the SQL statement to execute. - * @param bindArgs Indicates the values of the parameters in the SQL statement. The values are strings. + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbStoreV9.executeSql */ executeSql(sql: string, bindArgs: Array, callback: AsyncCallback): void; - executeSql(sql: string, bindArgs?: Array): Promise; /** - * beginTransaction before excute your sql + * Executes an SQL statement that contains specified parameters but returns no value. * - * @since 8 + * @param {string} sql - Indicates the SQL statement to execute. + * @param {Array} bindArgs - Indicates the {@link ValueType} values of the parameters in the SQL statement. The values are strings. + * @returns {Promise} the promise returned by the function. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbStoreV9.executeSql */ - beginTransaction():void; + executeSql(sql: string, bindArgs ?: Array): Promise; /** - * commit the the sql you have excuted. + * Begin Transaction before execute your sql. * - * @since 8 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbStoreV9.beginTransaction */ - commit():void; + beginTransaction(): void; /** - * roll back the sql you have already excuted + * Commit the the sql you have executed. * - * @since 8 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbStoreV9.commit */ - rollBack():void; + commit(): void; /** - * Backs up a database in a specified name. + * Roll back the sql you have already executed. * - * @since 9 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param destName Indicates the name that saves the database backup. + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbStoreV9.rollBack */ - backup(destName:string, callback: AsyncCallback):void; - backup(destName:string): Promise; + rollBack(): void; /** - * Restores a database from a specified database file. + * Set table to be distributed table. * - * @since 9 + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param {Array} tables - Indicates the tables name you want to set. + * @param {AsyncCallback} callback - the callback of setDistributedTables. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param srcName Indicates the name that saves the database file. + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbStoreV9.setDistributedTables */ - restore(srcName:string, callback: AsyncCallback):void; - restore(srcName:string): Promise; + setDistributedTables(tables: Array, callback: AsyncCallback): void; /** * Set table to be distributed table. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param tables the tables name you want to set * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param {Array} tables - Indicates the tables name you want to set. + * @returns {Promise} the promise returned by the function. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbStoreV9.setDistributedTables */ - setDistributedTables(tables: Array, callback: AsyncCallback): void; setDistributedTables(tables: Array): Promise; /** * Obtain distributed table name of specified remote device according to local table name. * When query remote device database, distributed table name is needed. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param device Indicates the remote device. - * @param table Indicates the local table name. * @permission ohos.permission.DISTRIBUTED_DATASYNC - * @return the distributed table name. + * @param {string} device - Indicates the remote device. + * @param {AsyncCallback} callback - {string}: the distributed table name. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbStoreV9.obtainDistributedTableName */ obtainDistributedTableName(device: string, table: string, callback: AsyncCallback): void; - obtainDistributedTableName(device: string, table: string): Promise; /** - * Sync data between devices + * Obtain distributed table name of specified remote device according to local table name. + * When query remote device database, distributed table name is needed. * - * @since 8 - * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param mode Indicates the synchronization mode. The value can be PUSH, PULL. - * @param predicates Constraint synchronized data and devices. - * @param callback Indicates the callback used to send the synchronization result to the caller. * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param {string} device - Indicates the remote device. + * @returns {Promise} {string}: the distributed table name. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbStoreV9.obtainDistributedTableName */ - sync(mode: SyncMode, predicates: RdbPredicates, callback: AsyncCallback>): void; - sync(mode: SyncMode, predicates: RdbPredicates): Promise>; + obtainDistributedTableName(device: string, table: string): Promise; /** - * Registers an observer for the database. When data in the distributed database changes, - * the callback will be invoked. + * Sync data between devices. * - * @since 8 + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param {string} device - Indicates the remote device. + * @param {AsyncCallback>} callback - {Array<[string, number]>}: devices sync status array, {string}: device id, {number}: device sync status. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. - * @param observer Indicates the observer of data change events in the distributed database. + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbStoreV9.sync + */ + sync(mode: SyncMode, predicates: RdbPredicates, callback: AsyncCallback>): void; + + /** + * Sync data between devices. + * * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param {string} device - Indicates the remote device. + * @returns {Promise>} {Array<[string, number]>}: devices sync status array, {string}: device id, {number}: device sync status. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbStoreV9.sync */ + sync(mode: SyncMode, predicates: RdbPredicates): Promise>; + + /** + * Registers an observer for the database. When data in the distributed database changes, + * the callback will be invoked. + * + * @param {string} event - Indicates the event must be string 'dataChange'. + * @param {SubscribeType} type - Indicates the subscription type, which is defined in {@link SubscribeType}. + * @param {AsyncCallback>} observer - {Array}: the observer of data change events in the distributed database. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbStoreV9.on + */ on(event: 'dataChange', type: SubscribeType, observer: Callback>): void; /** * Remove specified observer of specified type from the database. * - * @since 8 + * @param {string} event - Indicates the event must be string 'dataChange'. + * @param {SubscribeType} type - Indicates the subscription type, which is defined in {@link SubscribeType}. + * @param {AsyncCallback>} observer - {Array}: the data change observer already registered. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param type Indicates the subscription type, which is defined in {@code SubscribeType}. - * @param observer Indicates the data change observer already registered. - * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbStoreV9.off */ - off(event:'dataChange', type: SubscribeType, observer: Callback>): void; + off(event: 'dataChange', type: SubscribeType, observer: Callback>): void; } /** - * Indicates possible value types - * - * @since 7 - * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @import import data_rdb from '@ohos.data.rdb'; - */ - type ValueType = number | string | boolean; - - /** - * Values in buckets are stored in key-value pairs + * Provides methods for managing the relational database (RDB). * - * @since 7 - * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @import import data_rdb from '@ohos.data.rdb'; - */ - type ValuesBucket = { - [key: string]: ValueType | Uint8Array | null; - } - - /** - * Manages relational database configurations. + * This class provides methods for creating, querying, updating, and deleting RDBs. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @import import data_rdb from '@ohos.data.rdb'; + * @since 9 */ - interface StoreConfig { - name: string; - + interface RdbStoreV9 { /** - * Specifies whether the database is encrypted. + * Inserts a row of data into the target table. * - * @since 9 + * @param {string} table - Indicates the row of data to be inserted into the table. + * @param {ValuesBucket} values - Indicates the row of data {@link ValuesBucket} to be inserted into the table. + * @param {AsyncCallback} callback - the row ID if the operation is successful. returns -1 otherwise. + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @import import data_rdb from '@ohos.data.rdb'; - */ - encrypt?: boolean; - } + * @since 9 + */ + insert(table: string, values: ValuesBucket, callback: AsyncCallback): void; - /** - * Manages relational database configurations. - * - * @since 7 - * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @import import data_rdb from '@ohos.data.rdb'; - */ - class RdbPredicates { /** - * A parameterized constructor used to create an RdbPredicates instance. - * name Indicates the table name of the database. + * Inserts a row of data into the target table. * - * @since 7 + * @param {string} table - Indicates the row of data to be inserted into the table. + * @param {ValuesBucket} values - Indicates the row of data {@link ValuesBucket} to be inserted into the table. + * @returns {Promise} return the row ID if the operation is successful. return -1 otherwise. + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 */ - constructor(name: string) + insert(table: string, values: ValuesBucket): Promise; /** - * Specify remote devices when syncing distributed database. + * Inserts a batch of data into the target table. * - * @note When query database, this function should not be called. - * @since 8 + * @param {string} table - Indicates the target table. + * @param {Array} values - Indicates the rows of data {@link ValuesBucket} to be inserted into the table. + * @param {AsyncCallback} callback - the number of values that were inserted if the operation is successful. returns -1 otherwise. + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param devices Indicates specified remote devices. - * @return Returns the RdbPredicates self. + * @since 9 */ - inDevices(devices: Array): RdbPredicates; + batchInsert(table: string, values: Array, callback: AsyncCallback): void; /** - * Specify all remote devices which connect to local device when syncing distributed database. + * Inserts a batch of data into the target table. * - * @note When query database, this function should not be called. - * @since 8 + * @param {string} table - Indicates the target table. + * @param {Array} values - Indicates the rows of data {@link ValuesBucket} to be inserted into the table. + * @returns {Promise} return the number of values that were inserted if the operation is successful. returns -1 otherwise. + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @return Returns the RdbPredicates self. + * @since 9 */ - inAllDevices(): RdbPredicates; + batchInsert(table: string, values: Array): Promise; /** - * Configures the RdbPredicates to match the field whose data type is ValueType and value is equal - * to a specified value. + * Updates data in the database based on a a specified instance object of RdbPredicatesV9. * - * @note This method is similar to = of the SQL statement. - * @since 7 + * @param {ValuesBucket} values - Indicates Indicates the row of data to be updated in the database.The key-value pairs are associated with column names of the database table. + * @param {RdbPredicatesV9} predicates - Indicates the specified update condition by the instance object of {@link RdbPredicatesV9}. + * @param {AsyncCallback} callback - the number of affected rows. + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param field Indicates the column name in the database table. - * @param value Indicates the value to match with the RdbPredicates. - * @return Returns the RdbPredicates that match the specified field. + * @since 9 */ - equalTo(field: string, value: ValueType): RdbPredicates; + update(values: ValuesBucket, predicates: RdbPredicatesV9, callback: AsyncCallback): void; /** - * Configures the RdbPredicates to match the field whose data type is ValueType and value is unequal to - * a specified value. + * Updates data in the database based on a a specified instance object of RdbPredicatesV9. * - * @note This method is similar to != of the SQL statement. - * @since 7 + * @param {ValuesBucket} values - Indicates Indicates the row of data to be updated in the database.The key-value pairs are associated with column names of the database table. + * @param {RdbPredicatesV9} predicates - Indicates the specified update condition by the instance object of {@link RdbPredicatesV9}. + * @returns {Promise} return the number of affected rows. + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param field Indicates the column name in the database table. - * @param value Indicates the value to match with the RdbPredicates. - * @return Returns the RdbPredicates that match the specified field. + * @since 9 */ - notEqualTo(field: string, value: ValueType): RdbPredicates; + update(values: ValuesBucket, predicates: RdbPredicatesV9): Promise; /** - * Adds a left parenthesis to the RdbPredicates. + * Updates data in the database based on a a specified instance object of RdbPredicatesV9. * - * @note This method is similar to ( of the SQL statement and needs to be used together with endWrap(). - * @since 7 + * @param {string} table - Indicates the target table. + * @param {ValuesBucket} values - Indicates the row of data to be updated in the database.The key-value pairs are associated with column names of the database table. + * @param {DataSharePredicates} predicates - Indicates the specified update condition by the instance object of {@link dataSharePredicates.DataSharePredicates}. + * @param {AsyncCallback} callback - the number of affected rows. + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @return Returns the RdbPredicates with the left parenthesis. + * @since 9 */ - beginWrap(): RdbPredicates; + update(table: string, values: ValuesBucket, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; /** - * Adds a right parenthesis to the RdbPredicates. + * Updates data in the database based on a a specified instance object of RdbPredicatesV9. * - * @note This method is similar to ) of the SQL statement and needs to be used together - * with beginWrap(). - * @since 7 + * @param {string} table - Indicates the target table. + * @param {ValuesBucket} values - Indicates the row of data to be updated in the database.The key-value pairs are associated with column names of the database table. + * @param {DataSharePredicates} predicates - Indicates the specified update condition by the instance object of {@link dataSharePredicates.DataSharePredicates}. + * @returns {Promise} return the number of affected rows. + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @return Returns the RdbPredicates with the right parenthesis. + * @since 9 */ - endWrap(): RdbPredicates; + update(table: string, values: ValuesBucket, predicates: dataSharePredicates.DataSharePredicates): Promise; /** - * Adds an or condition to the RdbPredicates. + * Deletes data from the database based on a specified instance object of RdbPredicatesV9. * - * @note This method is similar to or of the SQL statement. - * @since 7 + * @param {RdbPredicatesV9} predicates - the specified delete condition by the instance object of {@link RdbPredicatesV9}. + * @param {AsyncCallback} callback - the number of affected rows. + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @return Returns the RdbPredicates with the or condition. + * @since 9 */ - or(): RdbPredicates; + delete(predicates: RdbPredicatesV9, callback: AsyncCallback): void; /** - * Adds an and condition to the RdbPredicates. + * Deletes data from the database based on a specified instance object of RdbPredicatesV9. * - * @note This method is similar to and of the SQL statement. - * @since 7 + * @param {RdbPredicatesV9} predicates - the specified delete condition by the instance object of {@link RdbPredicatesV9}. + * @returns {Promise} return the number of affected rows. + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @return Returns the RdbPredicates with the and condition. + * @since 9 */ - and(): RdbPredicates; + delete(predicates: RdbPredicatesV9): Promise; /** - * Configures the RdbPredicates to match the field whose data type is string and value - * contains a specified value. + * Deletes data from the database based on a specified instance object of RdbPredicatesV9. * - * @note This method is similar to contains of the SQL statement. - * @since 7 + * @param {string} table - Indicates the target table. + * @param {DataSharePredicates} predicates - the specified delete condition by the instance object of {@link dataSharePredicates.DataSharePredicates}. + * @param {AsyncCallback} callback - the number of affected rows. + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param field Indicates the column name in the database table. - * @param value Indicates the value to match with the RdbPredicates. - * @return Returns the RdbPredicates that match the specified field. + * @since 9 */ - contains(field: string, value: string): RdbPredicates; + delete(table: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback): void; /** - * Configures the RdbPredicates to match the field whose data type is string and value starts - * with a specified string. + * Deletes data from the database based on a specified instance object of RdbPredicatesV9. * - * @note This method is similar to value% of the SQL statement. - * @since 7 + * @param {string} table - Indicates the target table. + * @param {DataSharePredicates} predicates - the specified delete condition by the instance object of {@link dataSharePredicates.DataSharePredicates}. + * @param {AsyncCallback} callback - the number of affected rows. + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param field Indicates the column name in the database table. - * @param value Indicates the value to match with the RdbPredicates. - * @return Returns the RdbPredicates that match the specified field. + * @since 9 */ - beginsWith(field: string, value: string): RdbPredicates; + delete(table: string, predicates: dataSharePredicates.DataSharePredicates): Promise; /** - * Configures the RdbPredicates to match the field whose data type is string and value - * ends with a specified string. + * Queries data in the database based on specified conditions. * - * @note This method is similar to %value of the SQL statement. - * @since 7 + * @param {RdbPredicatesV9} predicates - the specified query condition by the instance object of {@link RdbPredicatesV9}. + * @param {Array} columns - the columns to query. If the value is empty array, the query applies to all columns. + * @param {AsyncCallback} callback - the {@link ResultSetV9} object if the operation is successful. + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param field Indicates the column name in the database table. - * @param value Indicates the value to match with the RdbPredicates. - * @return Returns the RdbPredicates that match the specified field. + * @since 9 */ - endsWith(field: string, value: string): RdbPredicates; + query(predicates: RdbPredicatesV9, columns: Array, callback: AsyncCallback): void; /** - * Configures the RdbPredicates to match the fields whose value is null. + * Queries data in the database based on specified conditions. * - * @note This method is similar to is null of the SQL statement. - * @since 7 + * @param {RdbPredicatesV9} predicates - the specified query condition by the instance object of {@link RdbPredicatesV9}. + * @param {Array} columns - the columns to query. If the value is null, the query applies to all columns. + * @returns {Promise} return the {@link ResultSetV9} object if the operation is successful. + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param field Indicates the column name in the database table. - * @return Returns the RdbPredicates that match the specified field. + * @since 9 */ - isNull(field: string): RdbPredicates; + query(predicates: RdbPredicatesV9, columns ?: Array): Promise; /** - * Configures the RdbPredicates to match the specified fields whose value is not null. + * Queries data in the database based on specified conditions. * - * @note This method is similar to is not null of the SQL statement. - * @since 7 + * @param {string} table - Indicates the target table. + * @param {dataSharePredicates.DataSharePredicates} predicates - the specified query condition by the instance object of {@link dataSharePredicates.DataSharePredicates}. + * @param {Array} columns - the columns to query. If the value is empty array, the query applies to all columns. + * @param {AsyncCallback} callback - the {@link ResultSetV9} object if the operation is successful. + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param field Indicates the column name in the database table. - * @return Returns the RdbPredicates that match the specified field. + * @since 9 */ - isNotNull(field: string): RdbPredicates; + query(table: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array, callback: AsyncCallback): void; /** - * Configures the RdbPredicates to match the fields whose data type is string and value is - * similar to a specified string. + * Queries data in the database based on specified conditions. * - * @note This method is similar to like of the SQL statement. - * @since 7 + * @param {string} table - Indicates the target table. + * @param {dataSharePredicates.DataSharePredicates} predicates - the specified query condition by the instance object of {@link dataSharePredicates.DataSharePredicates}. + * @param {Array} columns - the columns to query. If the value is null, the query applies to all columns. + * @returns {Promise} return the {@link ResultSetV9} object if the operation is successful. + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param field Indicates the column name in the database table. - * @param value Indicates the value to match with the RdbPredicates. The percent sign (%) in the value - * is a wildcard (like * in a regular expression). - * @return Returns the RdbPredicates that match the specified field. + * @since 9 */ - like(field: string, value: string): RdbPredicates; + query(table: string, predicates: dataSharePredicates.DataSharePredicates, columns ?: Array): Promise; /** - * Configures RdbPredicates to match the specified field whose data type is string and the value contains - * a wildcard. + * Queries remote data in the database based on specified conditions before Synchronizing Data. * - * @note Different from like, the input parameters of this method are case-sensitive. - * @since 7 + * @param {string} device - Indicates specified remote device. + * @param {string} table - Indicates the target table. + * @param {RdbPredicatesV9} predicates - the specified remote remote query condition by the instance object of {@link RdbPredicatesV9}. + * @param {Array} columns - the columns to remote query. If the value is empty array, the remote query applies to all columns. + * @param {AsyncCallback} callback - the {@link ResultSetV9} object if the operation is successful. + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param field Indicates the column name in the database table. - * @param value Indicates the value to match with RdbPredicates. - * @return Returns the SQL statement with the specified RdbPredicates. + * @since 9 */ - glob(field: string, value: string): RdbPredicates; + remoteQuery(device: string, table: string, predicates: RdbPredicatesV9, columns: Array, callback: AsyncCallback): void; /** - * Restricts the value of the field to the range between low value and high value. + * Queries remote data in the database based on specified conditions before Synchronizing Data. * - * @since 7 + * @param {string} device - Indicates specified remote device. + * @param {string} table - Indicates the target table. + * @param {RdbPredicatesV9} predicates - the specified remote remote query condition by the instance object of {@link RdbPredicatesV9}. + * @param {Array} columns - the columns to remote query. If the value is empty array, the remote query applies to all columns. + * @returns {Promise} return the {@link ResultSetV9} object if the operation is successful. + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param field Indicates the column name. - * @param low Indicates the minimum value. - * @param high Indicates the maximum value. - * @return Returns the SQL query statement with the specified RdbPredicates. + * @since 9 */ - between(field: string, low: ValueType, high: ValueType): RdbPredicates; + remoteQuery(device: string, table: string, predicates: RdbPredicatesV9, columns: Array): Promise; /** - * Configures RdbPredicates to match the specified field whose data type is int and value is - * out of a given range. + * Queries data in the database based on SQL statement. * - * @since 7 + * @param {string} sql - Indicates the SQL statement to execute. + * @param {Array} bindArgs - Indicates the {@link ValueType} values of the parameters in the SQL statement. The values are strings. + * @param {AsyncCallback} callback - the {@link ResultSetV9} object if the operation is successful. + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param field Indicates the column name in the database table. - * @param low Indicates the minimum value to match with DataAbilityPredicates. - * @param high Indicates the maximum value to match with DataAbilityPredicates. - * @return Returns the SQL query statement with the specified RdbPredicates. + * @since 9 */ - notBetween(field: string, low: ValueType, high: ValueType): RdbPredicates; + querySql(sql: string, bindArgs: Array, callback: AsyncCallback): void; /** - * Restricts the value of the field to be greater than the specified value. + * Deletes data from the database based on a specified instance object of RdbPredicatesV9. * - * @since 7 + * @param {string} sql - Indicates the SQL statement to execute. + * @param {Array} bindArgs - Indicates the {@link ValueType} values of the parameters in the SQL statement. The values are strings. + * @returns {Promise} return the {@link ResultSetV9} object if the operation is successful. + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param field Indicates the column name. - * @param value Indicates the String field. - * @return Returns the SQL query statement with the specified RdbPredicates. + * @since 9 */ - greaterThan(field: string, value: ValueType): RdbPredicates; + querySql(sql: string, bindArgs ?: Array): Promise; /** - * Restricts the value of the field to be smaller than the specified value. + * Executes an SQL statement that contains specified parameters but returns no value. * - * @since 7 + * @param {string} sql - Indicates the SQL statement to execute. + * @param {Array} bindArgs - Indicates the {@link ValueType} values of the parameters in the SQL statement. The values are strings. + * @param {AsyncCallback} callback - the callback of executeSql. + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param field Indicates the column name. - * @param value Indicates the String field. - * @return Returns the SQL query statement with the specified RdbPredicates. + * @since 9 */ - lessThan(field: string, value: ValueType): RdbPredicates; + executeSql(sql: string, bindArgs: Array, callback: AsyncCallback): void; /** - * Restricts the value of the field to be greater than or equal to the specified value. + * Executes an SQL statement that contains specified parameters but returns no value. * - * @since 7 + * @param {string} sql - Indicates the SQL statement to execute. + * @param {Array} bindArgs - Indicates the {@link ValueType} values of the parameters in the SQL statement. The values are strings. + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param field Indicates the column name. - * @param value Indicates the String field. - * @return Returns the SQL query statement with the specified RdbPredicates. + * @since 9 */ - greaterThanOrEqualTo(field: string, value: ValueType): RdbPredicates; + executeSql(sql: string, bindArgs ?: Array): Promise; /** - * Restricts the value of the field to be smaller than or equal to the specified value. + * BeginTransaction before execute your sql. * - * @since 7 + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param field Indicates the column name. - * @param value Indicates the String field. - * @return Returns the SQL query statement with the specified RdbPredicates. + * @since 9 */ - lessThanOrEqualTo(field: string, value: ValueType): RdbPredicates; + beginTransaction(): void; /** - * Restricts the ascending order of the return list. When there are several orders, - * the one close to the head has the highest priority. + * Commit the the sql you have executed. * - * @since 7 + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param field Indicates the column name for sorting the return list. - * @return Returns the SQL query statement with the specified RdbPredicates. + * @since 9 */ - orderByAsc(field: string): RdbPredicates; + commit(): void; /** - * Restricts the descending order of the return list. When there are several orders, - * the one close to the head has the highest priority. + * Roll back the sql you have already executed. * - * @since 7 + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param field Indicates the column name for sorting the return list. - * @return Returns the SQL query statement with the specified RdbPredicates. + * @since 9 */ - orderByDesc(field: string): RdbPredicates; + rollBack(): void; /** - * Restricts each row of the query result to be unique. + * Backs up a database in a specified name. * - * @since 7 + * @param {string} destName - Indicates the name that saves the database backup. + * @param {AsyncCallback} callback - the callback of backup. + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @return Returns the SQL query statement with the specified RdbPredicates. + * @since 9 */ - distinct(): RdbPredicates; + backup(destName: string, callback: AsyncCallback): void; /** - * Restricts the max number of return records. + * Backs up a database in a specified name. * - * @since 7 + * @param {string} destName - Indicates the name that saves the database backup. + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param value Indicates the max length of the return list. - * @return Returns the SQL query statement with the specified RdbPredicates. + * @since 9 */ - limitAs(value: number): RdbPredicates; + backup(destName: string): Promise; /** - * Configures RdbPredicates to specify the start position of the returned result. + * Restores a database from a specified database file. * - * @note Use this method together with limit(int). - * @since 7 + * @param {string} srcName - Indicates the name that saves the database file. + * @param {AsyncCallback} callback - the callback of restore. + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param rowOffset Indicates the start position of the returned result. The value is a positive integer. - * @return Returns the SQL query statement with the specified AbsPredicates. + * @since 9 */ - offsetAs(rowOffset: number): RdbPredicates; + restore(srcName: string, callback: AsyncCallback): void; /** - * Configures RdbPredicates to group query results by specified columns. + * Restores a database from a specified database file. * - * @since 7 + * @param {string} srcName - Indicates the name that saves the database file. + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param fields Indicates the specified columns by which query results are grouped. - * @return Returns the RdbPredicates with the specified columns by which query results are grouped. + * @since 9 */ - groupBy(fields: Array): RdbPredicates; + restore(srcName: string): Promise; /** - * Configures RdbPredicates to specify the index column. + * Set table to be distributed table. * - * @note Before using this method, you need to create an index column. - * @since 7 + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param {Array} tables - Indicates the tables name you want to set. + * @param {AsyncCallback} callback - the callback of setDistributedTables. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + setDistributedTables(tables: Array, callback: AsyncCallback): void; + + /** + * Set table to be distributed table. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param {Array} tables - Indicates the tables name you want to set. + * @returns {Promise} the promise returned by the function. + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param indexName Indicates the name of the index column. - * @return Returns RdbPredicates with the specified index column. + * @since 9 */ - indexedBy(field: string): RdbPredicates; + setDistributedTables(tables: Array): Promise; /** - * Configures RdbPredicates to match the specified field whose data type is ValueType array and values - * are within a given range. + * Obtain distributed table name of specified remote device according to local table name. + * When query remote device database, distributed table name is needed. * - * @since 7 + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param {string} device - Indicates the remote device. + * @param {AsyncCallback} callback - {string}: the distributed table name. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + obtainDistributedTableName(device: string, table: string, callback: AsyncCallback): void; + + /** + * Obtain distributed table name of specified remote device according to local table name. + * When query remote device database, distributed table name is needed. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param {string} device - Indicates the remote device. + * @returns {Promise} {string}: the distributed table name. + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param field Indicates the column name in the database table. - * @param values Indicates the values to match with RdbPredicates. - * @return Returns RdbPredicates that matches the specified field. + * @since 9 */ - in(field: string, value: Array): RdbPredicates; + obtainDistributedTableName(device: string, table: string): Promise; /** - * Configures RdbPredicates to match the specified field whose data type is ValueType array and values - * are out of a given range. + * Sync data between devices. * - * @since 7 + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param {string} device - Indicates the remote device. + * @param {AsyncCallback>} callback - {Array<[string, number]>}: devices sync status array, {string}: device id, {number}: device sync status. + * @throws {BusinessError} 401 - if the parameter type is incorrect. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param field Indicates the column name in the database table. - * @param values Indicates the values to match with RdbPredicates. - * @return Returns RdbPredicates that matches the specified field. + * @since 9 */ - notIn(field: string, value: Array): RdbPredicates; + sync(mode: SyncMode, predicates: RdbPredicatesV9, callback: AsyncCallback>): void; + + /** + * Sync data between devices. + * + * @permission ohos.permission.DISTRIBUTED_DATASYNC + * @param {string} device - Indicates the remote device. + * @returns {Promise>} {Array<[string, number]>}: devices sync status array, {string}: device id, {number}: device sync status. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + sync(mode: SyncMode, predicates: RdbPredicatesV9): Promise>; + + /** + * Registers an observer for the database. When data in the distributed database changes, + * the callback will be invoked. + * + * @param {string} event - Indicates the event must be string 'dataChange'. + * @param {SubscribeType} type - Indicates the subscription type, which is defined in {@link SubscribeType}. + * @param {AsyncCallback>} observer - {Array}: the observer of data change events in the distributed database. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + on(event: 'dataChange', type: SubscribeType, observer: Callback>): void; + + /** + * Remove specified observer of specified type from the database. + * + * @param {string} event - Indicates the event must be string 'dataChange'. + * @param {SubscribeType} type - Indicates the subscription type, which is defined in {@link SubscribeType}. + * @param {AsyncCallback>} observer - {Array}: the data change observer already registered. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + off(event: 'dataChange', type: SubscribeType, observer: Callback>): void; } - export type ResultSet = _ResultSet + /** + * Indicates possible value types + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + */ + type ValueType = number | string | boolean; + + /** + * Values in buckets are stored in key-value pairs + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + */ + type ValuesBucket = { [key:string]: ValueType | Uint8Array | null; +} + +/** + * Manages relational database configurations. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.StoreConfigV9 + */ +interface StoreConfig { + name: string; +} + +/** + * Manages relational database configurations. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ +interface StoreConfigV9 { + /** + * The database name. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + name: string; + + /** + * Specifies whether the database is encrypted. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + securityLevel: SecurityLevel; + + /** + * Specifies whether the database is encrypted. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + encrypt ?: boolean; +} + +/** + * Manages relational database configurations. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbPredicatesV9 + */ +class RdbPredicates { + /** + * A parameterized constructor used to create an RdbPredicates instance. + * + * @param {string} name - Indicates the table name of the database. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbPredicatesV9.constructor + */ + constructor(name: string) + + /** + * Sync data between devices. + * When query database, this function should not be called. + * + * @param {Array} devices - Indicates specified remote devices. + * @returns {RdbPredicatesV9} - the {@link RdbPredicatesV9} self. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbPredicatesV9.inDevices + */ + inDevices(devices: Array): RdbPredicates; + + /** + * Specify all remote devices which connect to local device when syncing distributed database. + * When query database, this function should not be called. + * + * @returns {RdbPredicates} - the {@link RdbPredicates} self. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbPredicatesV9.inAllDevices + */ + inAllDevices(): RdbPredicates; + + /** + * Configure the RdbPredicatesV9 to match the field whose data type is ValueType and value is equal + * to a specified value. + * This method is similar to = of the SQL statement. + * + * @param {string} field - Indicates the column name in the database table. + * @param {ValueType} value - Indicates the value to match with the {@link RdbPredicates}. + * @returns {RdbPredicates} - the {@link RdbPredicates} self. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbPredicatesV9.equalTo + */ + equalTo(field: string, value: ValueType): RdbPredicates; + + /** + * Configure the RdbPredicatesV9 to match the field whose data type is ValueType and value is not equal to + * a specified value. + * This method is similar to != of the SQL statement. + * + * @param {string} field - Indicates the column name in the database table. + * @param {ValueType} value - Indicates the value to match with the {@link RdbPredicates}. + * @returns {RdbPredicates} - the {@link RdbPredicates} self. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbPredicatesV9.notEqualTo + */ + notEqualTo(field: string, value: ValueType): RdbPredicates; + + /** + * Adds a left parenthesis to the RdbPredicates. + * This method is similar to ( of the SQL statement and needs to be used together with endWrap(). + * + * @returns {RdbPredicates} - the {@link RdbPredicates} with the left parenthesis. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbPredicatesV9.beginWrap + */ + beginWrap(): RdbPredicates; + + /** + * Adds a right parenthesis to the RdbPredicates. + * This method is similar to ) of the SQL statement and needs to be used together + * + * with beginWrap(). + * @returns {RdbPredicates} - the {@link RdbPredicates} with the right parenthesis. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbPredicatesV9.endWrap + */ + endWrap(): RdbPredicates; + + /** + * Adds an or condition to the RdbPredicates. + * This method is similar to or of the SQL statement. + * + * @returns Returns the {@link RdbPredicates} with the or condition. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbPredicatesV9.or + */ + or(): RdbPredicates; + + /** + * Adds an and condition to the RdbPredicates. + * This method is similar to or of the SQL statement. + * + * @returns Returns the {@link RdbPredicates} with the or condition. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbPredicatesV9.and + */ + and(): RdbPredicates; + + /** + * Configure the RdbPredicates to match the field whose data type is string and value + * contains a specified value. + * This method is similar to contains of the SQL statement. + * + * @param {string} field - Indicates the column name in the database table. + * @param {ValueType} value - Indicates the value to match with the {@link RdbPredicates}. + * @returns {RdbPredicates} - the {@link RdbPredicates} self. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbPredicatesV9.contains + */ + contains(field: string, value: string): RdbPredicates; + + /** + * Configure the RdbPredicates to match the field whose data type is string and value starts + * with a specified string. + * This method is similar to value% of the SQL statement. + * + * @param {string} field - Indicates the column name in the database table. + * @param {ValueType} value - Indicates the value to match with the {@link RdbPredicates}. + * @returns {RdbPredicates} - the {@link RdbPredicates} self. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbPredicatesV9.beginsWith + */ + beginsWith(field: string, value: string): RdbPredicates; + + /** + * Configure the RdbPredicates to match the field whose data type is string and value + * ends with a specified string. + * This method is similar to %value of the SQL statement. + * + * @param {string} field - Indicates the column name in the database table. + * @param {ValueType} value - Indicates the value to match with the {@link RdbPredicates}. + * @returns {RdbPredicates} - the {@link RdbPredicates} self. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbPredicatesV9.endsWith + */ + endsWith(field: string, value: string): RdbPredicates; + + /** + * Configure the RdbPredicates to match the fields whose value is null. + * This method is similar to is null of the SQL statement. + * + * @param {string} field - Indicates the column name in the database table. + * @returns {RdbPredicates} - the {@link RdbPredicates} self. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbPredicatesV9.isNull + */ + isNull(field: string): RdbPredicates; + + /** + * Configure the RdbPredicates to match the specified fields whose value is not null. + * This method is similar to is not null of the SQL statement. + * + * @param {string} field - Indicates the column name in the database table. + * @returns {RdbPredicates} - the {@link RdbPredicates} self. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbPredicatesV9.isNotNull + */ + isNotNull(field: string): RdbPredicates; + + /** + * Configure the RdbPredicates to match the fields whose data type is string and value is + * similar to a specified string. + * This method is similar to like of the SQL statement. + * + * @param {string} field - Indicates the column name in the database table. + * @param {ValueType} value - Indicates the value to match with the {@link RdbPredicates}. + * @returns {RdbPredicates} - the {@link RdbPredicates} that match the specified field. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbPredicatesV9.like + */ + like(field: string, value: string): RdbPredicates; + + /** + * Configure RdbPredicates to match the specified field whose data type is string and the value contains + * a wildcard. + * Different from like, the input parameters of this method are case-sensitive. + * + * @param {string} field - Indicates the column name in the database table. + * @param {ValueType} value - Indicates the value to match with the {@link RdbPredicates}. + * @returns {RdbPredicates} - the SQL statement with the specified {@link RdbPredicates}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbPredicatesV9.glob + */ + glob(field: string, value: string): RdbPredicates; + + /** + * Configure RdbPredicates to match the specified field whose data type is string and the value contains + * a wildcard. + * + * @param {string} field - Indicates the column name. + * @param {ValueType} low - Indicates the minimum value. + * @param {ValueType} high - Indicates the maximum value. + * @returns {RdbPredicates} - the SQL statement with the specified {@link RdbPredicates}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbPredicatesV9.between + */ + between(field: string, low: ValueType, high: ValueType): RdbPredicates; + + /** + * Configure RdbPredicates to match the specified field whose data type is int and value is + * out of a given range. + * + * @param {string} field - Indicates the column name in the database table. + * @param {ValueType} low - Indicates the minimum value. + * @param {ValueType} high - Indicates the maximum value to. + * @returns {RdbPredicates} - the SQL statement with the specified {@link RdbPredicates}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbPredicatesV9.notBetween + */ + notBetween(field: string, low: ValueType, high: ValueType): RdbPredicates; + + /** + * Restricts the value of the field to be greater than the specified value. + * + * @param {string} field - Indicates the column name in the database table. + * @param {ValueType} value - Indicates the value to match with the {@link RdbPredicates}. + * @returns {RdbPredicates} - the SQL query statement with the specified {@link RdbPredicates}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbPredicatesV9.greaterThan + */ + greaterThan(field: string, value: ValueType): RdbPredicates; + + /** + * Restricts the value of the field to be smaller than the specified value. + * + * @param {string} field - Indicates the column name in the database table. + * @param {ValueType} value - Indicates the value to match with the {@link RdbPredicates}. + * @returns {RdbPredicates} - the SQL query statement with the specified {@link RdbPredicates}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbPredicatesV9.lessThan + */ + lessThan(field: string, value: ValueType): RdbPredicates; + + /** + * Restricts the value of the field to be greater than or equal to the specified value. + * + * @param {string} field - Indicates the column name in the database table. + * @param {ValueType} value - Indicates the value to match with the {@link RdbPredicates}. + * @returns {RdbPredicates} - the SQL query statement with the specified {@link RdbPredicates}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbPredicatesV9.greaterThanOrEqualTo + */ + greaterThanOrEqualTo(field: string, value: ValueType): RdbPredicates; + + /** + * Restricts the value of the field to be smaller than or equal to the specified value. + * + * @param {string} field - Indicates the column name in the database table. + * @param {ValueType} value - Indicates the value to match with the {@link RdbPredicates}. + * @returns {RdbPredicates} - the SQL query statement with the specified {@link RdbPredicates}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbPredicatesV9.lessThanOrEqualTo + */ + lessThanOrEqualTo(field: string, value: ValueType): RdbPredicates; + + /** + * Restricts the ascending order of the return list. When there are several orders, + * the one close to the head has the highest priority. + * + * @param {string} field - Indicates the column name for sorting the return list. + * @returns {RdbPredicates} - the SQL query statement with the specified {@link RdbPredicates}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbPredicatesV9.orderByAsc + */ + orderByAsc(field: string): RdbPredicates; + + /** + * Restricts the descending order of the return list. When there are several orders, + * the one close to the head has the highest priority. + * + * @param {string} field - Indicates the column name for sorting the return list. + * @returns {RdbPredicates} - the SQL query statement with the specified {@link RdbPredicates}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbPredicatesV9.orderByDesc + */ + orderByDesc(field: string): RdbPredicates; + + /** + * Restricts each row of the query result to be unique. + * + * @returns {RdbPredicates} - the SQL query statement with the specified {@link RdbPredicates}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbPredicatesV9.distinct + */ + distinct(): RdbPredicates; + + /** + * Restricts the max number of return records. + * + * @param {number} value - Indicates the max length of the return list. + * @returns {RdbPredicates} - the SQL query statement with the specified {@link RdbPredicates}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbPredicatesV9.limitAs + */ + limitAs(value: number): RdbPredicates; + + /** + * Configure RdbPredicatesV9 to specify the start position of the returned result. + * Use this method together with limit(int). + * + * @param {number} rowOffset - Indicates the start position of the returned result. The value is a positive integer. + * @returns {RdbPredicatesV9} - the SQL query statement with the specified {@link RdbPredicatesV9}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbPredicatesV9.offsetAs + */ + offsetAs(rowOffset: number): RdbPredicates; + + /** + * Configure RdbPredicatesV9 to group query results by specified columns. + * + * @param {Array} fields - Indicates the specified columns by which query results are grouped. + * @returns {RdbPredicatesV9} - the SQL query statement with the specified {@link RdbPredicatesV9}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbPredicatesV9.groupBy + */ + groupBy(fields: Array): RdbPredicates; + + /** + * Configure RdbPredicatesV9 to specify the index column. + * Before using this method, you need to create an index column. + * + * @param {string} field - Indicates the name of the index column. + * @returns {RdbPredicatesV9} - the SQL statement with the specified {@link RdbPredicatesV9}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbPredicatesV9.indexedBy + */ + indexedBy(field: string): RdbPredicates; + + /** + * Configure RdbPredicatesV9 to match the specified field whose data type is ValueType array and values + * are within a given range. + * + * @param {string} field - Indicates the column name in the database table. + * @param {Array} value - Indicates the values to match with {@link RdbPredicatesV9}. + * @returns {RdbPredicatesV9} - the SQL statement with the specified {@link RdbPredicatesV9}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbPredicatesV9.in + */ + in(field: string, value: Array): RdbPredicates; + + /** + * Configure RdbPredicatesV9 to match the specified field whose data type is ValueType array and values + * are out of a given range. + * + * @param {string} field - Indicates the column name in the database table. + * @param {Array} value - Indicates the values to match with {@link RdbPredicatesV9}. + * @returns {RdbPredicatesV9} - the SQL statement with the specified {@link RdbPredicatesV9}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.RdbPredicatesV9.notIn + */ + notIn(field: string, value: Array): RdbPredicates; +} + +/** + * Manages relational database configurations. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ +class RdbPredicatesV9 { + /** + * A parameterized constructor used to create an RdbPredicates instance. + * + * @param {string} name - Indicates the table name of the database. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + constructor(name: string) + + /** + * Sync data between devices. + * When query database, this function should not be called. + * + * @param {Array} devices - Indicates specified remote devices. + * @returns {RdbPredicatesV9} - the {@link RdbPredicatesV9} self. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + inDevices(devices: Array): RdbPredicatesV9; + + /** + * Specify all remote devices which connect to local device when syncing distributed database. + * When query database, this function should not be called. + * + * @returns {RdbPredicatesV9} - the {@link RdbPredicatesV9} self. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + inAllDevices(): RdbPredicatesV9; + + /** + * Configure the RdbPredicatesV9 to match the field whose data type is ValueType and value is equal + * to a specified value. + * This method is similar to = of the SQL statement. + * + * @param {string} field - Indicates the column name in the database table. + * @param {ValueType} value - Indicates the value to match with the {@link RdbPredicatesV9}. + * @returns {RdbPredicatesV9} - the {@link RdbPredicatesV9} self. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + equalTo(field: string, value: ValueType): RdbPredicatesV9; + + /** + * Configure the RdbPredicatesV9 to match the field whose data type is ValueType and value is not equal to + * a specified value. + * This method is similar to != of the SQL statement. + * + * @param {string} field - Indicates the column name in the database table. + * @param {ValueType} value - Indicates the value to match with the {@link RdbPredicatesV9}. + * @returns {RdbPredicatesV9} - the {@link RdbPredicatesV9} self. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + notEqualTo(field: string, value: ValueType): RdbPredicatesV9; + + /** + * Adds a left parenthesis to the RdbPredicatesV9. + * This method is similar to ( of the SQL statement and needs to be used together with endWrap(). + * + * @returns {RdbPredicatesV9} - the {@link RdbPredicatesV9} with the left parenthesis. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + beginWrap(): RdbPredicatesV9; + + /** + * Adds a right parenthesis to the RdbPredicatesV9. + * This method is similar to ) of the SQL statement and needs to be used together + * + * with beginWrap(). + * @returns {RdbPredicatesV9} - the {@link RdbPredicatesV9} with the right parenthesis. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + endWrap(): RdbPredicatesV9; + + /** + * Adds an or condition to the RdbPredicatesV9. + * This method is similar to or of the SQL statement. + * + * @returns Returns the {@link RdbPredicatesV9} with the or condition. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + or(): RdbPredicatesV9; + + /** + * Adds an and condition to the RdbPredicatesV9. + * This method is similar to or of the SQL statement. + * + * @returns Returns the {@link RdbPredicatesV9} with the or condition. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + and(): RdbPredicatesV9; + + /** + * Configure the RdbPredicatesV9 to match the field whose data type is string and value + * contains a specified value. + * This method is similar to contains of the SQL statement. + * + * @param {string} field - Indicates the column name in the database table. + * @param {ValueType} value - Indicates the value to match with the {@link RdbPredicatesV9}. + * @returns {RdbPredicatesV9} - the {@link RdbPredicatesV9} self. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + contains(field: string, value: string): RdbPredicatesV9; + + /** + * Configure the RdbPredicatesV9 to match the field whose data type is string and value starts + * with a specified string. + * This method is similar to value% of the SQL statement. + * + * @param {string} field - Indicates the column name in the database table. + * @param {ValueType} value - Indicates the value to match with the {@link RdbPredicatesV9}. + * @returns {RdbPredicatesV9} - the {@link RdbPredicatesV9} self. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + beginsWith(field: string, value: string): RdbPredicatesV9; + + /** + * Configure the RdbPredicatesV9 to match the field whose data type is string and value + * ends with a specified string. + * This method is similar to %value of the SQL statement. + * + * @param {string} field - Indicates the column name in the database table. + * @param {ValueType} value - Indicates the value to match with the {@link RdbPredicatesV9}. + * @returns {RdbPredicatesV9} - the {@link RdbPredicatesV9} self. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + endsWith(field: string, value: string): RdbPredicatesV9; + + /** + * Configure the RdbPredicatesV9 to match the fields whose value is null. + * This method is similar to is null of the SQL statement. + * + * @param {string} field - Indicates the column name in the database table. + * @returns {RdbPredicatesV9} - the {@link RdbPredicatesV9} self. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + isNull(field: string): RdbPredicatesV9; + + /** + * Configure the RdbPredicatesV9 to match the specified fields whose value is not null. + * This method is similar to is not null of the SQL statement. + * + * @param {string} field - Indicates the column name in the database table. + * @returns {RdbPredicatesV9} - the {@link RdbPredicatesV9} self. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + isNotNull(field: string): RdbPredicatesV9; + + /** + * Configure the RdbPredicatesV9 to match the fields whose data type is string and value is + * similar to a specified string. + * This method is similar to like of the SQL statement. + * + * @param {string} field - Indicates the column name in the database table. + * @param {ValueType} value - Indicates the value to match with the {@link RdbPredicatesV9}. + * @returns {RdbPredicatesV9} - the {@link RdbPredicatesV9} that match the specified field. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + like(field: string, value: string): RdbPredicatesV9; + + /** + * Configure RdbPredicatesV9 to match the specified field whose data type is string and the value contains + * a wildcard. + * Different from like, the input parameters of this method are case-sensitive. + * + * @param {string} field - Indicates the column name in the database table. + * @param {ValueType} value - Indicates the value to match with the {@link RdbPredicatesV9}. + * @returns {RdbPredicatesV9} - the SQL statement with the specified {@link RdbPredicatesV9}. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + glob(field: string, value: string): RdbPredicatesV9; + + /** + * Configure RdbPredicatesV9 to match the specified field whose data type is string and the value contains + * a wildcard. + * + * @param {string} field - Indicates the column name. + * @param {ValueType} low - Indicates the minimum value. + * @param {ValueType} high - Indicates the maximum value. + * @returns {RdbPredicatesV9} - the SQL statement with the specified {@link RdbPredicatesV9}. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + between(field: string, low: ValueType, high: ValueType): RdbPredicatesV9; + + /** + * Configure RdbPredicatesV9 to match the specified field whose data type is int and value is + * out of a given range. + * + * @param {string} field - Indicates the column name in the database table. + * @param {ValueType} low - Indicates the minimum value. + * @param {ValueType} high - Indicates the maximum value to. + * @returns {RdbPredicatesV9} - the SQL statement with the specified {@link RdbPredicatesV9}. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + notBetween(field: string, low: ValueType, high: ValueType): RdbPredicatesV9; + + /** + * Restricts the value of the field to be greater than the specified value. + * + * @param {string} field - Indicates the column name in the database table. + * @param {ValueType} value - Indicates the value to match with the {@link RdbPredicatesV9}. + * @returns {RdbPredicatesV9} - the SQL query statement with the specified {@link RdbPredicatesV9}. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + greaterThan(field: string, value: ValueType): RdbPredicatesV9; + + /** + * Restricts the value of the field to be smaller than the specified value. + * + * @param {string} field - Indicates the column name in the database table. + * @param {ValueType} value - Indicates the value to match with the {@link RdbPredicatesV9}. + * @returns {RdbPredicatesV9} - the SQL query statement with the specified {@link RdbPredicatesV9}. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + lessThan(field: string, value: ValueType): RdbPredicatesV9; + + /** + * Restricts the value of the field to be greater than or equal to the specified value. + * + * @param {string} field - Indicates the column name in the database table. + * @param {ValueType} value - Indicates the value to match with the {@link RdbPredicatesV9}. + * @returns {RdbPredicatesV9} - the SQL query statement with the specified {@link RdbPredicatesV9}. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + greaterThanOrEqualTo(field: string, value: ValueType): RdbPredicatesV9; + + /** + * Restricts the value of the field to be smaller than or equal to the specified value. + * + * @param {string} field - Indicates the column name in the database table. + * @param {ValueType} value - Indicates the value to match with the {@link RdbPredicatesV9}. + * @returns {RdbPredicatesV9} - the SQL query statement with the specified {@link RdbPredicatesV9}. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + lessThanOrEqualTo(field: string, value: ValueType): RdbPredicatesV9; + + /** + * Restricts the ascending order of the return list. When there are several orders, + * the one close to the head has the highest priority. + * + * @param {string} field - Indicates the column name for sorting the return list. + * @returns {RdbPredicatesV9} - the SQL query statement with the specified {@link RdbPredicatesV9}. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + orderByAsc(field: string): RdbPredicatesV9; + + /** + * Restricts the descending order of the return list. When there are several orders, + * the one close to the head has the highest priority. + * + * @param {string} field - Indicates the column name for sorting the return list. + * @returns {RdbPredicatesV9} - the SQL query statement with the specified {@link RdbPredicatesV9}. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + orderByDesc(field: string): RdbPredicatesV9; + + /** + * Restricts each row of the query result to be unique. + * + * @returns {RdbPredicatesV9} - the SQL query statement with the specified {@link RdbPredicatesV9}. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + distinct(): RdbPredicatesV9; + + /** + * Restricts the max number of return records. + * + * @param {number} value - Indicates the max length of the return list. + * @returns {RdbPredicatesV9} - the SQL query statement with the specified {@link RdbPredicatesV9}. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + limitAs(value: number): RdbPredicatesV9; + + /** + * Configure RdbPredicatesV9 to specify the start position of the returned result. + * Use this method together with limit(int). + * + * @param {number} rowOffset - Indicates the start position of the returned result. The value is a positive integer. + * @returns {RdbPredicatesV9} - the SQL query statement with the specified {@link RdbPredicatesV9}. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + offsetAs(rowOffset: number): RdbPredicatesV9; + + /** + * Configure RdbPredicatesV9 to group query results by specified columns. + * + * @param {Array} fields - Indicates the specified columns by which query results are grouped. + * @returns {RdbPredicatesV9} - the SQL query statement with the specified {@link RdbPredicatesV9}. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + groupBy(fields: Array): RdbPredicatesV9; + + /** + * Configure RdbPredicatesV9 to specify the index column. + * Before using this method, you need to create an index column. + * + * @param {string} field - Indicates the name of the index column. + * @returns {RdbPredicatesV9} - the SQL statement with the specified {@link RdbPredicatesV9}. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + indexedBy(field: string): RdbPredicatesV9; + + /** + * Configure RdbPredicatesV9 to match the specified field whose data type is ValueType array and values + * are within a given range. + * + * @param {string} field - Indicates the column name in the database table. + * @param {Array} value - Indicates the values to match with {@link RdbPredicatesV9}. + * @returns {RdbPredicatesV9} - the SQL statement with the specified {@link RdbPredicatesV9}. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + in(field: string, value: Array): RdbPredicatesV9; + + /** + * Configure RdbPredicatesV9 to match the specified field whose data type is ValueType array and values + * are out of a given range. + * + * @param {string} field - Indicates the column name in the database table. + * @param {Array} value - Indicates the values to match with {@link RdbPredicatesV9}. + * @returns {RdbPredicatesV9} - the SQL statement with the specified {@link RdbPredicatesV9}. + * @throws {BusinessError} 401 - if the parameter type is incorrect. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + notIn(field: string, value: Array): RdbPredicatesV9; +} + +export type ResultSet = _ResultSet; +export type ResultSetV9 = _ResultSetV9; } export default rdb; diff --git a/api/@ohos.data.storage.d.ts b/api/@ohos.data.storage.d.ts index 86b8edd9defaaa5bafe788320cce9cdb08c4ec24..d0bfc2b9d52622a0ea26b8d943a1b65d09fb40c6 100644 --- a/api/@ohos.data.storage.d.ts +++ b/api/@ohos.data.storage.d.ts @@ -20,7 +20,8 @@ import { AsyncCallback, Callback } from './basic'; * * @name storage * @since 6 - * @deprecated since 9, please use @ohos.data.preferences instead. + * @deprecated since 9 + * @useinstead ohos.preferences.preferences * @syscap SystemCapability.DistributedDataManager.Preferences.Core * */ @@ -32,10 +33,11 @@ declare namespace storage { * resides in the memory. You can use removeStorageFromCache to remove the instance from the memory. * * @param path Indicates the path of storage file stored. - * @return Returns the {@link Storage} instance matching the specified storage file name. + * @returns Returns the {@link Storage} instance matching the specified storage file name. * @throws BusinessError if invoked failed * @since 6 - * @deprecated since 9, please use @ohos.data.preferences instead. + * @deprecated since 9 + * @useinstead ohos.preferences.preferences.getPreferences */ function getStorageSync(path: string): Storage; @@ -48,13 +50,14 @@ declare namespace storage { * storage file. * *

          When deleting the {@link Storage} instance, you must release all references - * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency + * of the instance. In addition, do not use the instance to perform data operations. Otherwise, inconsistent data * will occur. * * @param path Indicates the path of storage file * @throws BusinessError if invoked failed * @since 6 - * @deprecated since 9, please use @ohos.data.preferences instead. + * @deprecated since 9 + * @useinstead ohos.preferences.preferences.deletePreferences */ function deleteStorageSync(path: string): void; function deleteStorage(path: string, callback: AsyncCallback): void; @@ -65,13 +68,14 @@ declare namespace storage { * from the cache. * *

          When deleting the {@link Storage} instance, you must release all references - * of the instance. In addition, do not use the instance to perform data operations. Otherwise, data inconsistency + * of the instance. In addition, do not use the instance to perform data operations. Otherwise, inconsistent data * will occur. * * @param path Indicates the path of storage file. * @throws BusinessError if invoked failed * @since 6 - * @deprecated since 9, please use @ohos.data.preferences instead. + * @deprecated since 9 + * @useinstead ohos.preferences.preferences.removePreferencesFromCache */ function removeStorageFromCacheSync(path: string): void; function removeStorageFromCache(path: string, callback: AsyncCallback): void; @@ -82,13 +86,14 @@ declare namespace storage { * *

          The storage data is stored in a file, which matches only one {@link Storage} instance in the memory. * You can use getStorage to obtain the {@link Storage} instance matching - * the file that stores storage data, and use emoveStorageFromCache + * the file that stores storage data, and use removeStorageFromCache * to remove the {@link Storage} instance from the memory. * * @syscap SystemCapability.DistributedDataManager.Preferences.Core * * @since 6 - * @deprecated since 9, please use @ohos.data.preferences instead. + * @deprecated since 9 + * @useinstead ohos.preferences.preferences */ interface Storage { /** @@ -98,10 +103,11 @@ declare namespace storage { * * @param key Indicates the key of the storage. It cannot be {@code null} or empty. * @param defValue Indicates the default value to return. - * @return Returns the value matching the specified key if it is found; returns the default value otherwise. + * @returns Returns the value matching the specified key if it is found; returns the default value otherwise. * @throws BusinessError if invoked failed * @since 6 - * @deprecated since 9, please use @ohos.data.preferences instead. + * @deprecated since 9 + * @useinstead ohos.preferences.preferences.get */ getSync(key: string, defValue: ValueType): ValueType; get(key: string, defValue: ValueType, callback: AsyncCallback): void; @@ -111,11 +117,12 @@ declare namespace storage { * Checks whether the {@link Storage} object contains a storage matching a specified key. * * @param key Indicates the key of the storage to check for. - * @return Returns {@code true} if the {@link Storage} object contains a storage with the specified key; + * @returns Returns {@code true} if the {@link Storage} object contains a storage with the specified key; * returns {@code false} otherwise. * @throws BusinessError if invoked failed * @since 6 - * @deprecated since 9, please use @ohos.data.preferences instead. + * @deprecated since 9 + * @useinstead ohos.preferences.preferences.has */ hasSync(key: string): boolean; has(key: string, callback: AsyncCallback): boolean; @@ -132,7 +139,8 @@ declare namespace storage { * MAX_KEY_LENGTH. * @throws BusinessError if invoked failed * @since 6 - * @deprecated since 9, please use @ohos.data.preferences instead. + * @deprecated since 9 + * @useinstead ohos.preferences.preferences.put */ putSync(key: string, value: ValueType): void; put(key: string, value: ValueType, callback: AsyncCallback): void; @@ -148,7 +156,8 @@ declare namespace storage { * MAX_KEY_LENGTH. * @throws BusinessError if invoked failed * @since 6 - * @deprecated since 9, please use @ohos.data.preferences instead. + * @deprecated since 9 + * @useinstead ohos.preferences.preferences.delete */ deleteSync(key: string): void; delete(key: string, callback: AsyncCallback): void; @@ -162,7 +171,8 @@ declare namespace storage { * * @throws BusinessError if invoked failed * @since 6 - * @deprecated since 9, please use @ohos.data.preferences instead. + * @deprecated since 9 + * @useinstead ohos.preferences.preferences.clear */ clearSync(): void; clear(callback: AsyncCallback): void; @@ -173,7 +183,8 @@ declare namespace storage { * * @throws BusinessError if invoked failed * @since 6 - * @deprecated since 9, please use @ohos.data.preferences instead. + * @deprecated since 9 + * @useinstead ohos.preferences.preferences.flush */ flushSync(): void; flush(callback: AsyncCallback): void; @@ -185,17 +196,19 @@ declare namespace storage { * @param callback Indicates the callback when storage changes. * @throws BusinessError if invoked failed * @since 6 - * @deprecated since 9, please use @ohos.data.preferences instead. + * @deprecated since 9 + * @useinstead ohos.preferences.preferences.on */ on(type: 'change', callback: Callback): void; /** - * Unregisters an existing observer. + * Unregister an existing observer. * * @param callback Indicates the registered callback. * @throws BusinessError if invoked failed * @since 6 - * @deprecated since 9, please use @ohos.data.preferences instead. + * @deprecated since 9 + * @useinstead ohos.preferences.preferences.off */ off(type: 'change', callback: Callback): void; } @@ -211,7 +224,7 @@ declare namespace storage { * @syscap SystemCapability.DistributedDataManager.Preferences.Core * * @since 6 - * @deprecated since 9, please use @ohos.data.preferences instead. + * @deprecated since 9 */ interface StorageObserver { /** diff --git a/api/@ohos.deviceInfo.d.ts b/api/@ohos.deviceInfo.d.ts index 6c1f0bea3249026502df6f6a3eee34055c4463dc..55067063a7f0170ebbb2ae7bb69a9308e8afd820 100644 --- a/api/@ohos.deviceInfo.d.ts +++ b/api/@ohos.deviceInfo.d.ts @@ -87,6 +87,7 @@ declare namespace deviceInfo { /** * Obtains the device serial number represented by a string. + * @permission ohos.permission.sec.ACCESS_UDID * @syscap SystemCapability.Startup.SystemInfo * @since 6 */ @@ -234,6 +235,7 @@ declare namespace deviceInfo { const buildRootHash: string; /** * Obtains the device udid. + * @permission ohos.permission.sec.ACCESS_UDID * @syscap SystemCapability.Startup.SystemInfo * @since 7 */ diff --git a/api/@ohos.distributedBundle.d.ts b/api/@ohos.distributedBundle.d.ts index beaf21575af453570f75e4e5c38aab81f6ac4897..5e19007e92dea7dd8179cd72acf748fc723db4b0 100644 --- a/api/@ohos.distributedBundle.d.ts +++ b/api/@ohos.distributedBundle.d.ts @@ -15,15 +15,16 @@ import { AsyncCallback } from './basic'; import { ElementName } from './bundle/elementName'; -import { RemoteAbilityInfo as _RemoteAbilityInfo } from './bundle/remoteAbilityInfo'; +import { RemoteAbilityInfo } from './bundle/remoteAbilityInfo'; /** * distributedBundle. * @name distributedBundle * @since 8 * @syscap SystemCapability.BundleManager.DistributedBundleFramework - * @permission NA * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead ohos.bundle.distributeBundle */ declare namespace distributedBundle { /** @@ -32,9 +33,11 @@ import { RemoteAbilityInfo as _RemoteAbilityInfo } from './bundle/remoteAbilityI * @since 8 * @syscap SystemCapability.BundleManager.DistributedBundleFramework * @param elementName Indicates the elementName. - * @return Returns the ability info of the remote device. + * @returns Returns the ability info of the remote device. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED * @systemapi + * @deprecated since 9 + * @useinstead ohos.bundle.distributeBundle#getRemoteAbilityInfo */ function getRemoteAbilityInfo(elementName: ElementName, callback: AsyncCallback): void; function getRemoteAbilityInfo(elementName: ElementName): Promise; @@ -45,48 +48,13 @@ import { RemoteAbilityInfo as _RemoteAbilityInfo } from './bundle/remoteAbilityI * @since 8 * @syscap SystemCapability.BundleManager.DistributedBundleFramework * @param elementNames Indicates the elementNames, Maximum array length ten. - * @return Returns the ability infos of the remote device. + * @returns Returns the ability infos of the remote device. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED * @systemapi + * @deprecated since 9 + * @useinstead ohos.bundle.distributeBundle#getRemoteAbilityInfo */ function getRemoteAbilityInfos(elementNames: Array, callback: AsyncCallback>): void; function getRemoteAbilityInfos(elementNames: Array): Promise>; - - /** - * Obtains information about the ability info of the remote device. - * - * @since 9 - * @syscap SystemCapability.BundleManager.DistributedBundleFramework - * @param elementName Indicates the elementName. - * @param locale Indicates the locale info - * @return Returns the ability info of the remote device. - * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED - * @systemapi - */ - function getRemoteAbilityInfo(elementName: ElementName, locale: string, callback: AsyncCallback): void; - function getRemoteAbilityInfo(elementName: ElementName, locale: string): Promise; - - /** - * Obtains information about the ability infos of the remote device. - * - * @since 9 - * @syscap SystemCapability.BundleManager.DistributedBundleFramework - * @param elementNames Indicates the elementNames, Maximum array length ten. - * @param locale Indicates the locale info - * @return Returns the ability infos of the remote device. - * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED - * @systemapi - */ - function getRemoteAbilityInfos(elementNames: Array, locale: string, callback: AsyncCallback>): void; - function getRemoteAbilityInfos(elementNames: Array, locale: string): Promise>; - - /** - * Contains basic remote ability information. - * - * @since 9 - * @syscap SystemCapability.BundleManager.DistributedBundleFramework - * @systemapi hide this for inner system use - */ - export type RemoteAbilityInfo = _RemoteAbilityInfo; } export default distributedBundle; \ No newline at end of file diff --git a/api/@ohos.distributedHardware.deviceManager.d.ts b/api/@ohos.distributedHardware.deviceManager.d.ts index f9073f101a47eec65066f63f7fe7a4f2edae7565..02aacbe0c6b558c3d202c9eef7f0188721688623 100644 --- a/api/@ohos.distributedHardware.deviceManager.d.ts +++ b/api/@ohos.distributedHardware.deviceManager.d.ts @@ -53,7 +53,7 @@ declare namespace deviceManager { /** * @since 9 - * The distance of dicovered device, in centimeters(cm). + * The distance of discovered device, in centimeter(cm). */ range: number; } @@ -192,7 +192,7 @@ declare namespace deviceManager { freq: ExchangeFreq; /** - * Whether the device should be ranged by discoverers. + * Whether the device should be ranged by discoverer. */ ranging : boolean; } @@ -356,7 +356,6 @@ declare namespace deviceManager { /** * Obtains a list of trusted devices. * - * @throws {BusinessError} 401 - Input parameter error. * @throws {BusinessError} 11600101 - Failed to execute the function. * @return Returns a list of trusted devices. * @systemapi this method can be used only by system applications. @@ -378,7 +377,6 @@ declare namespace deviceManager { * Obtains a list of trusted devices. * * @since 8 - * @throws {BusinessError} 401 - Input parameter error. * @return Returns a list of trusted devices. * @systemapi this method can be used only by system applications. */ @@ -388,7 +386,6 @@ declare namespace deviceManager { * Obtains local device info * * @since 8 - * @throws {BusinessError} 401 - Input parameter error. * @throws {BusinessError} 11600101 - Failed to execute the function. * @return Returns local device info. * @systemapi this method can be used only by system applications. @@ -410,7 +407,6 @@ declare namespace deviceManager { * Obtains local device info * * @since 8 - * @throws {BusinessError} 401 - Input parameter error. * @return Returns local device info. * @systemapi this method can be used only by system applications. */ diff --git a/api/@ohos.effectKit.d.ts b/api/@ohos.effectKit.d.ts index 78ffb0c148c94351fdceebeff7ce3583c8e7371d..b25669d0ad574a6886d49aec721080b6ca91e91c 100644 --- a/api/@ohos.effectKit.d.ts +++ b/api/@ohos.effectKit.d.ts @@ -19,7 +19,6 @@ import image from './@ohos.multimedia.image'; /** * @name effectKit * @since 9 - * @import effectKit from '@ohos.effectKit'; */ declare namespace effectKit { @@ -35,7 +34,7 @@ declare namespace effectKit { * @since 9 * @syscap SystemCapability.Multimedia.Image.Core * @param radius The degree of blur, the value is measured in pixels. - * @return Filters for the current effect have been added. + * @returns Filters for the current effect have been added. */ blur(radius:number): Filter; @@ -44,7 +43,7 @@ declare namespace effectKit { * @since 9 * @syscap SystemCapability.Multimedia.Image.Core * @param bright The degree of light and darkness,the value range is 0 to 1. - * @return Filters for the current effect have been added. + * @returns Filters for the current effect have been added. */ brightness(bright:number): Filter; @@ -52,7 +51,7 @@ declare namespace effectKit { * A Grayscale effect is added to the image. * @since 9 * @syscap SystemCapability.Multimedia.Image.Core - * @return Filters for the current effect have been added. + * @returns Filters for the current effect have been added. */ grayscale(): Filter; @@ -60,7 +59,7 @@ declare namespace effectKit { * Gets the PixelMap where all filter effects have been added to the image. * @since 9 * @syscap SystemCapability.Multimedia.Image.Core - * @return image.PixelMap. + * @returns image.PixelMap. */ getPixelMap(): image.PixelMap; } @@ -128,7 +127,7 @@ declare namespace effectKit { * @since 9 * @syscap SystemCapability.Multimedia.Image.Core * @param image.PixelMap. - * @return Returns the head node of FilterChain. + * @returns Returns the head node of FilterChain. */ function createEffect(source: image.PixelMap): Filter; @@ -137,7 +136,7 @@ declare namespace effectKit { * @since 9 * @syscap SystemCapability.Multimedia.Image.Core * @param image.PixelMap. - * @return Returns the ColorPicker. + * @returns Returns the ColorPicker. */ function createColorPicker(source: image.PixelMap): Promise; @@ -146,9 +145,9 @@ declare namespace effectKit { * @since 9 * @syscap SystemCapability.Multimedia.Image.Core * @param image.PixelMap. - * @return Returns the ColorPicker. + * @returns Returns the ColorPicker. */ function createColorPicker(source: image.PixelMap, callback: AsyncCallback): void; } -export default effectKit; \ No newline at end of file +export default effectKit; diff --git a/api/@ohos.EnterpriseAdminExtensionAbility.d.ts b/api/@ohos.enterprise.EnterpriseAdminExtensionAbility.d.ts similarity index 97% rename from api/@ohos.EnterpriseAdminExtensionAbility.d.ts rename to api/@ohos.enterprise.EnterpriseAdminExtensionAbility.d.ts index e968d3ff4b63904ae23b6766240923e55e17cfbb..6cd8d1a83faf1d7d5c206eeee78a4c899824c785 100644 --- a/api/@ohos.EnterpriseAdminExtensionAbility.d.ts +++ b/api/@ohos.enterprise.EnterpriseAdminExtensionAbility.d.ts @@ -18,6 +18,7 @@ * * @since 9 * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @systemapi * @StageModelOnly */ export default class EnterpriseAdminExtensionAbility { @@ -26,15 +27,17 @@ export default class EnterpriseAdminExtensionAbility { * * @since 9 * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @systemapi * @StageModelOnly */ onAdminEnabled(): void; - + /** * Called back when an application is disabled. * * @since 9 * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @systemapi * @StageModelOnly */ onAdminDisabled(): void; diff --git a/api/@ohos.enterpriseDeviceManager.d.ts b/api/@ohos.enterprise.adminManager.d.ts similarity index 91% rename from api/@ohos.enterpriseDeviceManager.d.ts rename to api/@ohos.enterprise.adminManager.d.ts index 612d2d7d12553a5f05b7779531abb5517c812356..8458d5afcb5ad586924b51c3e9f7f57959153529 100644 --- a/api/@ohos.enterpriseDeviceManager.d.ts +++ b/api/@ohos.enterprise.adminManager.d.ts @@ -14,44 +14,70 @@ */ import { AsyncCallback, Callback } from "./basic"; -import { DeviceSettingsManager as _DeviceSettingsManager } from "./enterpriseDeviceManager/DeviceSettingsManager"; -import Want from "./@ohos.application.Want"; +import Want from "./@ohos.app.ability.Want"; /** - * enterprise device manager. - * @name enterpriseDeviceManager - * @since 9 + * This module provides the capability to manage the administrator of the enterprise devices. + * @namespace adminManager * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @systemapi + * @since 9 */ -declare namespace enterpriseDeviceManager { +declare namespace adminManager { /** - * @name EnterpriseInfo - * @since 9 + * Provides the enterprise information. + * @typedef EnterpriseInfo * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @systemapi + * @since 9 */ export interface EnterpriseInfo { + /** + * The name of enterprise. + * @type {string} + * @since 9 + */ name: string; + + /** + * The description of enterprise. + * @type {string} + * @since 9 + */ description: string; } /** - * @name DeviceSettingsManager - * @since 9 + * Enum for type of administrator. + * @enum {number} * @syscap SystemCapability.Customization.EnterpriseDeviceManager - */ - export type DeviceSettingsManager = _DeviceSettingsManager - - /** - * @name AdminType + * @systemapi * @since 9 - * @syscap SystemCapability.Customization.EnterpriseDeviceManager */ export enum AdminType { + /** + * The value of normal administrator. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @since 9 + */ ADMIN_TYPE_NORMAL = 0x00, + + /** + * The value of super administrator. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @since 9 + */ ADMIN_TYPE_SUPER = 0x01 } + /** + * Enum for managed event + * @enum {number} + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @systemapi + * @since 9 + */ export enum ManagedEvent { /** @@ -78,13 +104,13 @@ declare namespace enterpriseDeviceManager { * @param { AdminType } type - type indicates the type of administrator to set. * @param { AsyncCallback } callback - the callback of enableAdmin. * @throws { BusinessError } 9200003 - the administrator ability component is invalid. - * @throws { BusinessError } 9200004 - failed to enable the adminstrator application of the device. + * @throws { BusinessError } 9200004 - failed to enable the administrator application of the device. * @throws { BusinessError } 9200007 - the system ability work abnormally. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 401 - invalid input parameter. * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @systemapi - * @stagemodelonly + * @StageModelOnly * @since 9 */ function enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, callback: AsyncCallback): void; @@ -99,13 +125,13 @@ declare namespace enterpriseDeviceManager { * @param { number } userId - userId indicates the user ID. * @param { AsyncCallback } callback - the callback of enableAdmin. * @throws { BusinessError } 9200003 - the administrator ability component is invalid. - * @throws { BusinessError } 9200004 - failed to enable the adminstrator application of the device. + * @throws { BusinessError } 9200004 - failed to enable the administrator application of the device. * @throws { BusinessError } 9200007 - the system ability work abnormally. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 401 - invalid input parameter. * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @systemapi - * @stagemodelonly + * @StageModelOnly * @since 9 */ function enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId: number, callback: AsyncCallback): void; @@ -120,13 +146,13 @@ declare namespace enterpriseDeviceManager { * @param { number } [userId] - userId indicates the user ID or do not pass user ID. * @returns { Promise } the promise returned by the enableAdmin. * @throws { BusinessError } 9200003 - the administrator ability component is invalid. - * @throws { BusinessError } 9200004 - failed to enable the adminstrator application of the device. + * @throws { BusinessError } 9200004 - failed to enable the administrator application of the device. * @throws { BusinessError } 9200007 - the system ability work abnormally. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 401 - invalid input parameter. * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @systemapi - * @stagemodelonly + * @StageModelOnly * @since 9 */ function enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId?: number): Promise; @@ -142,7 +168,7 @@ declare namespace enterpriseDeviceManager { * @throws { BusinessError } 401 - invalid input parameter. * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @systemapi - * @stagemodelonly + * @StageModelOnly * @since 9 */ function disableAdmin(admin: Want, callback: AsyncCallback): void; @@ -159,7 +185,7 @@ declare namespace enterpriseDeviceManager { * @throws { BusinessError } 401 - invalid input parameter. * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @systemapi - * @stagemodelonly + * @StageModelOnly * @since 9 */ function disableAdmin(admin: Want, userId: number, callback: AsyncCallback): void; @@ -176,7 +202,7 @@ declare namespace enterpriseDeviceManager { * @throws { BusinessError } 401 - invalid input parameter. * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @systemapi - * @stagemodelonly + * @StageModelOnly * @since 9 */ function disableAdmin(admin: Want, userId?: number): Promise; @@ -192,7 +218,7 @@ declare namespace enterpriseDeviceManager { * @throws { BusinessError } 401 - invalid input parameter. * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @systemapi - * @stagemodelonly + * @StageModelOnly * @since 9 */ function disableSuperAdmin(bundleName: String, callback: AsyncCallback): void; @@ -208,7 +234,7 @@ declare namespace enterpriseDeviceManager { * @throws { BusinessError } 401 - invalid input parameter. * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @systemapi - * @stagemodelonly + * @StageModelOnly * @since 9 */ function disableSuperAdmin(bundleName: String): Promise; @@ -220,7 +246,7 @@ declare namespace enterpriseDeviceManager { * @throws { BusinessError } 401 - invalid input parameter. * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @systemapi - * @stagemodelonly + * @StageModelOnly * @since 9 */ function isAdminEnabled(admin: Want, callback: AsyncCallback): void; @@ -233,7 +259,7 @@ declare namespace enterpriseDeviceManager { * @throws { BusinessError } 401 - invalid input parameter. * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @systemapi - * @stagemodelonly + * @StageModelOnly * @since 9 */ function isAdminEnabled(admin: Want, userId: number, callback: AsyncCallback): void; @@ -246,7 +272,7 @@ declare namespace enterpriseDeviceManager { * @throws { BusinessError } 401 - invalid input parameter. * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @systemapi - * @stagemodelonly + * @StageModelOnly * @since 9 */ function isAdminEnabled(admin: Want, userId?: number): Promise; @@ -255,11 +281,11 @@ declare namespace enterpriseDeviceManager { * Get information of the administrator's enterprise. * @param { Want } admin - admin indicates the administrator ability information. * @param { AsyncCallback } callback - callback contained the enterprise info of administrator. - * @throws { BusinessError } 9200001 - the applicayion is not an administrator of the device. + * @throws { BusinessError } 9200001 - the application is not an administrator of the device. * @throws { BusinessError } 401 - invalid input parameter. * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @systemapi - * @stagemodelonly + * @StageModelOnly * @since 9 */ function getEnterpriseInfo(admin: Want, callback: AsyncCallback): void; @@ -268,11 +294,11 @@ declare namespace enterpriseDeviceManager { * Get information of the administrator's enterprise. * @param { Want } admin - admin indicates the administrator ability information. * @returns { Promise } promise contained the enterprise info of administrator. - * @throws { BusinessError } 9200001 - the applicayion is not an administrator of the device. + * @throws { BusinessError } 9200001 - the application is not an administrator of the device. * @throws { BusinessError } 401 - invalid input parameter. * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @systemapi - * @stagemodelonly + * @StageModelOnly * @since 9 */ function getEnterpriseInfo(admin: Want): Promise; @@ -280,15 +306,16 @@ declare namespace enterpriseDeviceManager { /** * Set the information of the administrator's enterprise. * Only the administrator app can call this method. + * @permission ohos.permission.SET_ENTERPRISE_INFO * @param { Want } admin - admin indicates the administrator ability information. * @param { EnterpriseInfo } enterpriseInfo - enterpriseInfo indicates the enterprise information of the calling application. * @param { AsyncCallback } callback - the callback of setEnterpriseInfo. - * @throws { BusinessError } 9200001 - the applicayion is not an administrator of the device. + * @throws { BusinessError } 9200001 - the application is not an administrator of the device. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 401 - invalid input parameter. * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @systemapi - * @stagemodelonly + * @StageModelOnly * @since 9 */ function setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo, callback: AsyncCallback): void; @@ -300,12 +327,12 @@ declare namespace enterpriseDeviceManager { * @param { Want } admin - admin indicates the administrator ability information. * @param { EnterpriseInfo } enterpriseInfo - enterpriseInfo indicates the enterprise information of the calling application. * @returns { Promise } the promise returned by the setEnterpriseInfo. - * @throws { BusinessError } 9200001 - the applicayion is not an administrator of the device. + * @throws { BusinessError } 9200001 - the application is not an administrator of the device. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 401 - invalid input parameter. * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @systemapi - * @stagemodelonly + * @StageModelOnly * @since 9 */ function setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo): Promise; @@ -317,7 +344,7 @@ declare namespace enterpriseDeviceManager { * @throws { BusinessError } 401 - invalid input parameter. * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @systemapi - * @stagemodelonly + * @StageModelOnly * @since 9 */ function isSuperAdmin(bundleName: String, callback: AsyncCallback): void; @@ -329,21 +356,11 @@ declare namespace enterpriseDeviceManager { * @throws { BusinessError } 401 - invalid input parameter. * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @systemapi - * @stagemodelonly + * @StageModelOnly * @since 9 */ function isSuperAdmin(bundleName: String): Promise; - /** - * Obtains the interface used to set device settings policy. - * - * @since 9 - * @syscap SystemCapability.Customization.EnterpriseDeviceManager - * @return Returns the DeviceSettingsManager interface. - */ - function getDeviceSettingsManager(callback: AsyncCallback): void; - function getDeviceSettingsManager(): Promise; - /** * Subscribes the managed event of admin. * @permission ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT @@ -356,7 +373,7 @@ declare namespace enterpriseDeviceManager { * @throws { BusinessError } 401 - invalid input parameter. * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @systemapi - * @stagemodelonly + * @StageModelOnly * @since 9 */ function subscribeManagedEvent(admin: Want, managedEvents: Array, callback: AsyncCallback): void; @@ -373,7 +390,7 @@ declare namespace enterpriseDeviceManager { * @throws { BusinessError } 401 - invalid input parameter. * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @systemapi - * @stagemodelonly + * @StageModelOnly * @since 9 */ function subscribeManagedEvent(admin: Want, managedEvents: Array): Promise; @@ -390,7 +407,7 @@ declare namespace enterpriseDeviceManager { * @throws { BusinessError } 401 - invalid input parameter. * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @systemapi - * @stagemodelonly + * @StageModelOnly * @since 9 */ function unsubscribeManagedEvent(admin: Want, managedEvents: Array, callback: AsyncCallback): void; @@ -407,10 +424,10 @@ declare namespace enterpriseDeviceManager { * @throws { BusinessError } 401 - invalid input parameter. * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @systemapi - * @stagemodelonly + * @StageModelOnly * @since 9 */ function unsubscribeManagedEvent(admin: Want, managedEvents: Array): Promise; } -export default enterpriseDeviceManager; \ No newline at end of file +export default adminManager; \ No newline at end of file diff --git a/api/enterpriseDeviceManager/DeviceSettingsManager.d.ts b/api/@ohos.enterprise.dateTimeManager.d.ts similarity index 45% rename from api/enterpriseDeviceManager/DeviceSettingsManager.d.ts rename to api/@ohos.enterprise.dateTimeManager.d.ts index 4187a3f5f1334bca55d1c787babbb12b58b9c654..2a7da62ded2d22dc2618620d1cda0b2cf5a5a281 100644 --- a/api/enterpriseDeviceManager/DeviceSettingsManager.d.ts +++ b/api/@ohos.enterprise.dateTimeManager.d.ts @@ -13,32 +13,53 @@ * limitations under the License. */ -import { AsyncCallback, Callback } from "./../basic"; -import Want from "./../@ohos.application.Want"; +import { AsyncCallback } from "./basic"; +import Want from "./@ohos.app.ability.Want"; /** - * @name Offers set settings policies on the devices. - * @since 9 + * This module provides the capability to manage the datetime of the enterprise devices. + * @namespace dateTimeManager. * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @systemapi + * @since 9 */ -export interface DeviceSettingsManager { +declare namespace dateTimeManager { + + /** + * Sets the system time. + * This function can be called by a super administrator. + * @permission ohos.permission.ENTERPRISE_SET_DATETIME + * @param { Want } admin - admin indicates the administrator ability information. + * @param { number } time - time indicates the target time stamp (ms). + * @param { AsyncCallback } callback - the callback of setDateTime. + * @throws { BusinessError } 9200001 - the application is not an administrator of the device. + * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - the application does not have permission to call this function. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @systemapi + * @StageModelOnly + * @since 9 + */ + function setDateTime(admin: Want, time: number, callback: AsyncCallback): void; /** * Sets the system time. * This function can be called by a super administrator. - * @permission ohos.permission.EDM_MANAGE_DATETIME + * @permission ohos.permission.ENTERPRISE_SET_DATETIME * @param { Want } admin - admin indicates the administrator ability information. - * @param { number } time - time indicates rhe target time stamp (ms). + * @param { number } time - time indicates the target time stamp (ms). * @returns { Promise } the promise returned by the setDateTime. - * @throws { BusinessError } 9200001 - the applicayion is not an administrator of the device. - * @throws { BusinessError } 9200002 - the administrator applicayion does not have permission to manage the device. + * @throws { BusinessError } 9200001 - the application is not an administrator of the device. + * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. * @throws { BusinessError } 201 - the application does not have permission to call this function. * @throws { BusinessError } 401 - invalid input parameter. * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @systemapi - * @stagemodelonly + * @StageModelOnly * @since 9 */ - setDateTime(admin: Want, time: number, callback: AsyncCallback): void; - setDateTime(admin: Want, time: number): Promise; -} \ No newline at end of file + function setDateTime(admin: Want, time: number): Promise; +} + +export default dateTimeManager; \ No newline at end of file diff --git a/api/@ohos.enterprise.deviceInfo.d.ts b/api/@ohos.enterprise.deviceInfo.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..281b6ef04246add76d9f9fee68fae33440699710 --- /dev/null +++ b/api/@ohos.enterprise.deviceInfo.d.ts @@ -0,0 +1,131 @@ +/* + * 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 Want from "./@ohos.app.ability.Want"; + +/** + * This module provides the capability to manage the device info of the enterprise devices. + * @namespace deviceInfo. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @systemapi + * @since 10 + */ +declare namespace deviceInfo { + + /** + * Gets the device serial. + * This function can be called by a super administrator. + * @permission ohos.permission.ENTERPRISE_GET_DEVICE_INFO + * @param { Want } admin - admin indicates the administrator ability information. + * @param { AsyncCallback } callback - the callback of getDeviceSerial. + * @throws { BusinessError } 9200001 - the application is not an administrator of the device. + * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - the application does not have permission to call this function. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @systemapi + * @StageModelOnly + * @since 10 + */ + function getDeviceSerial(admin: Want, callback: AsyncCallback): void; + + /** + * Gets the device serial. + * This function can be called by a super administrator. + * @permission ohos.permission.ENTERPRISE_GET_DEVICE_INFO + * @param { Want } admin - admin indicates the administrator ability information. + * @returns { Promise } the promise returned by the getDeviceSerial. + * @throws { BusinessError } 9200001 - the application is not an administrator of the device. + * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - the application does not have permission to call this function. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @systemapi + * @StageModelOnly + * @since 10 + */ + function getDeviceSerial(admin: Want): Promise; + + /** + * Gets the display version. + * This function can be called by a super administrator. + * @permission ohos.permission.ENTERPRISE_GET_DEVICE_INFO + * @param { Want } admin - admin indicates the administrator ability information. + * @param { AsyncCallback } callback - the callback of getDisplayVersion. + * @throws { BusinessError } 9200001 - the application is not an administrator of the device. + * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - the application does not have permission to call this function. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @systemapi + * @StageModelOnly + * @since 10 + */ + function getDisplayVersion(admin: Want, callback: AsyncCallback): void; + + /** + * Gets the display version. + * This function can be called by a super administrator. + * @permission ohos.permission.ENTERPRISE_GET_DEVICE_INFO + * @param { Want } admin - admin indicates the administrator ability information. + * @returns { Promise } the promise returned by the getDisplayVersion. + * @throws { BusinessError } 9200001 - the application is not an administrator of the device. + * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - the application does not have permission to call this function. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @systemapi + * @StageModelOnly + * @since 10 + */ + function getDisplayVersion(admin: Want): Promise; + + /** + * Gets the device name. + * This function can be called by a super administrator. + * @permission ohos.permission.ENTERPRISE_GET_DEVICE_INFO + * @param { Want } admin - admin indicates the administrator ability information. + * @param { AsyncCallback } callback - the callback of getDeviceName. + * @throws { BusinessError } 9200001 - the application is not an administrator of the device. + * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - the application does not have permission to call this function. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @systemapi + * @StageModelOnly + * @since 10 + */ + function getDeviceName(admin: Want, callback: AsyncCallback): void; + + /** + * Gets the device name. + * This function can be called by a super administrator. + * @permission ohos.permission.ENTERPRISE_GET_DEVICE_INFO + * @param { Want } admin - admin indicates the administrator ability information. + * @returns { Promise } the promise returned by the getDeviceName. + * @throws { BusinessError } 9200001 - the application is not an administrator of the device. + * @throws { BusinessError } 9200002 - the administrator application does not have permission to manage the device. + * @throws { BusinessError } 201 - the application does not have permission to call this function. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @systemapi + * @StageModelOnly + * @since 10 + */ + function getDeviceName(admin: Want): Promise; +} + +export default deviceInfo; \ No newline at end of file diff --git a/api/@ohos.events.emitter.d.ts b/api/@ohos.events.emitter.d.ts index fbc91b20f597d4533cb8669a4433ef478ed9079a..ee1ae48a41e61f8a62c55f198cc77dc02aac1806 100644 --- a/api/@ohos.events.emitter.d.ts +++ b/api/@ohos.events.emitter.d.ts @@ -25,7 +25,7 @@ import { Callback } from './basic'; */ declare namespace emitter { /** - * Subscribes to a certain event in persistent manner and receives the event callback. + * Subscribe to a certain event in persistent manner and receives the event callback. * * @since 7 * @param event indicate event to subscribe to. @@ -35,7 +35,7 @@ declare namespace emitter { function on(event: InnerEvent, callback: Callback): void; /** - * Subscribes to a certain event in one-shot manner and unsubscribes from it + * Subscribe to a certain event in one-shot manner and unsubscribe from it * after the event callback is received. * * @since 7 @@ -46,7 +46,7 @@ declare namespace emitter { function once(event: InnerEvent, callback: Callback): void; /** - * Unsubscribes from an event. + * Unsubscribe from an event. * * @since 7 * @param eventId indicate ID of the event to unsubscribe from. diff --git a/api/@ohos.faultLogger.d.ts b/api/@ohos.faultLogger.d.ts index 45a78fecd3ab6b070430f9b89e513496107682e5..6012002f0f2e98c54f229e86cfa4528315a0d3a7 100644 --- a/api/@ohos.faultLogger.d.ts +++ b/api/@ohos.faultLogger.d.ts @@ -1,5 +1,5 @@ /* -* Copyright (C) 2021 Huawei Device Co., Ltd. +* Copyright (C) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -15,125 +15,159 @@ import { AsyncCallback } from "./basic"; - /** * This module provides the capability to query faultlog data. - * - * @since 8 + * @namespace FaultLogger * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger - * @import import sensor from '@ohos.faultlogger' + * @since 8 */ - declare namespace FaultLogger { /** * The type of fault type. - * @since 8 + * @enum { number } * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger + * @since 8 */ enum FaultType { /** * NO_SPECIFIC log type not distinguished. - * @since 8 * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger + * @since 8 */ NO_SPECIFIC = 0, /** - * CPP_CRASH CPP crash log type - * @since 8 + * CPP_CRASH CPP crash log type. * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger + * @since 8 */ CPP_CRASH = 2, /** - * JS_CRASH JS crash log type - * @since 8 + * JS_CRASH JS crash log type. * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger + * @since 8 */ JS_CRASH = 3, /** - * APP_FREEZE app feeeze log type - * @since 8 + * APP_FREEZE app freeze log type. * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger + * @since 8 */ APP_FREEZE = 4, } /** - * Query the result of the current application FaultLog in callback Mode - * @since 8 + * Query the result of the current application FaultLog in callback Mode. + * @param faultType Fault type to query + * @param callback Faultlog information data callback function * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger - * @param faultType fault type to query - * @param callback faultlog information data callback function + * @since 8 + * @deprecated since 9 + * @useinstead ohos.faultlogger/FaultLogger#query */ function querySelfFaultLog(faultType: FaultType, callback: AsyncCallback>) : void; /** * Query the result of the current application FaultLog in return promise mode. - * @since 8 + * @param faultType Fault type to query + * @returns return faultlog information data by promise * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger - * @param faultType fault type to query - * @return return faultlog information data by promise + * @since 8 + * @deprecated since 9 + * @useinstead ohos.faultlogger/FaultLogger#query */ function querySelfFaultLog(faultType: FaultType) : Promise>; /** - * FaultLog information data structure - * @since 8 + * Query the result of the current application FaultLog in callback Mode. + * @param faultType Fault type to query + * @param callback Faultlog information data callback function + * @throws { BusinessError } 401 - the parameter check failed + * @throws { BusinessError } 801 - the specified SystemCapability name was not found + * @throws { BusinessError } 10600001 - the service is not running or broken * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger + * @since 9 + */ + function query(faultType: FaultType, callback: AsyncCallback>) : void; + + /** + * Query the result of the current application FaultLog in return promise mode. + * @param faultType Fault type to query + * @returns return faultlog information data by promise + * @throws { BusinessError } 401 - the parameter check failed + * @throws { BusinessError } 801 - the specified SystemCapability name was not found + * @throws { BusinessError } 10600001 - the service is not running or broken + * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger + * @since 9 + */ + function query(faultType: FaultType) : Promise>; + + /** + * FaultLog information data structure. + * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger + * @since 8 */ interface FaultLogInfo { /** - * pid Process id - * @since 8 + * Process id. + * @type { number } * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger + * @since 8 */ pid: number; /** - * uid user id - * @since 8 + * User id. + * @type { number } * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger + * @since 8 */ uid: number; /** - * type fault type - * @since 8 + * Fault type. + * @type { FaultType } * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger + * @since 8 */ type: FaultType; /** - * second level timestamp - * @since 8 + * Second level timestamp. + * @type { number } * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger + * @since 8 */ timestamp: number; /** - * reason fault reason - * @since 8 + * Fault reason. + * @type { string } * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger + * @since 8 */ reason: string; /** - * module fault module - * @since 8 + * Fault module. + * @type { string } * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger + * @since 8 */ module: string; /** - * summary fault summary - * @since 8 + * Fault summary. + * @type { string } * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger + * @since 8 */ summary: string; /** - * fullLog fault log - * @since 8 + * Fault log. + * @type { string } * @syscap SystemCapability.HiviewDFX.Hiview.FaultLogger + * @since 8 */ fullLog: string; } diff --git a/api/@ohos.file.fs.d.ts b/api/@ohos.file.fs.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..17d95750ebfff4cb768c9b086f801d08c16b2f02 --- /dev/null +++ b/api/@ohos.file.fs.d.ts @@ -0,0 +1,496 @@ +/* + * 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' + +export default fileIo; + +/** + * fileio + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + * @import import fileio from '@ohos.file.js'; + */ +declare namespace fileIo { + export { open }; + export { openSync }; + export { read }; + export { readSync }; + export { stat }; + export { statSync }; + export { truncate }; + export { truncateSync }; + export { write }; + export { writeSync }; + export { File }; + export { OpenMode }; + export { Stat }; + + /** + * Mode Indicates the open flags. + * @since 9 + * @syscap SystemCapability.FileManagement.File.FileIO + */ + namespace OpenMode { + const READ_ONLY = 0o0; // Read only Permission + const WRITE_ONLY = 0o1; // Write only Permission + const READ_WRITE = 0o2; // Write and Read Permission + const CREATE = 0o100; // If not exist, create file + const TRUNC = 0o1000; // File truncate len 0 + const APPEND = 0o2000; // File append write + const NONBLOCK = 0o4000; // File open in nonblocking mode + const DIR = 0o200000; // File is Dir + const NOFOLLOW = 0o400000; // File is not symbolic link + const SYNC = 0o4010000; // SYNC IO + } +} + +/** + * Open file. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + * @function open + * @param {string} path - path. + * @param {number} [mode = OpenMode.READ_ONLY] - mode. + * @param {AsyncCallback} [callback] - callback. + * @returns {void | Promise} no callback return Promise otherwise return void + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + */ +declare function open(path: string, mode?: number): Promise; +declare function open(path: string, callback: AsyncCallback): void; +declare function open(path: string, mode: number, callback: AsyncCallback): void; +/** + * Open file with sync interface. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + * @function openSync + * @param {string} path - path. + * @param {number} [mode = OpenMode.READ_ONLY] - mode. + * @returns {File} open fd + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900006 - No such device or address + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900014 - Device or resource busy + * @throws { BusinessError } 13900015 - File exists + * @throws { BusinessError } 13900017 - No such device + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900022 - Too many open files + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900029 - Resource deadlock would occur + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + */ +declare function openSync(path: string, mode?: number): File; + +/** + * Read file. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + * @function read + * @param {number} fd - file descriptor. + * @param {ArrayBuffer} buffer - file descriptor. + * @param {Object} [options] - options. + * @param {number} [options.offset = 0] - offset. + * @param {number} [options.length = 0] - length. + * @param {AsyncCallback} [callback] - callback. + * @returns {void | Promise} no callback return Promise otherwise return void + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + */ +declare function read(fd: number, buffer: ArrayBuffer, options?: { + offset?: number; + length?: number; +}): Promise +declare function read(fd: number, buffer: ArrayBuffer, callback: AsyncCallback): void; +declare function read(fd: number, buffer: ArrayBuffer, options: { + offset?: number; + length?: number; +}, callback: AsyncCallback): void; +/** + * Read file with sync interface. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + * @function readSync + * @param {number} fd - file descriptor. + * @param {ArrayBuffer} buffer - file descriptor. + * @param {Object} [options] - options. + * @param {number} [options.offset = 0] - offset. + * @param {number} [options.length = 0] - length. + * @returns {number} number of bytesRead + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900042 - Unknown error + */ +declare function readSync(fd: number, buffer: ArrayBuffer, options?: { + offset?: number; + length?: number; +}): number; + +/** + * Get file information. + * @static + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + * @param {string | number} file - path or file descriptor. + * @param {AsyncCallback} [callback] - callback. + * @returns {void | Promise} no callback return Promise otherwise return void + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + */ +declare function stat(file: string | number): Promise; +declare function stat(file: string | number, callback: AsyncCallback): void; +/** + * Get file information with sync interface. + * @static + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + * @param {string | number} file - path or file descriptor. + * @returns {Stat} stat success + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900011 - Out of memory + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900031 - Function not implemented + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900038 - Value too large for defined data type + * @throws { BusinessError } 13900042 - Unknown error + */ +declare function statSync(file: string | number): Stat; + + /** + * Truncate file. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + * @function truncate + * @param {string | number} file - path or file descriptor. + * @param {number} [len = 0] - len. + * @param {AsyncCallback} [callback] - callback. + * @returns {void | Promise} no callback return Promise otherwise return void + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + */ +declare function truncate(file: string | number, len?: number): Promise; +declare function truncate(file: string | number, callback: AsyncCallback): void; +declare function truncate(file: string | number, len: number, callback: AsyncCallback): void; +/** + * Truncate file with sync interface. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + * @function truncateSync + * @param {string | number} file - path or file descriptor. + * @param {number} [len = 0] - len. + * @returns {void} truncate success + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900002 - No such file or directory + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900012 - Permission denied + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900018 - Not a directory + * @throws { BusinessError } 13900019 - Is a directory + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900023 - Text file busy + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900027 - Read-only file system + * @throws { BusinessError } 13900030 - File name too long + * @throws { BusinessError } 13900033 - Too many symbolic links encountered + * @throws { BusinessError } 13900042 - Unknown error + */ +declare function truncateSync(file: string | number, len?: number): void; + +/** + * Write file. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + * @function write + * @param {number} fd - file descriptor. + * @param {ArrayBuffer | string} buffer - file descriptor. + * @param {Object} [options] - options. + * @param {number} [options.offset = 0] - offset. + * @param {number} [options.length = 0] - length. + * @param {string} [options.encoding = 'utf-8'] - encoding. + * @param {AsyncCallback} [callback] - callback. + * @returns {void | Promise} no callback return Promise otherwise return void + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + */ +declare function write(fd: number, buffer: ArrayBuffer | string, options?: { + offset?: number; + length?: number; + encoding?: string; +}): Promise; +declare function write(fd: number, buffer: ArrayBuffer | string, callback: AsyncCallback): void; +declare function write(fd: number, buffer: ArrayBuffer | string, options: { + offset?: number; + length?: number; + encoding?: string; +}, callback: AsyncCallback): void; +/** + * Write file with sync interface. + * + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + * @function writeSync + * @param {number} fd - file descriptor. + * @param {ArrayBuffer | string} buffer - file descriptor. + * @param {Object} [options] - options. + * @param {number} [options.offset = 0] - offset. + * @param {number} [options.length = 0] - length. + * @param {string} [options.encoding = 'utf-8'] - encoding. + * @returns {number} on success number of bytesRead + * @throws { BusinessError } 13900001 - Operation not permitted + * @throws { BusinessError } 13900004 - Interrupted system call + * @throws { BusinessError } 13900005 - I/O error + * @throws { BusinessError } 13900008 - Bad file descriptor + * @throws { BusinessError } 13900010 - Try again + * @throws { BusinessError } 13900013 - Bad address + * @throws { BusinessError } 13900020 - Invalid argument + * @throws { BusinessError } 13900024 - File too large + * @throws { BusinessError } 13900025 - No space left on device + * @throws { BusinessError } 13900034 - Operation would block + * @throws { BusinessError } 13900041 - Quota exceeded + * @throws { BusinessError } 13900042 - Unknown error + */ +declare function writeSync(fd: number, buffer: ArrayBuffer | string, options?: { + offset?: number; + length?: number; + encoding?: string; +}): number; + +/** + * File object. + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +declare interface File { + /** + * @type {number} + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + * @readonly + */ + readonly fd: number; +} +/** + * Stat object. + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + */ +declare interface Stat { + /** + * @type {number} + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + * @readonly + */ + readonly ino: number; + /** + * @type {number} + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + * @readonly + */ + readonly mode: number; + /** + * @type {number} + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + * @readonly + */ + readonly uid: number; + /** + * @type {number} + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + * @readonly + */ + readonly gid: number; + /** + * @type {number} + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + * @readonly + */ + readonly size: number; + /** + * @type {number} + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + * @readonly + */ + readonly atime: number; + /** + * @type {number} + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + * @readonly + */ + readonly mtime: number; + /** + * @type {number} + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + * @readonly + */ + readonly ctime: number; + /** + * whether path/fd is block device. + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + * @returns {boolean} is or not + */ + isBlockDevice(): boolean; + /** + * whether path/fd is character device. + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + * @returns {boolean} is or not + */ + isCharacterDevice(): boolean; + /** + * whether path/fd is directory. + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + * @returns {boolean} is or not + */ + isDirectory(): boolean; + /** + * whether path/fd is fifo. + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + * @returns {boolean} is or not + */ + isFIFO(): boolean; + /** + * whether path/fd is file. + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + * @returns {boolean} is or not + */ + isFile(): boolean; + /** + * whether path/fd is socket. + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + * @returns {boolean} is or not + */ + isSocket(): boolean; + /** + * whether path/fd is symbolic link. + * @syscap SystemCapability.FileManagement.File.FileIO + * @since 9 + * @returns {boolean} is or not + */ + isSymbolicLink(): boolean; +} diff --git a/api/@ohos.fileManager.d.ts b/api/@ohos.fileManager.d.ts deleted file mode 100644 index 0c273772f674823458919d276af45fd739128b2f..0000000000000000000000000000000000000000 --- a/api/@ohos.fileManager.d.ts +++ /dev/null @@ -1,149 +0,0 @@ - /* - * 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' - -export default filemanager; - -/** - * @syscap SystemCapability.FileManagement.UserFileService - * @systemapi - */ -declare namespace filemanager { - export { listFile }; - export { getRoot }; - export { createFile }; - export { FileInfo }; - export { DevInfo }; -} - -/** - * listFile. - * - * @note N/A - * @syscap SystemCapability.FileManagement.UserFileService - * @since 9 - * @permission N/A - * @function listFile - * @param {string} path - path. - * @param {string} type - type. - * @param {Object} options - options - * @param {DevInfo} [options.dev = {name: "local"}] - dev name. - * @param {number} [options.offset = 0] - offset. - * @param {number} [options.count = 0] - count. - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return void - * @throws {TypedError} Parameter check failed - * @systemapi - */ -declare function listFile(path: string, type: string, options?: {dev?: DevInfo, offset?: number, count?: number}): Promise; -declare function listFile(path: string, type: string, callback: AsyncCallback): void; -declare function listFile(path: string, type: string, options: {dev?: DevInfo, offset?: number, count?: number}, callback: AsyncCallback): void; - -/** - * getRoot. - * - * @note N/A - * @syscap SystemCapability.FileManagement.UserFileService - * @since 9 - * @permission N/A - * @function getRoot - * @param {Object} options - options - * @param {DevInfo} [options.dev = {name: "local"}] - dev name. - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return void - * @throws {TypedError} Parameter check failed - * @systemapi - */ -declare function getRoot(options?: {dev?: DevInfo}): Promise; -declare function getRoot(callback: AsyncCallback): void; -declare function getRoot(options: {dev?: DevInfo}, callback: AsyncCallback): void; - -/** - * createFile. - * - * @note N/A - * @syscap SystemCapability.FileManagement.UserFileService - * @since 9 - * @permission N/A - * @function createFile - * @param {string} path - album uri. - * @param {string} filename- file name. - * @param {Object} options - options - * @param {DevInfo} [options.dev = {name: "local"}] - dev name. - * @param {AsyncCallback} [callback] - callback. - * @returns {void | Promise} no callback return Promise otherwise return void - * @throws {TypedError} Parameter check failed - * @systemapi - */ -declare function createFile(path: string, filename: string, options?: {dev?: DevInfo}): Promise; -declare function createFile(path: string, filename: string, callback: AsyncCallback): void; -declare function createFile(path: string, filename: string, options: {dev?: DevInfo}, callback: AsyncCallback): void; - -/** - * FileInfo - * @note N/A - * @syscap SystemCapability.FileManagement.UserFileService - * @since 9 - * @permission N/A - * @systemapi - */ -declare interface FileInfo { - /** - * @type {string} - * @readonly - */ - name: string; - /** - * @type {string} - * @readonly - */ - path: string; - /** - * @type {string} - * @readonly - */ - type: string; - /** - * @type {string} - * @readonly - */ - size: number; - /** - * @type {string} - * @readonly - */ - addedTime: number; - /** - * @type {string} - * @readonly - */ - modifiedTime: number; -} - -/** - * DevInfo - * @note N/A - * @syscap SystemCapability.FileManagement.UserFileService - * @since 9 - * @permission N/A - * @systemapi - */ - declare interface DevInfo { - /** - * @type {string} - */ - name: string; - } diff --git a/api/@ohos.fileio.d.ts b/api/@ohos.fileio.d.ts index 40ce3da3425c0705464b0d39feeaeacac509c57d..5317eb79676630a2451718c685fe7bc550f18f7f 100644 --- a/api/@ohos.fileio.d.ts +++ b/api/@ohos.fileio.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 @@ -84,7 +84,6 @@ declare namespace fileIO { export { writeSync }; export { Dir }; export { Dirent }; - export { ReadOut }; export { Stat }; export { Stream }; @@ -281,7 +280,8 @@ declare function chmodSync(path: string, mode: number): void; * @note N/A * @syscap SystemCapability.FileManagement.File.FileIO * @since 7 - * @permission N/A + * @deprecated since 9 + * @useinstead ohos.file.fs.truncate * @function ftruncate * @param {number} fd - fd. * @param {number} [len = 0] - len. @@ -298,7 +298,8 @@ declare function ftruncate(fd: number, len: number, callback: AsyncCallback): void; * @note N/A * @syscap SystemCapability.FileManagement.File.FileIO * @since 7 - * @permission N/A + * @deprecated since 9 + * @useinstead ohos.file.fs.statSync * @function fstatSync * @param {number} fd - fd. * @returns {Stat} @@ -620,7 +623,8 @@ declare function mkdtempSync(prefix: string): string; * @note N/A * @syscap SystemCapability.FileManagement.File.FileIO * @since 7 - * @permission N/A + * @deprecated since 9 + * @useinstead ohos.file.fs.open * @function open * @param {string} path - path. * @param {number} [flags = 0] - flags. @@ -639,7 +643,8 @@ declare function open(path: string, flags: number, mode: number, callback: Async * @note N/A * @syscap SystemCapability.FileManagement.File.FileIO * @since 6 - * @permission N/A + * @deprecated since 9 + * @useinstead ohos.file.fs.openSync * @function openSync * @param {string} path - path. * @param {number} [flags = 0] - flags. @@ -727,7 +732,8 @@ declare function readTextSync(filePath: string, options?: { * @note N/A * @syscap SystemCapability.FileManagement.File.FileIO * @since 6 - * @permission N/A + * @deprecated since 9 + * @useinstead ohos.file.fs.read * @function read * @param {number} fd - file descriptor. * @param {ArrayBuffer} buffer - file descriptor. @@ -756,7 +762,8 @@ declare function read(fd: number, buffer: ArrayBuffer, options: { * @note N/A * @syscap SystemCapability.FileManagement.File.FileIO * @since 6 - * @permission N/A + * @deprecated since 9 + * @useinstead ohos.file.fs.readSync * @function readSync * @param {number} fd - file descriptor. * @param {ArrayBuffer} buffer - file descriptor. @@ -836,7 +843,8 @@ declare function rmdirSync(path: string): void; * @note N/A * @syscap SystemCapability.FileManagement.File.FileIO * @since 6 - * @permission N/A + * @deprecated since 9 + * @useinstead ohos.file.fs.stat * @param {string} path - path. * @param {AsyncCallback} [callback] - callback. * @returns {void | Promise} no callback return Promise otherwise return void @@ -850,7 +858,8 @@ declare function stat(path: string, callback: AsyncCallback): void; * @note N/A * @syscap SystemCapability.FileManagement.File.FileIO * @since 6 - * @permission N/A + * @deprecated since 9 + * @useinstead ohos.file.fs.statSync * @param {string} path - path. * @returns {Stat} stat success * @throws {TypedError | Error} stat fail @@ -892,7 +901,8 @@ declare function symlink(target: string, srcPath: string, callback: AsyncCallbac * @note N/A * @syscap SystemCapability.FileManagement.File.FileIO * @since 7 - * @permission N/A + * @deprecated since 9 + * @useinstead ohos.file.fs.truncate * @function truncate * @param {string} path - path. * @param {number} [len = 0] - len. @@ -909,7 +919,8 @@ declare function truncate(path: string, len: number, callback: AsyncCallback; + displayName?: Array; /** * @type {Array} * @syscap SystemCapability.FileManagement.File.FileIO @@ -1180,7 +1193,7 @@ export type Filter = { * @since 9 * @readonly */ - mimeType: Array; + mimeType?: Array; /** * @type {number} * @syscap SystemCapability.FileManagement.File.FileIO @@ -1188,7 +1201,7 @@ export type Filter = { * @since 9 * @readonly */ - fileSizeOver: number; + fileSizeOver?: number; /** * @type {number} * @syscap SystemCapability.FileManagement.File.FileIO @@ -1196,7 +1209,7 @@ export type Filter = { * @since 9 * @readonly */ - lastModifiedAfter: number; + lastModifiedAfter?: number; /** * @type {boolean} * @syscap SystemCapability.FileManagement.File.FileIO @@ -1204,14 +1217,15 @@ export type Filter = { * @since 9 * @readonly */ - excludeMedia: boolean; + excludeMedia?: boolean; } /** * Stat * @syscap SystemCapability.FileManagement.File.FileIO * @since 6 - * @permission N/A + * @deprecated since 9 + * @useinstead ohos.file.fs.Stat */ declare interface Stat { /** @@ -1545,6 +1559,7 @@ declare interface Stream { * ReadOut * @syscap SystemCapability.FileManagement.File.FileIO * @since 6 + * @deprecated since 9 * @permission N/A */ declare interface ReadOut { diff --git a/api/@ohos.filemanagement.userFileManager.d.ts b/api/@ohos.filemanagement.userFileManager.d.ts index 863d2baa402312a617d0119ae0e71aa76ddf9dee..d141676249ae582a3d8b59d27b8d26b44c15352f 100644 --- a/api/@ohos.filemanagement.userFileManager.d.ts +++ b/api/@ohos.filemanagement.userFileManager.d.ts @@ -21,41 +21,46 @@ import dataSharePredicates from './@ohos.data.dataSharePredicates'; /** * @name userFileManager * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core - * @import Import userFileManager from '@ohos.filemanagement.userFileManager' */ declare namespace userFileManager { /** * Returns an instance of UserFileManager * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core * @StageModelOnly * @param context Hap context information - * @return Instance of UserFileManager + * @returns Instance of UserFileManager */ function getUserFileMgr(context: Context): UserFileManager; /** * Enumeration types for different kinds of Files * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ enum FileType { /** * Image file type * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ IMAGE = 1, /** * Video file type * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ VIDEO, /** * Audio file type * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ AUDIO @@ -63,49 +68,58 @@ declare namespace userFileManager { /** * Indicates the type of file asset member. + * @since 9 + * @systemapi */ type MemberType = number | string | boolean; /** * Indicates the type of notify event. + * @since 9 + * @systemapi */ type ChangeEvent = 'deviceChange' | 'albumChange' | 'imageChange' | 'audioChange' | 'videoChange' | 'remoteFileChange'; /** * Provides methods to encapsulate file attributes. * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core - * @import Import userFileManager from '@ohos.filemanagement.userFileManager' */ interface FileAsset { /** * URI of the file. * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ readonly uri: string; /** * File type, for example, IMAGE, VIDEO, AUDIO * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ readonly fileType: FileType; /** * Display name (with a file name extension) of the file. * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ displayName: string; /** - * Return the fileasset member parameter. + * Return the fileAsset member parameter. * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core * @param member the name of the parameter. for example : get(ImageVideoKey.URI) */ get(member: string): MemberType; /** - * Set the fileasset member parameter. + * Set the fileAsset member parameter. * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core * @param member The name of the parameter. only TITLE can be changed * @param string The value of the parameter. @@ -115,6 +129,7 @@ declare namespace userFileManager { /** * Modify meta data where the file is located. * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core * @permission ohos.permission.WRITE_IMAGEVIDEO or ohos.permission.WRITE_AUDIO * @param callback No value will be returned. @@ -123,6 +138,7 @@ declare namespace userFileManager { /** * Modify meta data where the file is located. * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core * @permission ohos.permission.WRITE_IMAGEVIDEO or ohos.permission.WRITE_AUDIO */ @@ -130,6 +146,7 @@ declare namespace userFileManager { /** * Open the file is located. * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core * @permission ohos.permission.READ_IMAGEVIDEO or ohos.permission.READ_AUDIO or ohos.permission.WRITE_IMAGEVIDEO or ohos.permission.WRITE_AUDIO * @param mode Mode for open, for example: rw, r, w. @@ -139,6 +156,7 @@ declare namespace userFileManager { /** * Open the file is located. * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core * @permission ohos.permission.READ_IMAGEVIDEO or ohos.permission.READ_AUDIO or ohos.permission.WRITE_IMAGEVIDEO or ohos.permission.WRITE_AUDIO * @param mode Mode for open, for example: rw, r, w. @@ -147,6 +165,7 @@ declare namespace userFileManager { /** * Close the file is located. * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core * @param fd Fd of the file which had been opened * @param callback No value will be returned. @@ -155,6 +174,7 @@ declare namespace userFileManager { /** * Close the file is located. * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core * @param fd Fd of the file which had been opened */ @@ -162,23 +182,26 @@ declare namespace userFileManager { /** * Get thumbnail of the file when the file is located. * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core * @permission ohos.permission.READ_IMAGEVIDEO or ohos.permission.READ_AUDIO - * @param callback Callback used to return the thumbnail's pixelmap. + * @param callback Callback used to return the thumbnail's pixelMap. */ getThumbnail(callback: AsyncCallback): void; /** * Get thumbnail of the file when the file is located. * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core * @permission ohos.permission.READ_IMAGEVIDEO or ohos.permission.READ_AUDIO * @param size Thumbnail's size - * @param callback Callback used to return the thumbnail's pixelmap. + * @param callback Callback used to return the thumbnail's pixelMap. */ getThumbnail(size: image.Size, callback: AsyncCallback): void; /** * Get thumbnail of the file when the file is located. * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core * @permission ohos.permission.READ_IMAGEVIDEO or ohos.permission.READ_AUDIO * @param size Thumbnail's size @@ -187,6 +210,7 @@ declare namespace userFileManager { /** * Set favorite for the file when the file is located. * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core * @permission ohos.permission.WRITE_IMAGEVIDEO or ohos.permission.WRITE_AUDIO * @param isFavorite True is favorite file, false is not favorite file @@ -196,6 +220,7 @@ declare namespace userFileManager { /** * Set favorite for the file when the file is located. * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core ** @permission ohos.permission.WRITE_IMAGEVIDEO or ohos.permission.WRITE_AUDIO * @param isFavorite True is favorite file, false is not favorite file @@ -206,60 +231,70 @@ declare namespace userFileManager { /** * Describes AUDIO TYPE FetchOptions's predicate * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ enum AudioKey { /** * File uri * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ URI, /** * File name * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ DISPLAY_NAME, /** * Date of the file creation * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ DATE_ADDED, /** * Modify date of the file * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ DATE_MODIFIED, /** * Title of the file * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ TITLE, /** * Artist of the audio file * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ ARTIST, /** * Audio album of the audio file * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ AUDIOALBUM, /** * Duration of the audio file * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ DURATION, /** * Favorite state of the file * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ FAVORITE, @@ -268,78 +303,91 @@ declare namespace userFileManager { /** * Describes Image, Video TYPE FetchOptions's predicate * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ enum ImageVideoKey { /** * File uri * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ URI, /** * File type of the Asset * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ FILE_TYPE, /** * File name * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ DISPLAY_NAME, /** * Date of the file creation * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ DATE_ADDED, /** * Modify date of the file * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ DATE_MODIFIED, /** * Title of the file * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ TITLE, /** * Duration of the audio and video file * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ DURATION, /** * Width of the image file * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ WIDTH, /** * Height of the image file * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ HEIGHT, /** * Date taken of the file * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ DATE_TAKEN, /** * Orientation of the image file * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ ORIENTATION, /** * Favorite state of the file * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ FAVORITE, @@ -348,36 +396,42 @@ declare namespace userFileManager { /** * Describes Album TYPE predicate * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ enum AlbumKey { /** * Album uri * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ URI, /** * File type of the Album * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ FILE_TYPE, /** * Album name * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ ALBUM_NAME, /** * Date of the Album creation * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ DATE_ADDED, /** * Modify date of the Album * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ DATE_MODIFIED, @@ -385,6 +439,7 @@ declare namespace userFileManager { /** * Fetch parameters + * @systemapi * @since 9 * @syscap SystemCapability.FileManagement.UserFileManager.Core */ @@ -392,6 +447,7 @@ declare namespace userFileManager { /** * Indicates the columns to query. * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core * @param fetchColumns Indicates the columns to query. If this parameter is null, only uri, name, fileType will query. */ @@ -399,6 +455,7 @@ declare namespace userFileManager { /** * Predicate to query * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core * @param predicates Indicates filter criteria. */ @@ -408,12 +465,14 @@ declare namespace userFileManager { /** * Fetch parameters * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ interface AlbumFetchOptions { /** * Predicate to query * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core * @param predicates Indicates filter criteria. */ @@ -423,35 +482,39 @@ declare namespace userFileManager { /** * Implements file retrieval. * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core - * @import Import userFileManager from '@ohos.filemanagement.userFileManager' */ interface FetchResult { /** * Obtains the total number of files in the file retrieval result. * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core - * @return Total number of files. + * @returns Total number of files. */ getCount(): number; /** * Checks whether the result set points to the last row. * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core - * @return Whether the file is the last one. + * @returns Whether the file is the last one. * You need to check whether the file is the last one before calling getNextObject, - * which returns the next file only when True is returned for this method. + * which returns the next file only when False is returned for this method. */ isAfterLast(): boolean; /** * Releases the FetchResult instance and invalidates it. Other methods cannot be called. * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ close(): void; /** * Obtains the first FileAsset in the file retrieval result. This method uses a callback to return the file. * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core * @param callback Callback used to return the file in the format of a FileAsset instance. */ @@ -459,16 +522,18 @@ declare namespace userFileManager { /** * Obtains the first T in the file retrieval result. This method uses a promise to return the file. * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core - * @return A Promise instance used to return the file in the format of a T instance. + * @returns A Promise instance used to return the file in the format of a T instance. */ getFirstObject(): Promise; /** * Obtains the next T in the file retrieval result. * This method uses a callback to return the file. * Before calling this method, you must use isAfterLast() to check whether the result set points to the last row. - * This method returns the next file only when True is returned for isAfterLast(). + * This method returns the next file only when False is returned for isAfterLast(). * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core * @param callback Callback used to return the file in the format of a T instance. */ @@ -477,15 +542,17 @@ declare namespace userFileManager { * Obtains the next T in the file retrieval result. * This method uses a promise to return the file. * Before calling this method, you must use isAfterLast() to check whether the result set points to the last row. - * This method returns the next file only when True is returned for isAfterLast(). + * This method returns the next file only when False is returned for isAfterLast(). * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core - * @return A Promise instance used to return the file in the format of a T instance. + * @returns A Promise instance used to return the file in the format of a T instance. */ getNextObject(): Promise; /** * Obtains the last T in the file retrieval result. This method uses a callback to return the file. * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core * @param callback Callback used to return the file in the format of a T instance. */ @@ -493,14 +560,16 @@ declare namespace userFileManager { /** * Obtains the last T in the file retrieval result. This method uses a promise to return the file. * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core - * @return A Promise instance used to return the file in the format of a T instance. + * @returns A Promise instance used to return the file in the format of a T instance. */ getLastObject(): Promise; /** * Obtains the T with the specified index in the file retrieval result. * This method uses a callback to return the file. * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core * @param index Index of the file to obtain. * @throws {BusinessError} 13900020 - if type index is not number @@ -511,10 +580,11 @@ declare namespace userFileManager { * Obtains the T with the specified index in the file retrieval result. * This method uses a promise to return the file. * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core * @param index Index of the file to obtain. * @throws {BusinessError} 13900020 - if type index is not number - * @return A Promise instance used to return the file in the format of a T instance. + * @returns A Promise instance used to return the file in the format of a T instance. */ getPositionObject(index: number): Promise; } @@ -524,44 +594,51 @@ declare namespace userFileManager { * * @syscap SystemCapability.FileManagement.UserFileManager.Core * @since 9 + * @systemapi */ interface AbsAlbum { /** * Album name. * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ albumName: string; /** * Album uri. * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ readonly albumUri: string; /** * Date (timestamp) when the album was last modified. * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ readonly dateModified: number; /** * File count for the album * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ readonly count: number; /** * CoverUri for the album * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ readonly coverUri: string; /** * Obtains files in an album. This method uses an asynchronous callback to return the files. * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core * @permission ohos.permission.READ_IMAGEVIDEO - * @param type Detemined which kinds of asset to retrive. + * @param type Determined which kinds of asset to retrive. * @param options Retrieval options. * @throws {BusinessError} 13900020 - if type options is not FetchOptions * @param callback Callback used to return the files in the format of a FetchResult instance. @@ -570,12 +647,13 @@ declare namespace userFileManager { /** * Obtains files in an album. This method uses a promise to return the files. * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core * @permission ohos.permission.READ_IMAGEVIDEO - * @param type Detemined which kinds of asset to retrive. + * @param type Determined which kinds of asset to retrive. * @param options Retrieval options. * @throws {BusinessError} 13900020 - if type options is not FetchOptions - * @return A Promise instance used to return the files in the format of a FetchResult instance. + * @returns A Promise instance used to return the files in the format of a FetchResult instance. */ getPhotoAssets(options: FetchOptions): Promise>; } @@ -585,11 +663,13 @@ declare namespace userFileManager { * * @syscap SystemCapability.FileManagement.UserFileManager.Core * @since 9 + * @systemapi */ interface Album extends AbsAlbum { /** * Modify the meta data for the album * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core * @permission ohos.permission.WRITE_IMAGEVIDEO * @param callback No value will be returned. @@ -598,6 +678,7 @@ declare namespace userFileManager { /** * Modify the meta data for the album * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core * @permission ohos.permission.WRITE_IMAGEVIDEO */ @@ -609,11 +690,13 @@ declare namespace userFileManager { * * @syscap SystemCapability.FileManagement.UserFileManager.Core * @since 9 + * @systemapi */ interface UserFileManager { /** * Query photo, video assets * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core * @permission ohos.permission.READ_IMAGEVIDEO * @param options retrieval options. @@ -624,12 +707,13 @@ declare namespace userFileManager { /** * Query photo, video assets * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core * @permission ohos.permission.READ_IMAGEVIDEO - * @param type Detemined which kinds of asset to retrive. + * @param type Determined which kinds of asset to retrive. * @param options Retrieval options. * @throws {BusinessError} 13900020 - if type options is not FetchOptions - * @return A promise instance used to return the files in the format of a FetchResult instance + * @returns A promise instance used to return the files in the format of a FetchResult instance */ getPhotoAssets(options: FetchOptions): Promise>; /** @@ -663,7 +747,7 @@ declare namespace userFileManager { * @permission ohos.permission.WRITE_IMAGEVIDEO * @param displayName File name * @param albumUri Album uri is optional, asset will put into the default album without albumUri - * @return A Promise instance used to return the FileAsset + * @returns A Promise instance used to return the FileAsset * @throws {BusinessError} 13900020 - if type displayName or albumUri is not string * @systemapi * @since 9 @@ -672,6 +756,7 @@ declare namespace userFileManager { /** * Obtains albums based on the retrieval options. This method uses an asynchronous callback to return. * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core * @permission ohos.permission.READ_IMAGEVIDEO * @param options Retrieval options. @@ -682,10 +767,11 @@ declare namespace userFileManager { /** * Obtains albums based on the retrieval options. This method uses a promise to return the albums. * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core * @permission ohos.permission.READ_IMAGEVIDEO * @param options Retrieval options. - * @return A Promise instance used to return an album array. + * @returns A Promise instance used to return an album array. * @throws {BusinessError} 13900020 - if type options is not AlbumFetchOptions */ getPhotoAlbums(options: AlbumFetchOptions): Promise>; @@ -705,7 +791,7 @@ declare namespace userFileManager { * @syscap SystemCapability.FileManagement.UserFileManager.Core * @permission ohos.permission.READ_IMAGEVIDEO * @param type Private album type - * @return A Promise instance used to return a private album FetchResult. + * @returns A Promise instance used to return a private album FetchResult. * @throws {BusinessError} 13900020 - if type type is not PrivateAlbumType * @systemapi * @since 9 @@ -714,6 +800,7 @@ declare namespace userFileManager { /** * Query audio assets * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core * @permission ohos.permission.READ_AUDIO * @param options Retrieval options. @@ -724,46 +811,50 @@ declare namespace userFileManager { /** * Query audio assets * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core * @permission ohos.permission.READ_AUDIO - * @param type Detemined which kinds of asset to retrive. + * @param type Determined which kinds of asset to retrive. * @param options Retrieval options. * @throws {BusinessError} 13900020 - if type options is not FetchOptions - * @return A promise instance used to return the files in the format of a FetchResult instance + * @returns A promise instance used to return the files in the format of a FetchResult instance */ getAudioAssets(options: FetchOptions): Promise>; /** * Delete Asset * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core * @permission ohos.permission.READ_IMAGEVIDEO and ohos.permission.WRITE_IMAGEVIDEO or ohos.permission.READ_AUDIO and ohos.permission.WRITE_AUDIO * @param uri Uri of asset * @param callback No value returned * @throws {BusinessError} 13900020 - if type uri is not string - * @systemapi */ delete(uri: string, callback: AsyncCallback): void; /** * Delete Asset * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core * @permission ohos.permission.READ_IMAGEVIDEO and ohos.permission.WRITE_IMAGEVIDEO or ohos.permission.READ_AUDIO and ohos.permission.WRITE_AUDIO * @param uri Uri of asset - * @return A Promise instance, no value returned + * @returns A Promise instance, no value returned * @throws {BusinessError} 13900020 - if type uri is not string */ delete(uri: string): Promise; /** - * Turn on mornitor the data changes + * Turn on monitor the data changes * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core * @param type One of 'deviceChange','albumChange','imageChange','audioChange','videoChange','remoteFileChange' * @param callback No value returned */ on(type: ChangeEvent, callback: Callback): void; /** - * Turn off mornitor the data changes + * Turn off monitor the data changes * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core * @param type One of 'deviceChange','albumChange','imageChange','audioChange','videoChange','remoteFileChange' * @param callback No value returned @@ -782,7 +873,7 @@ declare namespace userFileManager { * @since 9 * @syscap SystemCapability.FileManagement.UserFileManager.DistributedCore * @systemapi - * @return Promise used to return the list of the active peer devices' information + * @returns Promise used to return the list of the active peer devices' information */ getActivePeers(): Promise>; /** @@ -798,12 +889,13 @@ declare namespace userFileManager { * @since 9 * @syscap SystemCapability.FileManagement.UserFileManager.DistributedCore * @systemapi - * @return Promise used to return the list of the all the peer devices' information + * @returns Promise used to return the list of the all the peer devices' information */ getAllPeers(): Promise>; /** * Release UserFileManager instance * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core * @param callback no value returned */ @@ -811,6 +903,7 @@ declare namespace userFileManager { /** * Release UserFileManager instance * @since 9 + * @systemapi * @syscap SystemCapability.FileManagement.UserFileManager.Core */ release(): Promise; @@ -893,7 +986,7 @@ declare namespace userFileManager { * @syscap SystemCapability.FileManagement.UserFileManager.Core * @param uri Uri of asset * @permission ohos.permission.READ_IMAGEVIDEO and ohos.permission.WRITE_IMAGEVIDEO or ohos.permission.READ_AUDIO and ohos.permission.WRITE_AUDIO - * @return A Promise instance, no value returned + * @returns A Promise instance, no value returned * @systemapi */ delete(uri: string): Promise; @@ -913,11 +1006,11 @@ declare namespace userFileManager { * @param uri Uri of asset * @syscap SystemCapability.FileManagement.UserFileManager.Core * @permission ohos.permission.READ_IMAGEVIDEO and ohos.permission.WRITE_IMAGEVIDEO or ohos.permission.READ_AUDIO and ohos.permission.WRITE_AUDIO - * @return A Promise instance, no value returned + * @returns A Promise instance, no value returned * @systemapi */ recover(uri: string): Promise; } } -export default userFileManager; \ No newline at end of file +export default userFileManager; diff --git a/api/@ohos.font.d.ts b/api/@ohos.font.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6a7a589ee75b241a90cb9531d2382b0f5307662e --- /dev/null +++ b/api/@ohos.font.d.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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. + */ + +/** + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 9 + * @import font from '@ohos.font'; + */ +declare namespace font { + /** + * @since 9 + */ + interface FontOptions { + + /** + * The font name to register. + * @since 9 + */ + familyName: string; + + /** + * The path of the font file. + * @since 9 + */ + familySrc: string; + } + /** + * Register a customized font in the FontManager. + * @param options FontOptions + * @since 9 + */ + function registerFont(options: FontOptions):void; + +} + +export default font; diff --git a/api/@ohos.geoLocationManager.d.ts b/api/@ohos.geoLocationManager.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c7d117638348233a413099aec6b598330f059487 --- /dev/null +++ b/api/@ohos.geoLocationManager.d.ts @@ -0,0 +1,1460 @@ +/* + * 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, Callback } from './basic'; +import { WantAgent } from './@ohos.wantAgent'; + +/** + * Provides interfaces for acquiring location information, managing location switches, + * geocoding, reverse geocoding, country code, geofencing and other functions. + * @namespace geoLocationManager + * @since 9 + */ +declare namespace geoLocationManager { + /** + * Subscribe location changed. + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { LocationRequest } request - Indicates the location request parameters. + * @param { Callback } callback - Indicates the callback for reporting the location result. + * @returns { void }. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + function on(type: 'locationChange', request: LocationRequest, callback: Callback): void; + + /** + * Unsubscribe location changed. + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { Callback } [callback] - Indicates the callback for reporting the location result. + * @returns { void }. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + function off(type: 'locationChange', callback?: Callback): void; + + /** + * Subscribe location switch changed. + * @param { Callback } callback - Indicates the callback for reporting the location switch status. + * @returns { void }. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + function on(type: 'locationEnabledChange', callback: Callback): void; + + /** + * Unsubscribe location switch changed. + * @param { Callback } [callback] - Indicates the callback for reporting the location switch status. + * @returns { void }. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + function off(type: 'locationEnabledChange', callback?: Callback): void; + + /** + * Subscribe to cache GNSS locations update messages. + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { CachedGnssLocationsRequest } request - Indicates the cached GNSS locations request parameters. + * @param { Callback> } callback - Indicates the callback for reporting the cached GNSS locations. + * @returns { void }. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. + * @syscap SystemCapability.Location.Location.Gnss + * @since 9 + */ + function on(type: 'cachedGnssLocationsChange', request: CachedGnssLocationsRequest, callback: Callback>): void; + + /** + * Unsubscribe to cache GNSS locations update messages. + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { Callback> } [callback] - Indicates the callback for reporting the cached gnss locations. + * @returns { void }. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. + * @syscap SystemCapability.Location.Location.Gnss + * @since 9 + */ + function off(type: 'cachedGnssLocationsChange', callback?: Callback>): void; + + /** + * Subscribe satellite status changed. + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { Callback } callback - Indicates the callback for reporting the satellite status. + * @returns { void }. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @syscap SystemCapability.Location.Location.Gnss + * @since 9 + */ + function on(type: 'satelliteStatusChange', callback: Callback): void; + + /** + * Unsubscribe satellite status changed. + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { Callback } [callback] - Indicates the callback for reporting the satellite status. + * @returns { void }. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @syscap SystemCapability.Location.Location.Gnss + * @since 9 + */ + function off(type: 'satelliteStatusChange', callback?: Callback): void; + + /** + * Subscribe nmea message changed. + * @permission ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION + * @param { Callback } callback - Indicates the callback for reporting the nmea message. + * @returns { void }. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @syscap SystemCapability.Location.Location.Gnss + * @since 9 + */ + function on(type: 'nmeaMessage', callback: Callback): void; + + /** + * Unsubscribe nmea message changed. + * @permission ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION + * @param { Callback } [callback] - Indicates the callback for reporting the nmea message. + * @returns { void }. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @syscap SystemCapability.Location.Location.Gnss + * @since 9 + */ + function off(type: 'nmeaMessage', callback?: Callback): void; + + /** + * Add a geofence and subscribe geo fence status changed. + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { GeofenceRequest } request - Indicates the Geo-fence configuration parameters. + * @param { WantAgent } want - Indicates which ability to start when the geofence event is triggered. + * @returns { void }. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301600 - Failed to operate the geofence. + * @syscap SystemCapability.Location.Location.Geofence + * @since 9 + */ + function on(type: 'gnssFenceStatusChange', request: GeofenceRequest, want: WantAgent): void; + + /** + * Remove a geofence and unsubscribe geo fence status changed. + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { GeofenceRequest } request - Indicates the Geo-fence configuration parameters. + * @param { WantAgent } want - Indicates which ability to start when the geofence event is triggered. + * @returns { void }. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301600 - Failed to operate the geofence. + * @syscap SystemCapability.Location.Location.Geofence + * @since 9 + */ + function off(type: 'gnssFenceStatusChange', request: GeofenceRequest, want: WantAgent): void; + + /** + * Registering the callback function for listening to country code changes. + * @param { Callback } callback - Indicates the callback for reporting country code changes. + * @returns { void }. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301500 - Failed to query the area information. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + function on(type: 'countryCodeChange', callback: Callback): void; + + /** + * Unregistering the callback function for listening to country code changes. + * @param { Callback } [callback] - Indicates the callback for reporting country code changes. + * @returns { void }. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301500 - Failed to query the area information. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + function off(type: 'countryCodeChange', callback?: Callback): void; + + /** + * Obtain current location. + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { CurrentLocationRequest } request - Indicates the location request parameters. + * @param { AsyncCallback } callback - Indicates the callback for reporting the location result. + * @returns { void }. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + function getCurrentLocation(request: CurrentLocationRequest, callback: AsyncCallback): void; + + /** + * Obtain current location. + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { AsyncCallback } callback - Indicates the callback for reporting the location result. + * @returns { void }. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + function getCurrentLocation(callback: AsyncCallback): void; + + /** + * Obtain current location. + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { CurrentLocationRequest } [request] - Indicates the location request parameters. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + function getCurrentLocation(request?: CurrentLocationRequest): Promise; + + /** + * Obtain last known location. + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @returns { Location } The last known location information. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + function getLastLocation(): Location; + + /** + * Obtain current location switch status. + * @returns { boolean } Returns {@code true} if the location switch on, returns {@code false} otherwise. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + function isLocationEnabled(): boolean; + + /** + * Request enable location. The user needs to confirm whether to enable the location switch. + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { AsyncCallback } callback - Indicates the callback for reporting the user confirmation result, + * If the function fails to execute, the error message will be carried in the first parameter err of AsyncCallback, + * If the function executes successfully, returns {@code true} if user agrees to open the location switch, returns {@code false} otherwise. + * @returns { void }. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @throws { BusinessError } 3301700 - No response to the request. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + function requestEnableLocation(callback: AsyncCallback): void; + + /** + * Request enable location. The user needs to confirm whether to enable the location switch. + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @returns { Promise } The promise returned by the function. Returns {@code true} if user agrees to open the location switch, returns {@code false} otherwise. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @throws { BusinessError } 3301700 - No response to the request. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + function requestEnableLocation(): Promise; + + /** + * Enable location switch. + * @permission ohos.permission.MANAGE_SECURE_SETTINGS + * @param { AsyncCallback } callback - Indicates the callback for reporting the error message. + * @returns { void }. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - System API is not allowed called by third HAP. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @syscap SystemCapability.Location.Location.Core + * @systemapi + * @since 9 + */ + function enableLocation(callback: AsyncCallback): void; + + /** + * Enable location switch. + * @permission ohos.permission.MANAGE_SECURE_SETTINGS + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - System API is not allowed called by third HAP. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @syscap SystemCapability.Location.Location.Core + * @systemapi + * @since 9 + */ + function enableLocation(): Promise; + + /** + * Disable location switch. + * @permission ohos.permission.MANAGE_SECURE_SETTINGS + * @returns { void }. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - System API is not allowed called by third HAP. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @syscap SystemCapability.Location.Location.Core + * @systemapi + * @since 9 + */ + function disableLocation(): void; + + /** + * Obtain address info from location. + * @param { ReverseGeoCodeRequest } request - Indicates the reverse geocode query parameters. + * @param { AsyncCallback> } callback - Indicates the callback for reporting the address info. + * @returns { void }. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @throws { BusinessError } 3301300 - Reverse geocoding query failed. + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + function getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback>): void; + + /** + * Obtain address info from location. + * @param { ReverseGeoCodeRequest } request - Indicates the reverse geocode query parameters. + * @returns { Promise> } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @throws { BusinessError } 3301300 - Reverse geocoding query failed. + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + function getAddressesFromLocation(request: ReverseGeoCodeRequest): Promise>; + + /** + * Obtain latitude and longitude info from location address. + * @param { GeoCodeRequest } request - Indicates the geocode query parameters. + * @param { AsyncCallback> } callback - Indicates the callback for reporting the latitude and longitude result. + * @returns { void }. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @throws { BusinessError } 3301400 - Geocoding query failed. + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + function getAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback>): void; + + /** + * Obtain latitude and longitude info from location address. + * @param { GeoCodeRequest } request - Indicates the geocode query parameters. + * @returns { Promise> } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @throws { BusinessError } 3301400 - Geocoding query failed. + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + function getAddressesFromLocationName(request: GeoCodeRequest): Promise>; + + /** + * Obtain geocoding service status. + * @returns { boolean } Returns {@code true} if geocoding service is available, returns {@code false} otherwise. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + function isGeocoderAvailable(): boolean; + + /** + * Obtain the number of cached GNSS locations reported at a time. + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { AsyncCallback } callback - Indicates the callback for reporting the cached GNSS locations size. + * @returns { void }. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @syscap SystemCapability.Location.Location.Gnss + * @since 9 + */ + function getCachedGnssLocationsSize(callback: AsyncCallback): void; + + /** + * Obtain the number of cached GNSS locations. + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @syscap SystemCapability.Location.Location.Gnss + * @since 9 + */ + function getCachedGnssLocationsSize(): Promise; + + /** + * All prepared GNSS locations are returned to the application through the callback function, + * and the bottom-layer buffer is cleared. + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @param { AsyncCallback } callback - Indicates the callback for reporting the error message. + * If the function fails to execute, the error message will be carried in the first parameter err of AsyncCallback, + * If the function executes successfully, execute the callback function only, no data will be returned. + * @returns { void }. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. + * @syscap SystemCapability.Location.Location.Gnss + * @since 9 + */ + function flushCachedGnssLocations(callback: AsyncCallback): void; + + /** + * All prepared GNSS locations are returned to the application, + * and the bottom-layer buffer is cleared. + * @permission ohos.permission.APPROXIMATELY_LOCATION + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @throws { BusinessError } 3301200 - Failed to obtain the geographical location. + * @syscap SystemCapability.Location.Location.Gnss + * @since 9 + */ + function flushCachedGnssLocations(): Promise; + + /** + * Send extended commands to location subsystem. + * @param { LocationCommand } command - Indicates the extended command message body. + * @param { AsyncCallback } callback - Indicates the callback for reporting the error message. + * If the function fails to execute, the error message will be carried in the first parameter err of AsyncCallback, + * If the function executes successfully, execute the callback function only, no data will be returned. + * @returns { void }. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + function sendCommand(command: LocationCommand, callback: AsyncCallback): void; + + /** + * Send extended commands to location subsystem. + * @param { LocationCommand } command - Indicates the extended command message body. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + function sendCommand(command: LocationCommand): Promise; + + /** + * Obtain the current country code. + * @param { AsyncCallback } callback - Indicates the callback for reporting the country code. + * @returns { void }. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @throws { BusinessError } 3301500 - Failed to query the area information. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + function getCountryCode(callback: AsyncCallback): void; + + /** + * Obtain the current country code. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @throws { BusinessError } 3301500 - Failed to query the area information. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + function getCountryCode(): Promise; + + /** + * Enable the geographical location simulation function. + * @returns { void }. + * @throws { BusinessError } 202 - System API is not allowed called by third HAP. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @syscap SystemCapability.Location.Location.Core + * @systemapi + * @since 9 + */ + function enableLocationMock(): void; + + /** + * Disable the geographical location simulation function. + * @returns { void }. + * @throws { BusinessError } 202 - System API is not allowed called by third HAP. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @syscap SystemCapability.Location.Location.Core + * @systemapi + * @since 9 + */ + function disableLocationMock(): void; + + /** + * Set the configuration parameters for location simulation. + * @param { LocationMockConfig } config - Indicates the configuration parameters for location simulation. + * Contains the array of locations and reporting intervals that need to be simulated. + * @returns { void }. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @throws { BusinessError } 3301100 - The location switch is off. + * @syscap SystemCapability.Location.Location.Core + * @systemapi + * @since 9 + */ + function setMockedLocations(config: LocationMockConfig): void; + + /** + * Enable the reverse geocoding simulation function. + * @returns { void }. + * @throws { BusinessError } 202 - System API is not allowed called by third HAP. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @syscap SystemCapability.Location.Location.Core + * @systemapi + * @since 9 + */ + function enableReverseGeocodingMock(): void; + + /** + * Disable the reverse geocoding simulation function. + * @returns { void }. + * @throws { BusinessError } 202 - System API is not allowed called by third HAP. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @syscap SystemCapability.Location.Location.Core + * @systemapi + * @since 9 + */ + function disableReverseGeocodingMock(): void; + + /** + * Set the configuration parameters for simulating reverse geocoding. + * @param { Array } mockInfos - Indicates the set of locations and place names to be simulated. + * @returns { void }. + * @throws { BusinessError } 202 - System API is not allowed called by third HAP. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @syscap SystemCapability.Location.Location.Core + * @systemapi + * @since 9 + */ + function setReverseGeocodingMockInfo(mockInfos: Array): void; + + /** + * Querying location privacy protocol confirmation status. + * @param { LocationPrivacyType } type - Indicates location privacy protocol type. + * @returns { boolean } Returns {@code true} if the location privacy protocol has been confirmed, returns {@code false} otherwise. + * @throws { BusinessError } 202 - System API is not allowed called by third HAP. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @syscap SystemCapability.Location.Location.Core + * @systemapi + * @since 9 + */ + function isLocationPrivacyConfirmed(type: LocationPrivacyType): boolean; + + /** + * Set location privacy protocol confirmation status. + * @permission ohos.permission.MANAGE_SECURE_SETTINGS + * @param { LocationPrivacyType } type - Indicates location privacy protocol type. + * @param { boolean } isConfirmed - Indicates whether the location privacy protocol has been confirmed. + * @returns { void }. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 202 - System API is not allowed called by third HAP. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3301000 - Location service is unavailable. + * @syscap SystemCapability.Location.Location.Core + * @systemapi + * @since 9 + */ + function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean): void; + + /** + * Configuration parameters for simulating reverse geocoding. + * @typedef ReverseGeocodingMockInfo + * @syscap SystemCapability.Location.Location.Core + * @systemapi + * @since 9 + */ + export interface ReverseGeocodingMockInfo { + /** + * Location for which reverse geocoding query is required. + * @type { ReverseGeoCodeRequest } + * @systemapi + * @since 9 + */ + location: ReverseGeoCodeRequest; + + /** + * Actual address information corresponding to the location. + * @type { GeoAddress } + * @systemapi + * @since 9 + */ + geoAddress: GeoAddress; + } + + /** + * Parameters for configuring the location simulation function. + * @typedef LocationMockConfig + * @syscap SystemCapability.Location.Location.Core + * @systemapi + * @since 9 + */ + export interface LocationMockConfig { + /** + * Interval for reporting simulated locations. + * @type { number } + * @systemapi + * @since 9 + */ + timeInterval: number; + + /** + * Mock location array. + * @type { Array } + * @systemapi + * @since 9 + */ + locations: Array; + } + + /** + * Satellite status information. + * @typedef SatelliteStatusInfo + * @syscap SystemCapability.Location.Location.Gnss + * @since 9 + */ + export interface SatelliteStatusInfo { + /** + * Number of satellites. + * @type { number } + * @since 9 + */ + satellitesNumber: number; + + /** + * Satellite ID array. + * @type { Array } + * @since 9 + */ + satelliteIds: Array; + + /** + * Carrier to noise density array. + * @type { Array } + * @since 9 + */ + carrierToNoiseDensitys: Array; + + /** + * Satellite altitude array. + * @type { Array } + * @since 9 + */ + altitudes: Array; + + /** + * Satellite azimuth array. + * @type { Array } + * @since 9 + */ + azimuths: Array; + + /** + * Satellite carrier frequency array. + * @type { Array } + * @since 9 + */ + carrierFrequencies: Array; + } + + /** + * Parameters for requesting to report cache location information. + * @typedef CachedGnssLocationsRequest + * @syscap SystemCapability.Location.Location.Gnss + * @since 9 + */ + export interface CachedGnssLocationsRequest { + /** + * GNSS cache location report period. + * @type { number } + * @since 9 + */ + reportingPeriodSec: number; + + /** + * Indicates whether to wake up the listener when the GNSS cache location queue is full. + * @type { boolean } + * @since 9 + */ + wakeUpCacheQueueFull: boolean; + } + + /** + * Configuring parameters in geo fence requests. + * @typedef GeofenceRequest + * @syscap SystemCapability.Location.Location.Geofence + * @since 9 + */ + export interface GeofenceRequest { + /** + * Indicate the user scenario. + * @type { LocationRequestScenario } + * @since 9 + */ + scenario: LocationRequestScenario; + + /** + * Circular fence information. + * @type { Geofence } + * @since 9 + */ + geofence: Geofence; + } + + /** + * Circular fence information. + * @typedef Geofence + * @syscap SystemCapability.Location.Location.Geofence + * @since 9 + */ + export interface Geofence { + /** + * Latitude of the center point of the circular fence. + * @type { number } + * @since 9 + */ + latitude: number; + + /** + * Longitude of the center point of the circular fence. + * @type { number } + * @since 9 + */ + longitude: number; + + /** + * Radius of the circular fence. + * @type { number } + * @since 9 + */ + radius: number; + + /** + * Expiration of the circular fence. + * @type { number } + * @since 9 + */ + expiration: number; + } + + /** + * Configuring parameters in reverse geocode requests. + * @typedef ReverseGeoCodeRequest + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + export interface ReverseGeoCodeRequest { + /** + * Indicates the language area information. + * @type { ?string } + * @since 9 + */ + locale?: string; + + /** + * Latitude for reverse geocoding query. + * @type { number } + * @since 9 + */ + latitude: number; + + /** + * Longitude for reverse geocoding query. + * @type { number } + * @since 9 + */ + longitude: number; + + /** + * Indicates the maximum number of addresses returned by reverse geocoding query. + * @type { ?number } + * @since 9 + */ + maxItems?: number; + } + + /** + * Configuring parameters in geocode requests. + * @typedef GeoCodeRequest + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + export interface GeoCodeRequest { + /** + * Indicates the language area information. + * @type { ?string } + * @since 9 + */ + locale?: string; + + /** + * Address information that needs to be geocoded. + * @type { string } + * @since 9 + */ + description: string; + + /** + * Indicates the maximum number of geocode query results. + * @type { ?number } + * @since 9 + */ + maxItems?: number; + + /** + * Indicates the minimum latitude for geocoding query results. + * @type { ?number } + * @since 9 + */ + minLatitude?: number; + + /** + * Indicates the minimum longitude for geocoding query results. + * @type { ?number } + * @since 9 + */ + minLongitude?: number; + + /** + * Indicates the maximum latitude for geocoding query results. + * @type { ?number } + * @since 9 + */ + maxLatitude?: number; + + /** + * Indicates the maximum longitude for geocoding query results. + * @type { ?number } + * @since 9 + */ + maxLongitude?: number; + } + + /** + * Data struct describes geographic locations. + * @typedef GeoAddress + * @syscap SystemCapability.Location.Location.Geocoder + * @since 9 + */ + export interface GeoAddress { + /** + * Indicates latitude information. + * A positive value indicates north latitude, + * and a negative value indicates south latitude. + * @type { ?number } + * @since 9 + */ + latitude?: number; + + /** + * Indicates longitude information. + * A positive value indicates east longitude , + * and a negative value indicates west longitude. + * @type { ?number } + * @since 9 + */ + longitude?: number; + + /** + * Indicates language used for the location description. + * zh indicates Chinese, and en indicates English. + * @type { ?string } + * @since 9 + */ + locale?: string; + + /** + * Indicates landmark of the location. + * @type { ?string } + * @since 9 + */ + placeName?: string; + + /** + * Indicates country code. + * @type { ?string } + * @since 9 + */ + countryCode?: string; + + /** + * Indicates country name. + * @type { ?string } + * @since 9 + */ + countryName?: string; + + /** + * Indicates administrative region name. + * @type { ?string } + * @since 9 + */ + administrativeArea?: string; + + /** + * Indicates sub-administrative region name. + * @type { ?string } + * @since 9 + */ + subAdministrativeArea?: string; + + /** + * Indicates locality information. + * @type { ?string } + * @since 9 + */ + locality?: string; + + /** + * Indicates sub-locality information. + * @type { ?string } + * @since 9 + */ + subLocality?: string; + + /** + * Indicates road name. + * @type { ?string } + * @since 9 + */ + roadName?: string; + + /** + * Indicates auxiliary road information. + * @type { ?string } + * @since 9 + */ + subRoadName?: string; + + /** + * Indicates house information. + * @type { ?string } + * @since 9 + */ + premises?: string; + + /** + * Indicates postal code. + * @type { ?string } + * @since 9 + */ + postalCode?: string; + + /** + * Indicates phone number. + * @type { ?string } + * @since 9 + */ + phoneNumber?: string; + + /** + * Indicates website URL. + * @type { ?string } + * @since 9 + */ + addressUrl?: string; + + /** + * Indicates additional information. + * @type { ?Array } + * @since 9 + */ + descriptions?: Array; + + /** + * Indicates the amount of additional descriptive information. + * @type { ?number } + * @since 9 + */ + descriptionsSize?: number; + + /** + * Indicates whether it is an mock GeoAddress + * @type { ?Boolean } + * @systemapi + * @since 9 + */ + isFromMock?: Boolean; + } + + /** + * Configuring parameters in location requests. + * @typedef LocationRequest + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + export interface LocationRequest { + /** + * Priority of the location request. + * @type { ?LocationRequestPriority } + * @since 9 + */ + priority?: LocationRequestPriority; + + /** + * User scenario of the location request. + * @type { ?LocationRequestScenario } + * @since 9 + */ + scenario?: LocationRequestScenario; + + /** + * Location report interval. + * @type { ?number } + * @since 9 + */ + timeInterval?: number; + + /** + * Location report distance interval. + * @type { ?number } + * @since 9 + */ + distanceInterval?: number; + + /** + * Accuracy requirements for reporting locations. + * @type { ?number } + * @since 9 + */ + maxAccuracy?: number; + } + + /** + * Configuring parameters in current location requests. + * @typedef CurrentLocationRequest + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + export interface CurrentLocationRequest { + /** + * Priority of the location request. + * @type { ?LocationRequestPriority } + * @since 9 + */ + priority?: LocationRequestPriority; + + /** + * User scenario of the location request. + * @type { ?LocationRequestScenario } + * @since 9 + */ + scenario?: LocationRequestScenario; + + /** + * Accuracy requirements for reporting locations. + * @type { ?number } + * @since 9 + */ + maxAccuracy?: number; + + /** + * Timeout interval of a single location request. + * @type { ?number } + * @since 9 + */ + timeoutMs?: number; + } + + /** + * Provides information about geographic locations. + * @typedef Location + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + export interface Location { + /** + * Indicates latitude information. + * A positive value indicates north latitude, + * and a negative value indicates south latitude. + * @type { number } + * @since 9 + */ + latitude: number; + + /** + * Indicates Longitude information. + * A positive value indicates east longitude , + * and a negative value indicates west longitude. + * @type { number } + * @since 9 + */ + longitude: number; + + /** + * Indicates location altitude, in meters. + * @type { number } + * @since 9 + */ + altitude: number; + + /** + * Indicates location accuracy, in meters. + * @type { number } + * @since 9 + */ + accuracy: number; + + /** + * Indicates speed, in m/s. + * @type { number } + * @since 9 + */ + speed: number; + + /** + * Indicates location timestamp in the UTC format. + * @type { number } + * @since 9 + */ + timeStamp: number; + + /** + * Indicates direction information. + * @type { number } + * @since 9 + */ + direction: number; + + /** + * Indicates location timestamp since boot. + * @type { number } + * @since 9 + */ + timeSinceBoot: number; + + /** + * Indicates additional information. + * @type { ?Array } + * @since 9 + */ + additions?: Array; + + /** + * Indicates the amount of additional descriptive information. + * @type { ?number } + * @since 9 + */ + additionSize?: number; + + /** + * Indicates whether it is an mock location. + * @type { ?Boolean } + * @systemapi + * @since 9 + */ + isFromMock?: Boolean; + } + + /** + * Enum for location priority. + * @enum { number } + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + export enum LocationRequestPriority { + /** + * Default priority. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + UNSET = 0x200, + + /** + * Preferentially ensure the locating accuracy. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + ACCURACY, + + /** + * Preferentially ensure low power consumption for locating. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + LOW_POWER, + + /** + * Preferentially ensure that the first location is time-consuming. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + FIRST_FIX, + } + + /** + * Enum for location scenario. + * @enum { number } + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + export enum LocationRequestScenario { + /** + * Default scenario. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + UNSET = 0x300, + + /** + * Navigation scenario. High positioning precision and real-time performance are required. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + NAVIGATION, + + /** + * Trajectory tracking scenario. High positioning precision is required. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + TRAJECTORY_TRACKING, + + /** + * Car hailing scenario. High positioning precision and real-time performance are required. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + CAR_HAILING, + + /** + * Daily life scenarios. Low requirements on positioning precision and real-time performance. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + DAILY_LIFE_SERVICE, + + /** + * Power saving scenarios. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + NO_POWER, + } + + /** + * Enum for location privacy type. + * @enum { number } + * @syscap SystemCapability.Location.Location.Core + * @systemapi + * @since 9 + */ + export enum LocationPrivacyType { + /** + * Other scenarios. + * @syscap SystemCapability.Location.Location.Core + * @systemapi + * @since 9 + */ + OTHERS = 0, + + /** + * Privacy agreement for the startup wizard scenario. + * @syscap SystemCapability.Location.Location.Core + * @systemapi + * @since 9 + */ + STARTUP, + + /** + * Privacy agreement pop-up when network location is enabled. + * @syscap SystemCapability.Location.Location.Core + * @systemapi + * @since 9 + */ + CORE_LOCATION, + } + + /** + * Location subsystem command structure. + * @typedef LocationCommand + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + export interface LocationCommand { + /** + * Information about the scenario where the command is sent. + * @type { LocationRequestScenario } + * @since 9 + */ + scenario: LocationRequestScenario; + + /** + * Sent command content. + * @type { string } + * @since 9 + */ + command: string; + } + + /** + * Country code structure. + * @typedef CountryCode + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + export interface CountryCode { + /** + * Country code character string. + * @type { string } + * @since 9 + */ + country: string; + + /** + * Country code source. + * @type { CountryCodeType } + * @since 9 + */ + type: CountryCodeType; + } + + /** + * Enum for country code type. + * @enum { number } + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + export enum CountryCodeType { + /** + * Country code obtained from the locale setting. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + COUNTRY_CODE_FROM_LOCALE = 1, + + /** + * Country code obtained from the SIM information. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + COUNTRY_CODE_FROM_SIM, + + /** + * Obtains the current location for geocoded query and obtains the country code from the result. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + COUNTRY_CODE_FROM_LOCATION, + + /** + * Obtain the country code from the cell registration information. + * @syscap SystemCapability.Location.Location.Core + * @since 9 + */ + COUNTRY_CODE_FROM_NETWORK, + } +} + +export default geoLocationManager; diff --git a/api/@ohos.geolocation.d.ts b/api/@ohos.geolocation.d.ts index fc4619ebec67618bd8c1ce02da738b5c530a6199..0b2d3e4992c0780c221b01da8259b06658e4ca3a 100644 --- a/api/@ohos.geolocation.d.ts +++ b/api/@ohos.geolocation.d.ts @@ -21,8 +21,8 @@ import { WantAgent } from './@ohos.wantAgent'; * * @since 7 * @syscap SystemCapability.Location.Location.Core - * @import import geolocation from '@ohos.geolocation' * @permission ohos.permission.LOCATION + * @deprecated since 9 */ declare namespace geolocation { /** @@ -33,6 +33,8 @@ declare namespace geolocation { * @permission ohos.permission.LOCATION * @param request Indicates the location request parameters. * @param callback Indicates the callback for reporting the location result. + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.on#event:locationChange */ function on(type: 'locationChange', request: LocationRequest, callback: Callback): void; @@ -43,6 +45,8 @@ declare namespace geolocation { * @syscap SystemCapability.Location.Location.Core * @permission ohos.permission.LOCATION * @param callback Indicates the callback for reporting the location result. + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.off#event:locationChange */ function off(type: 'locationChange', callback?: Callback): void; @@ -53,6 +57,8 @@ declare namespace geolocation { * @syscap SystemCapability.Location.Location.Core * @permission ohos.permission.LOCATION * @param callback Indicates the callback for reporting the location result. + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.on#event:locationEnabledChange */ function on(type: 'locationServiceState', callback: Callback): void; @@ -63,6 +69,8 @@ declare namespace geolocation { * @syscap SystemCapability.Location.Location.Core * @permission ohos.permission.LOCATION * @param callback Indicates the callback for reporting the location result. + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.off#event:locationEnabledChange */ function off(type: 'locationServiceState', callback?: Callback): void; @@ -74,6 +82,8 @@ declare namespace geolocation { * @permission ohos.permission.LOCATION * @param request Indicates the cached GNSS locations request parameters. * @param callback Indicates the callback for reporting the cached GNSS locations. + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.on#event:cachedGnssLocationsChange */ function on(type: 'cachedGnssLocationsReporting', request: CachedGnssLocationsRequest, callback: Callback>): void; @@ -84,6 +94,8 @@ declare namespace geolocation { * @syscap SystemCapability.Location.Location.Gnss * @permission ohos.permission.LOCATION * @param callback Indicates the callback for reporting the cached gnss locations. + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.off#event:cachedGnssLocationsChange */ function off(type: 'cachedGnssLocationsReporting', callback?: Callback>): void; @@ -94,6 +106,8 @@ declare namespace geolocation { * @syscap SystemCapability.Location.Location.Gnss * @permission ohos.permission.LOCATION * @param callback Indicates the callback for reporting the gnss status change. + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.on#event:satelliteStatusChange */ function on(type: 'gnssStatusChange', callback: Callback): void; @@ -104,6 +118,8 @@ declare namespace geolocation { * @syscap SystemCapability.Location.Location.Gnss * @permission ohos.permission.LOCATION * @param callback Indicates the callback for reporting the gnss status change. + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.off#event:satelliteStatusChange */ function off(type: 'gnssStatusChange', callback?: Callback): void; @@ -114,6 +130,8 @@ declare namespace geolocation { * @syscap SystemCapability.Location.Location.Gnss * @permission ohos.permission.LOCATION * @param callback Indicates the callback for reporting the nmea message. + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.on#event:nmeaMessage */ function on(type: 'nmeaMessageChange', callback: Callback): void; @@ -124,6 +142,8 @@ declare namespace geolocation { * @syscap SystemCapability.Location.Location.Gnss * @permission ohos.permission.LOCATION * @param callback Indicates the callback for reporting the nmea message. + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.off#event:nmeaMessage */ function off(type: 'nmeaMessageChange', callback?: Callback): void; @@ -135,6 +155,8 @@ declare namespace geolocation { * @permission ohos.permission.LOCATION * @param request Indicates the Geo-fence configuration parameters. * @param callback Indicates the callback for reporting the fence status. + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.on#event:gnssFenceStatusChange */ function on(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void; @@ -146,27 +168,11 @@ declare namespace geolocation { * @permission ohos.permission.LOCATION * @param request Indicates the Geo-fence configuration parameters. * @param callback Indicates the callback for reporting the remove fence result. + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.off#event:gnssFenceStatusChange */ function off(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent): void; - /** - * registering the callback function for listening to country code changes. - * - * @since 9 - * @syscap SystemCapability.Location.Location.Core - * @param callback Indicates the callback for reporting country code changes. - */ - function on(type: 'countryCodeChange', callback: Callback): void; - - /** - * unregistering the callback function for listening to country code changes. - * - * @since 9 - * @syscap SystemCapability.Location.Location.Core - * @param callback Indicates the callback for reporting country code changes. - */ - function off(type: 'countryCodeChange', callback?: Callback): void; - /** * obtain current location * @@ -174,6 +180,8 @@ declare namespace geolocation { * @syscap SystemCapability.Location.Location.Core * @permission ohos.permission.LOCATION * @param callback Indicates the callback for reporting the location result. + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.getCurrentLocation */ function getCurrentLocation(request: CurrentLocationRequest, callback: AsyncCallback): void; function getCurrentLocation(callback: AsyncCallback): void; @@ -186,6 +194,8 @@ declare namespace geolocation { * @syscap SystemCapability.Location.Location.Core * @permission ohos.permission.LOCATION * @param callback Indicates the callback for reporting the location result. + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.getLastLocation */ function getLastLocation(callback: AsyncCallback): void; function getLastLocation(): Promise; @@ -197,6 +207,8 @@ declare namespace geolocation { * @syscap SystemCapability.Location.Location.Core * @permission ohos.permission.LOCATION * @param callback Indicates the callback for reporting the location switch result. + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.isLocationEnabled */ function isLocationEnabled(callback: AsyncCallback): void; function isLocationEnabled(): Promise; @@ -208,34 +220,12 @@ declare namespace geolocation { * @syscap SystemCapability.Location.Location.Core * @permission ohos.permission.LOCATION * @param callback Indicates the callback for reporting the location switch status. + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.requestEnableLocation */ function requestEnableLocation(callback: AsyncCallback): void; function requestEnableLocation(): Promise; - /** - * enable location switch - * - * @since 7 - * @syscap SystemCapability.Location.Location.Core - * @systemapi - * @permission ohos.permission.MANAGE_SECURE_SETTINGS - * @param callback Indicates the callback for reporting the location switch result. - */ - function enableLocation(callback: AsyncCallback): void; - function enableLocation(): Promise; - - /** - * disable location switch - * - * @since 7 - * @syscap SystemCapability.Location.Location.Core - * @systemapi - * @permission ohos.permission.MANAGE_SECURE_SETTINGS - * @param callback Indicates the callback for reporting the location switch result. - */ - function disableLocation(callback: AsyncCallback): void; - function disableLocation(): Promise; - /** * obtain address info from location * @@ -243,6 +233,8 @@ declare namespace geolocation { * @syscap SystemCapability.Location.Location.Geocoder * @permission ohos.permission.LOCATION * @param callback Indicates the callback for reporting the address info. + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.getAddressesFromLocation */ function getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback>): void; function getAddressesFromLocation(request: ReverseGeoCodeRequest): Promise>; @@ -254,6 +246,8 @@ declare namespace geolocation { * @syscap SystemCapability.Location.Location.Geocoder * @permission ohos.permission.LOCATION * @param callback Indicates the callback for reporting the latitude and longitude result. + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.getAddressesFromLocationName */ function getAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback>): void; function getAddressesFromLocationName(request: GeoCodeRequest): Promise>; @@ -265,6 +259,8 @@ declare namespace geolocation { * @syscap SystemCapability.Location.Location.Geocoder * @permission ohos.permission.LOCATION * @param callback Indicates the callback for reporting the geocode service status. + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.isGeocoderAvailable */ function isGeoServiceAvailable(callback: AsyncCallback): void; function isGeoServiceAvailable(): Promise; @@ -276,6 +272,8 @@ declare namespace geolocation { * @syscap SystemCapability.Location.Location.Gnss * @permission ohos.permission.LOCATION * @param callback Indicates the callback for reporting the cached GNSS locations size. + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.getCachedGnssLocationsSize */ function getCachedGnssLocationsSize(callback: AsyncCallback): void; function getCachedGnssLocationsSize(): Promise; @@ -288,6 +286,8 @@ declare namespace geolocation { * @syscap SystemCapability.Location.Location.Gnss * @permission ohos.permission.LOCATION * @param callback Indicates the callback for reporting the result. + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.flushCachedGnssLocations */ function flushCachedGnssLocations(callback: AsyncCallback): void; function flushCachedGnssLocations(): Promise; @@ -300,137 +300,20 @@ declare namespace geolocation { * @permission ohos.permission.LOCATION * @param command Indicates the extended Command Message Body. * @param callback Indicates the callback for reporting the send command result. + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.sendCommand */ function sendCommand(command: LocationCommand, callback: AsyncCallback): void; function sendCommand(command: LocationCommand): Promise; - /** - * obtain the current country code. - * - * @since 9 - * @syscap SystemCapability.Location.Location.Core - * @param callback Indicates the callback for reporting the country code. - */ - function getCountryCode(callback: AsyncCallback): void; - function getCountryCode(): Promise; - - /** - * enable the geographical location simulation function. - * - * @since 9 - * @syscap SystemCapability.Location.Location.Core - * @systemapi - * @param scenario Indicates the scenarios where location simulation is required. - * @param callback Indicates a callback function, which is used to report the result - * of enabling the location simulation function. If the enabling fails, the error message will - * be carried in the first parameter err of AsyncCallback, If enabling succeeds, no data will be returned. - */ - function enableLocationMock(scenario: LocationRequestScenario, callback: AsyncCallback): void; - function enableLocationMock(callback: AsyncCallback): void; - function enableLocationMock(scenario: LocationRequestScenario): Promise; - function enableLocationMock(): Promise; - - /** - * disable the geographical location simulation function. - * - * @since 9 - * @syscap SystemCapability.Location.Location.Core - * @systemapi - * @param scenario Indicates the scenarios where location simulation is required. - * @param callback Indicates a callback function, which is used to report the result - * of disabling the location simulation function. If the disabling fails, the error message will - * be carried in the first parameter err of AsyncCallback, If disabling succeeds, no data will be returned. - */ - function disableLocationMock(scenario: LocationRequestScenario, callback: AsyncCallback): void; - function disableLocationMock(callback: AsyncCallback): void; - function disableLocationMock(scenario: LocationRequestScenario): Promise; - function disableLocationMock(): Promise; - - /** - * set the configuration parameters for location simulation. - * - * @since 9 - * @syscap SystemCapability.Location.Location.Core - * @systemapi - * @param config Indicates the configuration parameters for location simulation. - * @param callback Indicates a callback function, which is used to report the result of setting - * the simulation locations. If the setting fails, the error message will be carried in the first - * parameter err of AsyncCallback. If the setting succeeds, no data will be returned. - */ - function setMockedLocations(config: LocationMockConfig, callback: AsyncCallback): void; - function setMockedLocations(config: LocationMockConfig): Promise; - - /** - * enable the reverse geocoding simulation function. - * - * @since 9 - * @syscap SystemCapability.Location.Location.Core - * @systemapi - * @param callback Indicates a callback function, which is used to report the result - * of enabling the reverse geocode simulation function. If the enabling fails, the error message will - * be carried in the first parameter err of AsyncCallback, If enabling succeeds, no data will be returned. - */ - function enableReverseGeocodingMock(callback: AsyncCallback): void; - function enableReverseGeocodingMock(): Promise; - - /** - * disable the reverse geocoding simulation function. - * - * @since 9 - * @syscap SystemCapability.Location.Location.Core - * @systemapi - * @param callback Indicates a callback function, which is used to report the result - * of disabling the reverse geocode simulation function. If the disabling fails, the error message will - * be carried in the first parameter err of AsyncCallback, If disabling succeeds, no data will be returned. - */ - function disableReverseGeocodingMock(callback: AsyncCallback): void; - function disableReverseGeocodingMock(): Promise; - - /** - * set the configuration parameters for simulating reverse geocoding. - * - * @since 9 - * @syscap SystemCapability.Location.Location.Core - * @systemapi - * @param mockInfos Indicates the set of locations and place names to be simulated. - * @param callback Indicates a callback function, which is used to report the result of setting - * the configuration parameters for simulating reverse geocoding. If the setting fails, - * the error message will be carried in the first parameter err of AsyncCallback. - * If the setting succeeds, no data will be returned. - */ - function setReverseGeocodingMockInfo(mockInfos: Array, callback: AsyncCallback): void; - function setReverseGeocodingMockInfo(mockInfos: Array): Promise; - - /** - * configuration parameters for simulating reverse geocoding. - * - * @since 9 - * @syscap SystemCapability.Location.Location.Core - * @systemapi - */ - export interface ReverseGeocodingMockInfo { - location: ReverseGeoCodeRequest; - geoAddress: GeoAddress; - } - - /** - * parameters for configuring the location simulation function. - * - * @since 9 - * @syscap SystemCapability.Location.Location.Core - * @systemapi - */ - export interface LocationMockConfig { - timeInterval: number; - locations: Array; - } - /** * satellite status information * * @since 8 * @syscap SystemCapability.Location.Location.Gnss * @permission ohos.permission.LOCATION + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.SatelliteStatusInfo */ export interface SatelliteStatusInfo { satellitesNumber: number; @@ -447,6 +330,8 @@ declare namespace geolocation { * @since 8 * @syscap SystemCapability.Location.Location.Gnss * @permission ohos.permission.LOCATION + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.CachedGnssLocationsRequest */ export interface CachedGnssLocationsRequest { reportingPeriodSec: number; @@ -459,6 +344,8 @@ declare namespace geolocation { * @since 8 * @syscap SystemCapability.Location.Location.Geofence * @permission ohos.permission.LOCATION + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.GeofenceRequest */ export interface GeofenceRequest { priority: LocationRequestPriority; @@ -472,6 +359,8 @@ declare namespace geolocation { * @since 8 * @syscap SystemCapability.Location.Location.Geofence * @permission ohos.permission.LOCATION + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.Geofence */ export interface Geofence { latitude: number; @@ -480,39 +369,14 @@ declare namespace geolocation { expiration: number; } - /** - * querying location privacy protocol confirmation status. - * - * @since 8 - * @systemapi - * @syscap SystemCapability.Location.Location.Core - * @permission ohos.permission.LOCATION - * @param type indicates location privacy protocol type. - * @param callback indicates the callback for reporting the location privacy protocol confirmation status. - */ - function isLocationPrivacyConfirmed(type: LocationPrivacyType, callback: AsyncCallback): void; - function isLocationPrivacyConfirmed(type: LocationPrivacyType,): Promise; - - /** - * set location privacy protocol confirmation status. - * - * @since 8 - * @systemapi - * @syscap SystemCapability.Location.Location.Core - * @permission ohos.permission.LOCATION - * @param type indicates location privacy protocol type. - * @param isConfirmed indicates whether the location privacy protocol has been confirmed. - * @param callback Indicates the callback for reporting whether the action is set successfully. - */ - function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean, callback: AsyncCallback): void; - function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean): Promise; - /** * configuring parameters in reverse geocode requests * * @since 7 * @syscap SystemCapability.Location.Location.Geocoder * @permission ohos.permission.LOCATION + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.ReverseGeoCodeRequest */ export interface ReverseGeoCodeRequest { locale?: string; @@ -527,6 +391,8 @@ declare namespace geolocation { * @since 7 * @syscap SystemCapability.Location.Location.Geocoder * @permission ohos.permission.LOCATION + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.GeoCodeRequest */ export interface GeoCodeRequest { locale?: string; @@ -544,6 +410,8 @@ declare namespace geolocation { * @since 7 * @syscap SystemCapability.Location.Location.Geocoder * @permission ohos.permission.LOCATION + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.GeoAddress */ export interface GeoAddress { /** @@ -658,12 +526,6 @@ declare namespace geolocation { * @since 7 */ descriptionsSize?: number; - - /** - * Indicates whether it is an mock GeoAddress - * @since 9 - */ - isFromMock?: Boolean; } /** @@ -672,6 +534,8 @@ declare namespace geolocation { * @since 7 * @syscap SystemCapability.Location.Location.Core * @permission ohos.permission.LOCATION + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.LocationRequest */ export interface LocationRequest { priority?: LocationRequestPriority; @@ -687,6 +551,8 @@ declare namespace geolocation { * @since 7 * @syscap SystemCapability.Location.Location.Core * @permission ohos.permission.LOCATION + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.CurrentLocationRequest */ export interface CurrentLocationRequest { priority?: LocationRequestPriority; @@ -701,6 +567,8 @@ declare namespace geolocation { * @since 7 * @syscap SystemCapability.Location.Location.Core * @permission ohos.permission.LOCATION + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.Location */ export interface Location { /** @@ -766,12 +634,6 @@ declare namespace geolocation { * @since 7 */ additionSize?: number; - - /** - * Indicates whether it is an mock location. - * @since 9 - */ - isFromMock?: Boolean; } /** @@ -780,6 +642,8 @@ declare namespace geolocation { * @since 7 * @syscap SystemCapability.Location.Location.Core * @permission ohos.permission.LOCATION + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.LocationRequestPriority */ export enum LocationRequestPriority { UNSET = 0x200, @@ -794,6 +658,8 @@ declare namespace geolocation { * @since 7 * @syscap SystemCapability.Location.Location.Core * @permission ohos.permission.LOCATION + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.LocationRequestScenario */ export enum LocationRequestScenario { UNSET = 0x300, @@ -810,14 +676,9 @@ declare namespace geolocation { * @since 7 * @syscap SystemCapability.Location.Location.Core * @permission ohos.permission.LOCATION + * @deprecated since 9 */ export enum GeoLocationErrorCode { - /** - * Indicates function not supported. - * @since 9 - */ - NOT_SUPPORTED = 100, - /** * Indicates input parameter error. * @since 7 @@ -859,12 +720,6 @@ declare namespace geolocation { * @since 7 */ LOCATION_REQUEST_TIMEOUT_ERROR, - - /** - * Indicates country code query failed. - * @since 9 - */ - QUERY_COUNTRY_CODE_ERROR, } /** @@ -873,6 +728,8 @@ declare namespace geolocation { * @since 8 * @syscap SystemCapability.Location.Location.Core * @permission ohos.permission.LOCATION + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.LocationPrivacyType */ export enum LocationPrivacyType { OTHERS = 0, @@ -886,35 +743,13 @@ declare namespace geolocation { * @since 8 * @syscap SystemCapability.Location.Location.Core * @permission ohos.permission.LOCATION + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.LocationCommand */ export interface LocationCommand { scenario: LocationRequestScenario; command: string; } - - /** - * country code structure - * - * @since 9 - * @syscap SystemCapability.Location.Location.Core - */ - export interface CountryCode { - country: string; - type: CountryCodeType; - } - - /** - * enum for country code type - * - * @since 9 - * @syscap SystemCapability.Location.Location.Core - */ - export enum CountryCodeType { - COUNTRY_CODE_FROM_LOCALE = 1, - COUNTRY_CODE_FROM_SIM, - COUNTRY_CODE_FROM_LOCATION, - COUNTRY_CODE_FROM_NETWORK, - } } export default geolocation; diff --git a/api/@ohos.graphics.colorSpaceManager.d.ts b/api/@ohos.graphics.colorSpaceManager.d.ts index db7b533a3f1b3a3c6414ae09aa6b90eebb044b41..ff95a5b29bd69c275777881d9f8b17bc78b6a46d 100644 --- a/api/@ohos.graphics.colorSpaceManager.d.ts +++ b/api/@ohos.graphics.colorSpaceManager.d.ts @@ -71,63 +71,63 @@ import { AsyncCallback } from './basic'; } /** - * Describes the primary colors red, green, blue and white point - * in each color space map(x, y), in terms of real world chromaticities. + * Describes the primary colors red, green, blue and white point coordinated as (x, y) + * in color space, in terms of real world chromaticities. * @since 9 * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core */ interface ColorSpacePrimaries { /** - * x value of red color + * Coordinate value x of red color * @since 9 * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core */ redX: number; /** - * y value of red color + * Coordinate value y of red color * @since 9 * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core */ redY: number; /** - * x value of green color + * Coordinate value x of green color * @since 9 * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core */ greenX: number; /** - * y value of green color + * Coordinate value y of green color * @since 9 * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core */ greenY: number; /** - * x value of blue color + * Coordinate value x of blue color * @since 9 * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core */ blueX: number; /** - * y value of blue color + * Coordinate value y of blue color * @since 9 * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core */ blueY: number; /** - * x value of white point + * Coordinate value x of white point * @since 9 * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core */ whitePointX: number; /** - * y value of white point + * Coordinate value y of white point * @since 9 * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core */ @@ -135,7 +135,7 @@ import { AsyncCallback } from './basic'; } /** - * color space manager, created by color space infomation + * Defines a color space object and manages its key information * @since 9 * @syscap SystemCapability.Graphic.Graphic2D.ColorManager.Core */ @@ -143,26 +143,31 @@ import { AsyncCallback } from './basic'; /** * Get color space type. * @since 9 + * @throws {BusinessError} 18600001 - If param value is abnormal */ getColorSpaceName(): ColorSpace; /** * Get white point(x, y) of color space. * @since 9 + * @throws {BusinessError} 18600001 - If param value is abnormal */ getWhitePoint(): Array; /** * Get gamma value of color space. * @since 9 + * @throws {BusinessError} 18600001 - If param value is abnormal */ getGamma(): number; } /** - * Create a color space manager by proviced color space type. + * Create a color space manager by provided color space type. * @param colorSpaceName Indicates the type of color space * @since 9 + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 18600001 - If param value is abnormal */ function create(colorSpaceName: ColorSpace): ColorSpaceManager; @@ -171,6 +176,8 @@ import { AsyncCallback } from './basic'; * @param primaries Indicates the customized color primaries * @param gamma Indicates display gamma value * @since 9 + * @throws {BusinessError} 401 - If param is invalid + * @throws {BusinessError} 18600001 - If param value is abnormal */ function create(primaries: ColorSpacePrimaries, gamma: number): ColorSpaceManager; } diff --git a/api/@ohos.hiAppEvent.d.ts b/api/@ohos.hiAppEvent.d.ts index 2d694a38b52c27b95ccb2bd50d2edbf8755eeac5..96446e5bc575c37c152b415d46e263406039de13 100644 --- a/api/@ohos.hiAppEvent.d.ts +++ b/api/@ohos.hiAppEvent.d.ts @@ -22,6 +22,8 @@ import { AsyncCallback } from './basic'; * * @since 7 * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @deprecated since 9 + * @useinstead ohos.hiviewdfx.hiAppEvent */ declare namespace hiAppEvent { /** @@ -72,7 +74,7 @@ declare namespace hiAppEvent { */ namespace Event { /** - * user login event. + * User login event. * * @since 7 * @syscap SystemCapability.HiviewDFX.HiAppEvent @@ -80,7 +82,7 @@ declare namespace hiAppEvent { const USER_LOGIN: string; /** - * user logout event. + * User logout event. * * @since 7 * @syscap SystemCapability.HiviewDFX.HiAppEvent @@ -88,7 +90,7 @@ declare namespace hiAppEvent { const USER_LOGOUT: string; /** - * distributed service event. + * Distributed service event. * * @since 7 * @syscap SystemCapability.HiviewDFX.HiAppEvent @@ -104,7 +106,7 @@ declare namespace hiAppEvent { */ namespace Param { /** - * user id. + * User id. * * @since 7 * @syscap SystemCapability.HiviewDFX.HiAppEvent @@ -112,7 +114,7 @@ declare namespace hiAppEvent { const USER_ID: string; /** - * distributed service name. + * Distributed service name. * * @since 7 * @syscap SystemCapability.HiviewDFX.HiAppEvent @@ -120,7 +122,7 @@ declare namespace hiAppEvent { const DISTRIBUTED_SERVICE_NAME: string; /** - * distributed service instance id. + * Distributed service instance id. * * @since 7 * @syscap SystemCapability.HiviewDFX.HiAppEvent @@ -129,29 +131,28 @@ declare namespace hiAppEvent { } /** - * write application event. + * Write application event. * * @since 7 - * @deprecated since 9 * @syscap SystemCapability.HiviewDFX.HiAppEvent * @static - * @param {string} eventName application event name. - * @param {EventType} eventType application event type. - * @param {object} keyValues application event key-value pair params. - * @param {AsyncCallback} [callback] callback function. - * @return {void | Promise} no callback return Promise otherwise return void. + * @param {string} eventName Application event name. + * @param {EventType} eventType Application event type. + * @param {object} keyValues Application event key-value pair params. + * @param {AsyncCallback} [callback] Callback function. + * @returns {void | Promise} No callback return Promise otherwise return void. */ function write(eventName: string, eventType: EventType, keyValues: object): Promise; function write(eventName: string, eventType: EventType, keyValues: object, callback: AsyncCallback): void; /** - * application event logging configuration interface. + * Application event logging configuration interface. * * @since 7 * @syscap SystemCapability.HiviewDFX.HiAppEvent * @static - * @param {ConfigOption} config application event logging configuration item object. - * @return {boolean} configuration result. + * @param {ConfigOption} config Application event logging configuration item object. + * @returns {boolean} Configuration result. */ function configure(config: ConfigOption): boolean; @@ -163,7 +164,7 @@ declare namespace hiAppEvent { */ interface ConfigOption { /** - * configuration item: application event logging switch. + * Configuration item: application event logging switch. * * @since 7 * @syscap SystemCapability.HiviewDFX.HiAppEvent @@ -171,216 +172,13 @@ declare namespace hiAppEvent { disable?: boolean; /** - * configuration item: event file directory storage quota size. + * Configuration item: event file directory storage quota size. * * @since 7 * @syscap SystemCapability.HiviewDFX.HiAppEvent */ maxStorage?: string; } - - /** - * Definition of written application event information. - * - * @since 9 - * @syscap SystemCapability.HiviewDFX.HiAppEvent - */ - interface AppEventInfo { - /** - * The domain of the event. - */ - domain: string; - - /** - * The name of the event. - */ - name: string; - - /** - * The type of the event. - */ - eventType: EventType; - - /** - * The params of the event. - */ - params: object; - } - - /** - * write application event. - * - * @since 9 - * @syscap SystemCapability.HiviewDFX.HiAppEvent - * @static - * @param {AppEventInfo} info application event information to be written. - * @param {AsyncCallback} [callback] callback function. - * @return {void | Promise} no callback return Promise otherwise return void. - */ - function write(info: AppEventInfo): Promise; - function write(info: AppEventInfo, callback: AsyncCallback): void; - - /** - * Definition of the read event package. - * - * @since 9 - * @syscap SystemCapability.HiviewDFX.HiAppEvent - */ - interface AppEventPackage { - /** - * The id of the package. - */ - packageId: number; - - /** - * The number of events contained in the package. - */ - row: number; - - /** - * The total size of events contained in the package. - */ - size: number; - - /** - * The events data contained in the package. - */ - data: string[]; - } - - /** - * Definition of event holder object, which is used to read the event data monitored by the watcher. - * - * @since 9 - * @syscap SystemCapability.HiviewDFX.HiAppEvent - */ - class AppEventPackageHolder { - /** - * Constructor for AppEventPackageHolder. - * - * @since 9 - * @syscap SystemCapability.HiviewDFX.HiAppEvent - * @param {string} watcherName name of the watcher to read. - */ - constructor(watcherName: string); - - /** - * Set the threshold size per read. - * - * @since 9 - * @syscap SystemCapability.HiviewDFX.HiAppEvent - * @param {number} size threshold size. - */ - setSize(size: number): void; - - /** - * Read the event data monitored by the watcher. - * - * @since 9 - * @syscap SystemCapability.HiviewDFX.HiAppEvent - * @return {AppEventPackage} the read event package. - */ - takeNext(): AppEventPackage; - } - - /** - * Definition of the condition for triggering callback when the watcher monitors event data. - * - * @since 9 - * @syscap SystemCapability.HiviewDFX.HiAppEvent - */ - interface TriggerCondition { - /** - * The number of write events that trigger callback. - */ - row?: number; - - /** - * The size of write events that trigger callback. - */ - size?: number; - - /** - * The interval for triggering callback. - */ - timeOut?: number; - } - - /** - * Definition of event filter object, which is used to filter events monitored by the watcher. - * - * @since 9 - * @syscap SystemCapability.HiviewDFX.HiAppEvent - */ - interface AppEventFilter { - /** - * The name of the event domain to be monitored by the watcher. - */ - domain: string; - - /** - * The types of the events to be monitored by the watcher. - */ - eventTypes?: EventType[]; - } - - /** - * Definition of event watcher object, which is used to monitor written event data. - * - * @since 9 - * @syscap SystemCapability.HiviewDFX.HiAppEvent - */ - interface Watcher { - /** - * The name of watcher. - */ - name: string; - - /** - * The condition for triggering callback. - */ - triggerCondition?: TriggerCondition; - - /** - * The event filters for monitoring events. - */ - appEventFilters?: AppEventFilter[]; - - /** - * The callback function of watcher. - */ - onTrigger?: (curRow: number, curSize:number, holder:AppEventPackageHolder) => void; - } - - /** - * Add event watcher. - * - * @since 9 - * @syscap SystemCapability.HiviewDFX.HiAppEvent - * @static - * @param {Watcher} watcher watcher object for monitoring events. - * @return {AppEventPackageHolder} holder object, which is used to read the monitoring data of the watcher. - */ - function addWatcher(watcher: Watcher): AppEventPackageHolder; - - /** - * Remove event watcher. - * - * @since 9 - * @syscap SystemCapability.HiviewDFX.HiAppEvent - * @static - * @param {Watcher} watcher watcher object for monitoring events. - */ - function removeWatcher(watcher: Watcher): void; - - /** - * Clear all local logging data of the application. - * - * @since 9 - * @syscap SystemCapability.HiviewDFX.HiAppEvent - * @static - */ - function clearData(): void; } -export default hiAppEvent; \ No newline at end of file +export default hiAppEvent; diff --git a/api/@ohos.hiSysEvent.d.ts b/api/@ohos.hiSysEvent.d.ts index 4e0f662108e457a41a4c1a7c3b13f7c10d54676b..cbda18a429cbade90b096385343f66cbd1f18129 100644 --- a/api/@ohos.hiSysEvent.d.ts +++ b/api/@ohos.hiSysEvent.d.ts @@ -22,7 +22,6 @@ import { AsyncCallback } from './basic'; * * @syscap SystemCapability.HiviewDFX.HiSysEvent * @systemapi hide for inner use - * @import import hiSysEvent from '@ohos.hiSysEvent' * @since 9 */ declare namespace hiSysEvent { @@ -110,7 +109,16 @@ declare namespace hiSysEvent { * @static * @param {SysEventInfo} info system event information to be written. * @param {AsyncCallback} [callback] callback function. - * @return {void | Promise} no callback return Promise otherwise return void. + * @throws {BusinessError} 401 - Invalid argument. + * @throws {BusinessError} 11200001 - Invalid event domain. + * @throws {BusinessError} 11200002 - Invalid event name. + * @throws {BusinessError} 11200003 - Abnormal environment. + * @throws {BusinessError} 11200004 - Length of the event is over limit. + * @throws {BusinessError} 11200051 - Invalid event parameter. + * @throws {BusinessError} 11200052 - Size of the event parameter of the string type is over limit. + * @throws {BusinessError} 11200053 - Count of event parameters is over limit. + * @throws {BusinessError} 11200054 - Count of event parameter of the array type is over limit. + * @returns {void | Promise} no callback return Promise otherwise return void. * @since 9 */ function write(info: SysEventInfo): Promise; @@ -202,7 +210,7 @@ declare namespace hiSysEvent { * @syscap SystemCapability.HiviewDFX.HiSysEvent * @systemapi hide for inner use * @param {SysEventInfo} info system event information of receive. - * @return {void} return void. + * @returns {void} return void. * @since 9 */ onEvent: (info: SysEventInfo) => void; @@ -212,7 +220,7 @@ declare namespace hiSysEvent { * * @syscap SystemCapability.HiviewDFX.HiSysEvent * @systemapi hide for inner use - * @return {void} return void. + * @returns {void} return void. * @since 9 */ onServiceDied: () => void; @@ -272,16 +280,15 @@ declare namespace hiSysEvent { */ interface Querier { /** - * handle query result, the query result will be send in serval times. + * handle query result, the query result will be send in severval times. * * @syscap SystemCapability.HiviewDFX.HiSysEvent * @systemapi hide for inner use * @param {SysEventInfo[]} infos system event information of query result. - * @param {number[]} seqs sequeue of infos. - * @return {void} return void. + * @returns {void} return void. * @since 9 */ - onQuery: (infos: SysEventInfo[], seqs: number[]) => void; + onQuery: (infos: SysEventInfo[]) => void; /** * notify Querier execute query has finished. @@ -290,7 +297,7 @@ declare namespace hiSysEvent { * @systemapi hide for inner use * @param {number} reason 0 success, 1 fail. * @param {number} total the total number of query result. - * @return {void} return void. + * @returns {void} return void. * @since 9 */ onComplete: (reason: number, total: number) => void; @@ -303,10 +310,14 @@ declare namespace hiSysEvent { * @systemapi hide for inner use * @permission ohos.permission.READ_DFX_SYSEVENT * @param {Watcher} watcher watch system event - * @return {number} 0 success, 1 fail + * @throws {BusinessError} 201 - Permission denied. An attempt was made to read system event forbidden by permission: ohos.permission.READ_DFX_SYSEVENT. + * @throws {BusinessError} 401 - Invalid argument. + * @throws {BusinessError} 11200101 - Count of watchers is over limit. + * @throws {BusinessError} 11200102 - Count of watch rules is over limit. + * @returns {void} return void. * @since 9 */ - function addWatcher(watcher: Watcher): number; + function addWatcher(watcher: Watcher): void; /** * remove watcher @@ -315,10 +326,13 @@ declare namespace hiSysEvent { * @systemapi hide for inner use * @permission ohos.permission.READ_DFX_SYSEVENT * @param {Watcher} watcher watch system event - * @return {number} 0 success, 1 fail + * @throws {BusinessError} 201 - Permission denied. An attempt was made to read system event forbidden by permission: ohos.permission.READ_DFX_SYSEVENT. + * @throws {BusinessError} 401 - Invalid argument. + * @throws {BusinessError} 11200201 - The watcher does not exist. + * @returns {void} return void. * @since 9 */ - function removeWatcher(watcher: Watcher): number; + function removeWatcher(watcher: Watcher): void; /** * query system event @@ -329,10 +343,16 @@ declare namespace hiSysEvent { * @param {QueryArg} queryArg common arguments of query system event * @param {QueryRule[]} rules rule of query system event * @param {Querier} querier receive query result - * @return {number} 0 success, 1 fail + * @throws {BusinessError} 201 - Permission denied. An attempt was made to read system event forbidden by permission: ohos.permission.READ_DFX_SYSEVENT. + * @throws {BusinessError} 401 - Invalid argument. + * @throws {BusinessError} 11200301 - Count of query rules is over limit. + * @throws {BusinessError} 11200302 - Invalid query rule. + * @throws {BusinessError} 11200303 - Count of concurrent queriers is over limit. + * @throws {BusinessError} 11200304 - Query frequency is over limit. + * @returns {void} return void. * @since 9 */ - function query(queryArg: QueryArg, rules: QueryRule[], querier: Querier): number; + function query(queryArg: QueryArg, rules: QueryRule[], querier: Querier): void; } -export default hiSysEvent; \ No newline at end of file +export default hiSysEvent; diff --git a/api/@ohos.hiTraceChain.d.ts b/api/@ohos.hiTraceChain.d.ts index 30d805b3722e70615b6c334b1dac219e46fe969e..4c0150cb7da926c64e5c50954f047c092ff1854c 100644 --- a/api/@ohos.hiTraceChain.d.ts +++ b/api/@ohos.hiTraceChain.d.ts @@ -152,7 +152,7 @@ declare namespace hiTraceChain { * @syscap SystemCapability.HiviewDFX.HiTrace * @param {string} name Process name. * @param {number} flags Trace function flag. - * @return {HiTraceId} Valid if first call, otherwise invalid. + * @returns {HiTraceId} Valid if first call, otherwise invalid. */ function begin(name: string, flags?: number): HiTraceId; @@ -172,7 +172,7 @@ declare namespace hiTraceChain { * * @since 8 * @syscap SystemCapability.HiviewDFX.HiTrace - * @return {HiTraceId} Valid if current thread have a trace id, otherwise invalid. + * @returns {HiTraceId} Valid if current thread have a trace id, otherwise invalid. */ function getId(): HiTraceId; @@ -198,7 +198,7 @@ declare namespace hiTraceChain { * * @since 8 * @syscap SystemCapability.HiviewDFX.HiTrace - * @return {HiTraceId} A valid span trace id. Otherwise trace id of current thread if do not allow create span. + * @returns {HiTraceId} A valid span trace id. Otherwise trace id of current thread if do not allow create span. */ function createSpan(): HiTraceId; @@ -220,7 +220,7 @@ declare namespace hiTraceChain { * @since 8 * @syscap SystemCapability.HiviewDFX.HiTrace * @param {HiTraceId} id Trace id that need to judge. - * @return {boolean} True for a valid trace id, otherwise false. + * @returns {boolean} True for a valid trace id, otherwise false. */ function isValid(id: HiTraceId): boolean; @@ -231,7 +231,7 @@ declare namespace hiTraceChain { * @syscap SystemCapability.HiviewDFX.HiTrace * @param {HiTraceId} id Trace id that need to judge. * @param {HiTraceFlag} flag Trace flag that need to judge. - * @return {boolean} true if the trace id has enabled the flag. + * @returns {boolean} true if the trace id has enabled the flag. */ function isFlagEnabled(id: HiTraceId, flag: HiTraceFlag): boolean; diff --git a/api/@ohos.hiTraceMeter.d.ts b/api/@ohos.hiTraceMeter.d.ts index d9034b7c5b45d06dd98333fa7816a3f241f22421..7884496483c7195e2c3096d69615fcff3b75548d 100644 --- a/api/@ohos.hiTraceMeter.d.ts +++ b/api/@ohos.hiTraceMeter.d.ts @@ -61,8 +61,8 @@ declare namespace hiTraceMeter { * * @since 8 * @syscap SystemCapability.HiviewDFX.HiTrace - * @param name Indicates the task name. It must be the same whith the {@code name} of startTrace. - * @param taskId The unique id used to distinguish the tasks and must be the same whith the . + * @param name Indicates the task name. It must be the same with the {@code name} of startTrace. + * @param taskId The unique id used to distinguish the tasks and must be the same with the . * {@code taskId} of startTrace. */ function finishTrace(name: string, taskId: number): void; diff --git a/api/@ohos.hichecker.d.ts b/api/@ohos.hichecker.d.ts index 678b3b6a3645f2e4c37ca65e617bced415280e8e..d35c364c5e4e243fe81733b75311f1adc6d20bb8 100644 --- a/api/@ohos.hichecker.d.ts +++ b/api/@ohos.hichecker.d.ts @@ -55,6 +55,8 @@ declare namespace hichecker { * add one or more rule. * @param rule * @since 8 + * @deprecated since 9 + * @useinstead ohos.hichecker/hichecker#addCheckRule * @syscap SystemCapability.HiviewDFX.HiChecker */ function addRule(rule: bigint) : void; @@ -63,13 +65,15 @@ declare namespace hichecker { * remove one or more rule. * @param rule * @since 8 + * @deprecated since 9 + * @useinstead ohos.hichecker/hichecker#removeCheckRule * @syscap SystemCapability.HiviewDFX.HiChecker */ function removeRule(rule: bigint) : void; /** * get added rule - * @return all added thread rule and process rule. + * @returns all added thread rule and process rule. * @since 8 * @syscap SystemCapability.HiviewDFX.HiChecker */ @@ -78,10 +82,40 @@ declare namespace hichecker { /** * whether the query rule is added * @param rule - * @return the result of whether the query rule is added. + * @returns the result of whether the query rule is added. * @since 8 + * @deprecated since 9 + * @useinstead ohos.hichecker/hichecker#containsCheckRule * @syscap SystemCapability.HiviewDFX.HiChecker */ function contains(rule: bigint) : boolean; + + /** + * Add one or more rule. + * @param rule + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiChecker + * @throws { BusinessError } 401 - the parameter check failed + */ + function addCheckRule(rule: bigint) : void; + + /** + * Remove one or more rule. + * @param rule + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiChecker + * @throws { BusinessError } 401 - the parameter check failed + */ + function removeCheckRule(rule: bigint) : void; + + /** + * Whether the query rule is added + * @param rule + * @returns the result of whether the query rule is added. + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiChecker + * @throws { BusinessError } 401 - the parameter check failed + */ + function containsCheckRule(rule: bigint) : boolean; } export default hichecker; \ No newline at end of file diff --git a/api/@ohos.hidebug.d.ts b/api/@ohos.hidebug.d.ts index f5e17b220b60315ddedd8758f66fc86027d715ca..6eea60cce99e343f107663f99d920555081fa2ac 100644 --- a/api/@ohos.hidebug.d.ts +++ b/api/@ohos.hidebug.d.ts @@ -25,7 +25,7 @@ declare namespace hidebug { /** * Get total native heap memory size * @param - - * @return Returns total native heap memory size. + * @returns Returns total native heap memory size. * @since 8 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug */ @@ -34,7 +34,7 @@ declare namespace hidebug { /** * Get Native heap memory allocation size. * @param - - * @return Returns native heap memory allocation size. + * @returns Returns native heap memory allocation size. * @since 8 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug */ @@ -43,7 +43,7 @@ declare namespace hidebug { /** * Get Native heap memory free size * @param - - * @return Returns native heap memory free size. + * @returns Returns native heap memory free size. * @since 8 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug */ @@ -52,7 +52,7 @@ declare namespace hidebug { /** * Get application process proportional set size memory information * @param - - * @return Returns application process proportional set size memory information. + * @returns Returns application process proportional set size memory information. * @since 8 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug */ @@ -61,7 +61,7 @@ declare namespace hidebug { /** * Obtains the size of the shared dirty memory of a process. * @param - - * @return Returns the size of the shared dirty memory. + * @returns Returns the size of the shared dirty memory. * @since 8 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug */ @@ -70,7 +70,7 @@ declare namespace hidebug { /** * Obtains the size of the private dirty memory of a process. * @param - - * @return Returns the size of the private dirty memory. + * @returns Returns the size of the private dirty memory. * @since 9 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug */ @@ -79,7 +79,7 @@ declare namespace hidebug { /** * Obtains the cpu usage percent of a process. * @param - - * @return Returns the cpu usage of a process. + * @returns Returns the cpu usage of a process. * @since 9 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug */ @@ -89,11 +89,13 @@ declare namespace hidebug { * Start CPU Profiling. * The input parameter is a user-defined file name, excluding the file suffix. * The generated file is in the files folder under the application directory. - * such as "/data/accounts/account_0/appdata/[package name]/files/cpuprofiler-xxx.json" + * Such as "/data/accounts/account_0/appdata/[package name]/files/cpuprofiler-xxx.json" * * @param filename Indicates the user-defined file name, excluding the file suffix. - * @return - + * @returns - * @since 8 + * @deprecated since 9 + * @useinstead ohos.hidebug/hidebug.startJsCpuProfiling * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug */ function startProfiling(filename : string) : void; @@ -103,8 +105,10 @@ declare namespace hidebug { * It takes effect only when the CPU profiler is turned on * * @param - - * @return - + * @returns - * @since 8 + * @deprecated since 9 + * @useinstead ohos.hidebug/hidebug.stopJsCpuProfiling * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug */ function stopProfiling() : void; @@ -113,24 +117,68 @@ declare namespace hidebug { * Dump JS Virtual Machine Heap Snapshot. * The input parameter is a user-defined file name, excluding the file suffix. * The generated file is in the files folder under the application directory. - * such as "/data/accounts/account_0/appdata/[package name]/files/xxx.heapsnapshot" + * Such as "/data/accounts/account_0/appdata/[package name]/files/xxx.heapsnapshot" * * @param filename Indicates the user-defined file name, excluding the file suffix. - * @return - + * @returns - * @since 8 + * @deprecated since 9 + * @useinstead ohos.hidebug/hidebug.dumpJsHeapData * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug */ function dumpHeapData(filename : string) : void; + /** + * Start CPU Profiling. + * The input parameter is a user-defined file name, excluding the file suffix. + * The generated file is in the files folder under the application directory. + * + * @param filename Indicates the user-defined file name, excluding the file suffix. + * @throws {BusinessError} 401 - the parameter check failed + * @returns - + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + */ + function startJsCpuProfiling(filename : string) : void; + + /** + * Stop CPU Profiling. + * It takes effect only when the CPU profiler is turned on + * + * @param - + * @returns - + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + */ + function stopJsCpuProfiling() : void; + + /** + * Dump JS Virtual Machine Heap Snapshot. + * The input parameter is a user-defined file name, excluding the file suffix. + * The generated file is in the files folder under the application directory. + * + * @param filename Indicates the user-defined file name, excluding the file suffix. + * @throws {BusinessError} 401 - the parameter check failed + * @returns - + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug + */ + function dumpJsHeapData(filename : string) : void; + /** * Get a debugging dump of a system service by service id. - * Not for use by third-party applications for permission. + * It need dump permission. * * @param serviceid Indicates the id of the service ability. - * @return - sa dumped file name return. + * @param fd The file descriptor. + * @param args The args list of the system ability dump interface. + * @throws {BusinessError} 401 - the parameter check failed + * @throws {BusinessError} 11400101 - the service id is invalid + * @returns - + * @permission ohos.permission.DUMP * @since 9 * @syscap SystemCapability.HiviewDFX.HiProfiler.HiDebug */ - function getServiceDump(serviceid : number) : string; + function getServiceDump(serviceid : number, fd : number, args : Array) : void; } export default hidebug; diff --git a/api/@ohos.hiviewdfx.hiAppEvent.d.ts b/api/@ohos.hiviewdfx.hiAppEvent.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..800f55cc47b6582216fd8865d6d3a4f4e4bcc0d2 --- /dev/null +++ b/api/@ohos.hiviewdfx.hiAppEvent.d.ts @@ -0,0 +1,388 @@ +/* + * 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'; + +/** + * Provides the event logging function for applications to log the fault, statistical, security, + * and user behavior events reported during running. Based on event information, + * you will be able to analyze the running status of applications. + * + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiAppEvent + */ +declare namespace hiAppEvent { + /** + * Enumerate application event types. + * + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiAppEvent + */ + enum EventType { + /** + * Fault event. + * + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiAppEvent + */ + FAULT = 1, + + /** + * Statistic event. + * + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiAppEvent + */ + STATISTIC = 2, + + /** + * Security event. + * + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiAppEvent + */ + SECURITY = 3, + + /** + * User behavior event. + * + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiAppEvent + */ + BEHAVIOR = 4 + } + + /** + * Preset event. + * + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiAppEvent + */ + namespace Event { + /** + * User login event. + * + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiAppEvent + */ + const USER_LOGIN: string; + + /** + * User logout event. + * + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiAppEvent + */ + const USER_LOGOUT: string; + + /** + * Distributed service event. + * + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiAppEvent + */ + const DISTRIBUTED_SERVICE_START: string; + } + + /** + * Preset param. + * + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiAppEvent + */ + namespace Param { + /** + * User id. + * + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiAppEvent + */ + const USER_ID: string; + + /** + * Distributed service name. + * + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiAppEvent + */ + const DISTRIBUTED_SERVICE_NAME: string; + + /** + * Distributed service instance id. + * + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiAppEvent + */ + const DISTRIBUTED_SERVICE_INSTANCE_ID: string; + } + + /** + * Application event logging configuration interface. + * + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @static + * @param {ConfigOption} config Application event logging configuration item object. + * @throws {BusinessError} 401 - Parameter error. + * @throws {BusinessError} 11103001 - Invalid max storage quota value. + */ + function configure(config: ConfigOption): void; + + /** + * Describe the options for the configuration. + * + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiAppEvent + */ + interface ConfigOption { + /** + * Configuration item: application event logging switch. + * + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiAppEvent + */ + disable?: boolean; + + /** + * Configuration item: event file directory storage quota size. + * + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiAppEvent + */ + maxStorage?: string; + } + + /** + * Definition of written application event information. + * + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiAppEvent + */ + interface AppEventInfo { + /** + * The domain of the event. + */ + domain: string; + + /** + * The name of the event. + */ + name: string; + + /** + * The type of the event. + */ + eventType: EventType; + + /** + * The params of the event. + */ + params: object; + } + + /** + * Write application event. + * + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @static + * @param {AppEventInfo} info Application event information to be written. + * @param {AsyncCallback} [callback] Callback function. + * @throws {BusinessError} 401 - Parameter error. + * @throws {BusinessError} 11100001 - Function is disabled. + * @throws {BusinessError} 11101001 - Invalid event domain. + * @throws {BusinessError} 11101002 - Invalid event name. + * @throws {BusinessError} 11101003 - Invalid number of event parameters. + * @throws {BusinessError} 11101004 - Invalid string length of the event parameter. + * @throws {BusinessError} 11101005 - Invalid event parameter name. + * @throws {BusinessError} 11101006 - Invalid array length of the event parameter. + */ + function write(info: AppEventInfo): Promise; + function write(info: AppEventInfo, callback: AsyncCallback): void; + + /** + * Definition of the read event package. + * + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiAppEvent + */ + interface AppEventPackage { + /** + * The id of the package. + */ + packageId: number; + + /** + * The number of events contained in the package. + */ + row: number; + + /** + * The total size of events contained in the package. + */ + size: number; + + /** + * The events data contained in the package. + */ + data: string[]; + } + + /** + * Definition of event holder object, which is used to read the event data monitored by the watcher. + * + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiAppEvent + */ + class AppEventPackageHolder { + /** + * Constructor for AppEventPackageHolder. + * + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @param {string} watcherName Name of the watcher to read. + */ + constructor(watcherName: string); + + /** + * Set the threshold size per read. + * + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @param {number} size Threshold size. + * @throws {BusinessError} 401 - Parameter error. + * @throws {BusinessError} 11104001 - Invalid size value. + */ + setSize(size: number): void; + + /** + * Read the event data monitored by the watcher. + * + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @returns {AppEventPackage} The read event package. + */ + takeNext(): AppEventPackage; + } + + /** + * Definition of the condition for triggering callback when the watcher monitors event data. + * + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiAppEvent + */ + interface TriggerCondition { + /** + * The number of write events that trigger callback. + */ + row?: number; + + /** + * The size of write events that trigger callback. + */ + size?: number; + + /** + * The interval for triggering callback. + */ + timeOut?: number; + } + + /** + * Definition of event filter object, which is used to filter events monitored by the watcher. + * + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiAppEvent + */ + interface AppEventFilter { + /** + * The name of the event domain to be monitored by the watcher. + */ + domain: string; + + /** + * The types of the events to be monitored by the watcher. + */ + eventTypes?: EventType[]; + } + + /** + * Definition of event watcher object, which is used to monitor written event data. + * + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiAppEvent + */ + interface Watcher { + /** + * The name of watcher. + */ + name: string; + + /** + * The condition for triggering callback. + */ + triggerCondition?: TriggerCondition; + + /** + * The event filters for monitoring events. + */ + appEventFilters?: AppEventFilter[]; + + /** + * The callback function of watcher. + */ + onTrigger?: (curRow: number, curSize: number, holder: AppEventPackageHolder) => void; + } + + /** + * Add event watcher. + * + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @static + * @param {Watcher} watcher Watcher object for monitoring events. + * @returns {AppEventPackageHolder} Holder object, which is used to read the monitoring data of the watcher. + * @throws {BusinessError} 401 - Parameter error. + * @throws {BusinessError} 11102001 - Invalid watcher name. + * @throws {BusinessError} 11102002 - Invalid filtering event domain. + * @throws {BusinessError} 11102003 - Invalid row value. + * @throws {BusinessError} 11102004 - Invalid size value. + * @throws {BusinessError} 11102005 - Invalid timeout value. + */ + function addWatcher(watcher: Watcher): AppEventPackageHolder; + + /** + * Remove event watcher. + * + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @static + * @param {Watcher} watcher Watcher object for monitoring events. + * @throws {BusinessError} 401 - Parameter error. + * @throws {BusinessError} 11102001 - Invalid watcher name. + */ + function removeWatcher(watcher: Watcher): void; + + /** + * Clear all local logging data of the application. + * + * @since 9 + * @syscap SystemCapability.HiviewDFX.HiAppEvent + * @static + */ + function clearData(): void; +} + +export default hiAppEvent; diff --git a/api/@ohos.i18n.d.ts b/api/@ohos.i18n.d.ts index f30ba8bdf14d89da73d146709c6f3ba6c001e47d..f6a4eff3af84aee05e70342ce03afda3bd896f1f 100644 --- a/api/@ohos.i18n.d.ts +++ b/api/@ohos.i18n.d.ts @@ -28,7 +28,7 @@ declare namespace i18n { * @param country The locale whose country or region name will be displayed. * @param locale The locale used to display the country or region. * @param sentenceCase Specifies whether the country or region name is displayed in sentence case. - * @return Returns the country or region name localized for display on a given locale. + * @returns Returns the country or region name localized for display on a given locale. * @since 7 * @deprecated since 9 * @useinstead ohos.System.getDisplayCountry @@ -42,7 +42,7 @@ export function getDisplayCountry(country: string, locale: string, sentenceCase? * @param language The locale whose language name will be displayed. * @param locale The locale used to display the language. * @param sentenceCase Specifies whether the language name is displayed in sentence case. - * @return Returns the language name localized for display on a given locale. + * @returns Returns the language name localized for display on a given locale. * @since 7 * @deprecated since 9 * @useinstead ohos.System.getDisplayLanguage @@ -53,7 +53,7 @@ export function getDisplayLanguage(language: string, locale: string, sentenceCas * Obtains the language currently used by the system. * * @syscap SystemCapability.Global.I18n - * @return Returns the language currently used by the system. + * @returns Returns the language currently used by the system. * @since 7 * @deprecated since 9 * @useinstead ohos.System.getSystemLanguage @@ -64,7 +64,7 @@ export function getSystemLanguage(): string; * Obtains the region currently used by the system. * * @syscap SystemCapability.Global.I18n - * @return Returns the region currently used by the system. + * @returns Returns the region currently used by the system. * @since 7 * @deprecated since 9 * @useinstead ohos.System.getSystemRegion @@ -75,7 +75,7 @@ export function getSystemRegion(): string; * Obtains the locale currently used by the system. * * @syscap SystemCapability.Global.I18n - * @return Returns the locale currently used by the system. + * @returns Returns the locale currently used by the system. * @since 7 * @deprecated since 9 * @useinstead ohos.System.getSystemLocale @@ -98,7 +98,7 @@ export class System { * @param sentenceCase Specifies whether the country or region name is displayed in sentence case. * @throws {BusinessError} 401 - check param failed * @throws {BusinessError} 890001 - param value not valid - * @return Returns the country or region name localized for display on a given locale. + * @returns Returns the country or region name localized for display on a given locale. * @since 9 */ static getDisplayCountry(country: string, locale: string, sentenceCase?: boolean): string; @@ -112,7 +112,7 @@ export class System { * @param sentenceCase Specifies whether the language name is displayed in sentence case. * @throws {BusinessError} 401 - check param failed * @throws {BusinessError} 890001 - param value not valid - * @return Returns the language name localized for display on a given locale. + * @returns Returns the language name localized for display on a given locale. * @since 9 */ static getDisplayLanguage(language: string, locale: string, sentenceCase?: boolean): string; @@ -121,7 +121,7 @@ export class System { * Obtains all languages supported by the system. * * @syscap SystemCapability.Global.I18n - * @return Returns all languages supported by the system. + * @returns Returns all languages supported by the system. * @since 9 */ static getSystemLanguages(): Array; @@ -133,7 +133,7 @@ export class System { * @param language The language used to get the list of regions. * @throws {BusinessError} 401 - check param failed * @throws {BusinessError} 890001 - param value not valid - * @return Returns all countries or regions supported by the system in the language. + * @returns Returns all countries or regions supported by the system in the language. * @since 9 */ static getSystemCountries(language: string): Array; @@ -146,7 +146,7 @@ export class System { * @param region The region code. * @throws {BusinessError} 401 - check param failed * @throws {BusinessError} 890001 - param value not valid - * @return Returns whether the current language or region is recommended. + * @returns Returns whether the current language or region is recommended. * @since 9 */ static isSuggested(language: string, region?: string): boolean; @@ -155,7 +155,7 @@ export class System { * Obtains the language currently used by the system. * * @syscap SystemCapability.Global.I18n - * @return Returns the language currently used by the system. + * @returns Returns the language currently used by the system. * @since 9 */ static getSystemLanguage(): string; @@ -177,7 +177,7 @@ export class System { * Obtains the region currently used by the system. * * @syscap SystemCapability.Global.I18n - * @return Returns the region currently used by the system. + * @returns Returns the region currently used by the system. * @since 9 */ static getSystemRegion(): string; @@ -200,7 +200,7 @@ export class System { * Obtains the locale currently used by the system. * * @syscap SystemCapability.Global.I18n - * @return Returns the locale currently used by the system. + * @returns Returns the locale currently used by the system. * @since 9 */ static getSystemLocale(): string; @@ -223,7 +223,7 @@ export class System { * Check out whether system is 24-hour system. * * @syscap SystemCapability.Global.I18n - * @return Returns a boolean represent whether system is 24-hour system. + * @returns Returns a boolean represent whether system is 24-hour system. * @since 9 */ static is24HourClock(): boolean; @@ -275,7 +275,7 @@ export class System { * Access the system preferred language list. * * @syscap SystemCapability.Global.I18n - * @return Returns a string Array represent the preferred language list. + * @returns Returns a string Array represent the preferred language list. * @since 9 */ static getPreferredLanguageList(): Array; @@ -284,7 +284,7 @@ export class System { * Get the first preferred language of system. * * @syscap SystemCapability.Global.I18n - * @return Returns a string represent the first preferred language of system. + * @returns Returns a string represent the first preferred language of system. * @since 9 */ static getFirstPreferredLanguage(): string; @@ -293,7 +293,7 @@ export class System { * Get the preferred language of App. * * @syscap SystemCapability.Global.I18n - * @return Returns a string represent the preferred language of App. + * @returns Returns a string represent the preferred language of App. * @since 9 */ static getAppPreferredLanguage(): string; @@ -316,7 +316,7 @@ export class System { * Get whether to use local digit. * * @syscap SystemCapability.Global.I18n - * @return Returns a boolean represents whether to use local digit. + * @returns Returns a boolean represents whether to use local digit. * @since 9 */ static getUsingLocalDigit(): boolean; @@ -328,7 +328,7 @@ export class System { * @syscap SystemCapability.Global.I18n * @since 8 * @deprecated since 9 - * @useinstead I18NUitl + * @useinstead I18NUtil */ export interface Util { /** @@ -373,7 +373,7 @@ export interface Util { * * @syscap SystemCapability.Global.I18n * @param { string } locale - Information of the locale - * @return Returns the string of 'y', 'L', 'd' joined by '-'. + * @returns Returns the string of 'y', 'L', 'd' joined by '-'. * @since 9 */ static getDateOrder(locale: string): string; @@ -437,11 +437,11 @@ export class PhoneNumberFormat { constructor(country: string, options?: PhoneNumberFormatOptions); /** - * Judges whether phone number is valid. + * Judge whether phone number is valid. * * @syscap SystemCapability.Global.I18n - * @param number Indicates the input phone number to be judged. - * @return Returns a boolean indicates whether the input phone number is valid. + * @param number Indicates the input phone number. + * @returns Returns a boolean indicates whether the input phone number is valid. * @since 8 */ isValidNumber(number: string): boolean; @@ -451,7 +451,7 @@ export class PhoneNumberFormat { * * @syscap SystemCapability.Global.I18n * @param number Indicates the input phone number to be formatted. - * @return Returns the formatted phone number. + * @returns Returns the formatted phone number. * @since 8 */ format(number: string): string; @@ -462,7 +462,7 @@ export class PhoneNumberFormat { * @syscap SystemCapability.Global.I18n * @param number input phone number. * @param locale locale ID. - * @return Returns a string represents phone number's location. + * @returns Returns a string represents phone number's location. * @since 9 */ getLocationName(number: string, locale: string): string; @@ -475,7 +475,7 @@ export class PhoneNumberFormat { * @param locale The locale used to get calendar. * @param type If type is not specified, get locale's default Calendar, else get the specified type of Calendar. * such as buddhist, chinese, coptic, ethiopic, hebrew, gregory, indian, islamic_civil, islamic_tbla, islamic_umalqura, - * japanese, persion. + * japanese, persian. * @since 8 */ export function getCalendar(locale: string, type?: string): Calendar; @@ -526,7 +526,7 @@ export class Calendar { * Get the timezone id of this calendar instance. * * @syscap SystemCapability.Global.I18n - * @return Returns the timezone id of this calendar. + * @returns Returns the timezone id of this calendar. * @since 8 */ getTimeZone(): string; @@ -535,7 +535,7 @@ export class Calendar { * Get the start day of a week. 1 indicates Sunday, 7 indicates Saturday. * * @syscap SystemCapability.Global.I18n - * @return Returns start day of a week. + * @returns Returns start day of a week. * @since 8 */ getFirstDayOfWeek(): number; @@ -553,7 +553,7 @@ export class Calendar { * Get the minimal days of a week, which is needed for the first day of a year. * * @syscap SystemCapability.Global.I18n - * @return Returns the minimal days of a week. + * @returns Returns the minimal days of a week. * @since 8 */ getMinimalDaysInFirstWeek(): number; @@ -574,7 +574,7 @@ export class Calendar { * @param field Field values such as era, year, month, week_of_year, week_of_month, date, day_of_year, day_of_week * day_of_week_in_month, hour, hour_of_day, minute, second, millisecond, zone_offset, dst_offset, year_woy, * dow_local, extended_year, julian_day, milliseconds_in_day, is_leap_month. - * @return Return the associated value. + * @returns Return the associated value. * @since 8 */ get(field: string): number; @@ -584,7 +584,7 @@ export class Calendar { * * @syscap SystemCapability.Global.I18n * @param locale Locale used to get the localized name for this calendar. - * @return Returns the localized name of this calendar. + * @returns Returns the localized name of this calendar. * @since 8 */ getDisplayName(locale: string): string; @@ -595,7 +595,7 @@ export class Calendar { * * @syscap SystemCapability.Global.I18n * @param date Date object whose attribute is desired. - * @return Returns whether the date is a weekend day. + * @returns Returns whether the date is a weekend day. * @since 8 */ isWeekend(date?: Date): boolean; @@ -606,7 +606,7 @@ export class Calendar { * * @syscap SystemCapability.Global.I18n * @param locale The locale to be used. - * @return Returns true representing the locale is an RTL locale + * @returns Returns true representing the locale is an RTL locale * * @since 7 */ @@ -617,7 +617,7 @@ export function isRTL(locale: string): boolean; * * @syscap SystemCapability.Global.I18n * @param locale the returned BreakIterator will adapt the rule, specified by the locale, to break text. - * @return Returns a newly constructed BreakIterator object. + * @returns Returns a newly constructed BreakIterator object. * @since 8 */ export function getLineInstance(locale: string): BreakIterator; @@ -633,7 +633,7 @@ export class BreakIterator { * Obtains the current position of the BreakIterator instance. * * @syscap SystemCapability.Global.I18n - * @return Returns the current position of the BreakIterator instance. + * @returns Returns the current position of the BreakIterator instance. * @since 8 */ current(): number; @@ -643,7 +643,7 @@ export class BreakIterator { * processed text. * * @syscap SystemCapability.Global.I18n - * @return Returns the index of the first break point. + * @returns Returns the index of the first break point. * @since 8 */ first(): number; @@ -653,26 +653,26 @@ export class BreakIterator { * last character of the processed text. * * @syscap SystemCapability.Global.I18n - * @return Returns the index of the last break point. + * @returns Returns the index of the last break point. * @since 8 */ last(): number; /** - * Set the BreakItertor's position to the nth break point from the current break point. + * Set the BreakIterator's position to the nth break point from the current break point. * * @syscap SystemCapability.Global.I18n * @param index indicates the number of break points to advance. If index is not given, n is treated as 1. - * @return Returns the index of the BreakIterator after moving. If there is not enough break points, returns -1. + * @returns Returns the index of the BreakIterator after moving. If there is not enough break points, returns -1. * @since 8 */ next(index?: number): number; /** - * Set the BreakItertor's position to the break point preceding the current break point. + * Set the BreakIterator's position to the break point preceding the current break point. * * @syscap SystemCapability.Global.I18n - * @return Returns the index of the BreakIterator after moving. If there is not enough break points, returns -1. + * @returns Returns the index of the BreakIterator after moving. If there is not enough break points, returns -1. * @since 8 */ previous(): number; @@ -690,7 +690,7 @@ export class BreakIterator { * Set the BreakIterator's position to the first break point following the specified offset. * * @syscap SystemCapability.Global.I18n - * @return Returns the index of the BreakIterator after moving. If there is not enough break points, returns -1. + * @returns Returns the index of the BreakIterator after moving. If there is not enough break points, returns -1. * @since 8 */ following(offset: number): number; @@ -699,7 +699,7 @@ export class BreakIterator { * Obtains the text being processed. * * @syscap SystemCapability.Global.I18n - * @return Returns the text that is processed by the BreakIterator. + * @returns Returns the text that is processed by the BreakIterator. * @since 8 */ getLineBreakText(): string; @@ -711,7 +711,7 @@ export class BreakIterator { * * @syscap SystemCapability.Global.I18n * @param offset The offset to be checked. - * @return Returns true if the offset is a break point. + * @returns Returns true if the offset is a break point. * @since 8 */ isBoundary(offset: number): boolean; @@ -723,7 +723,7 @@ export class BreakIterator { * @syscap SystemCapability.Global.I18n * @param locale Indicates a character string containing the locale information, including * the language and optionally the script and region, for the NumberFormat object. - * @return Returns IndexUtil object. + * @returns Returns IndexUtil object. * @since 8 */ export function getInstance(locale?:string): IndexUtil; @@ -740,7 +740,7 @@ export class IndexUtil { * Get a list of labels for use as a UI index * * @syscap SystemCapability.Global.I18n - * @return Returns a list of labels + * @returns Returns a list of labels * @since 8 */ getIndexList(): Array; @@ -778,7 +778,7 @@ export class Character { * * @syscap SystemCapability.Global.I18n * @param char the character to be tested - * @return Returns true if the character is a digit character + * @returns Returns true if the character is a digit character * @since 8 * @deprecated since 9 * @useinstead Unicode.isDigit @@ -790,7 +790,7 @@ export class Character { * * @syscap SystemCapability.Global.I18n * @param char the character to be tested - * @return Returns true if the character is a space character + * @returns Returns true if the character is a space character * @since 8 * @deprecated since 9 * @useinstead Unicode.isSpaceChar @@ -802,7 +802,7 @@ export class Character { * * @syscap SystemCapability.Global.I18n * @param char the character to be tested - * @return Returns true if the character is a whitespace character + * @returns Returns true if the character is a whitespace character * @since 8 * @deprecated since 9 * @useinstead Unicode.isWhitespace @@ -814,7 +814,7 @@ export class Character { * * @syscap SystemCapability.Global.I18n * @param char the character to be tested - * @return Returns true if the character is a RTL character + * @returns Returns true if the character is a RTL character * @since 8 * @deprecated since 9 * @useinstead Unicode.isRTL @@ -826,7 +826,7 @@ export class Character { * * @syscap SystemCapability.Global.I18n * @param char the character to be tested - * @return Returns true if the character is a Ideographic character + * @returns Returns true if the character is a Ideographic character * @since 8 * @deprecated since 9 * @useinstead Unicode.isIdeograph @@ -838,7 +838,7 @@ export class Character { * * @syscap SystemCapability.Global.I18n * @param char the character to be tested - * @return Returns true if the character is a Letter + * @returns Returns true if the character is a Letter * @since 8 * @deprecated since 9 * @useinstead Unicode.isLetter @@ -850,7 +850,7 @@ export class Character { * * @syscap SystemCapability.Global.I18n * @param char the character to be tested - * @return Returns true if the character is a LowerCase character + * @returns Returns true if the character is a LowerCase character * @since 8 * @deprecated since 9 * @useinstead Unicode.isLowerCase @@ -862,7 +862,7 @@ export class Character { * * @syscap SystemCapability.Global.I18n * @param char the character to be tested - * @return Returns true if the character is a UpperCase character + * @returns Returns true if the character is a UpperCase character * @since 8 * @deprecated since 9 * @useinstead Unicode.isUpperCase @@ -874,7 +874,7 @@ export class Character { * * @syscap SystemCapability.Global.I18n * @param char the character to be tested - * @return Returns the general category of the specified character. + * @returns Returns the general category of the specified character. * @since 8 * @deprecated since 9 * @useinstead Unicode.getType @@ -894,7 +894,7 @@ export class Character { * * @syscap SystemCapability.Global.I18n * @param { string } char - the character to be tested - * @return Returns true if the character is a digit character + * @returns Returns true if the character is a digit character * @since 9 */ static isDigit(char: string): boolean; @@ -904,7 +904,7 @@ export class Character { * * @syscap SystemCapability.Global.I18n * @param { string } char - the character to be tested - * @return Returns true if the character is a space character + * @returns Returns true if the character is a space character * @since 9 */ static isSpaceChar(char: string): boolean; @@ -914,7 +914,7 @@ export class Character { * * @syscap SystemCapability.Global.I18n * @param { string } char - the character to be tested - * @return Returns true if the character is a whitespace character + * @returns Returns true if the character is a whitespace character * @since 9 */ static isWhitespace(char: string): boolean; @@ -924,7 +924,7 @@ export class Character { * * @syscap SystemCapability.Global.I18n * @param { string } char - the character to be tested - * @return Returns true if the character is a RTL character + * @returns Returns true if the character is a RTL character * @since 9 */ static isRTL(char: string): boolean; @@ -934,7 +934,7 @@ export class Character { * * @syscap SystemCapability.Global.I18n * @param { string } char - the character to be tested - * @return Returns true if the character is a Ideographic character + * @returns Returns true if the character is a Ideographic character * @since 9 */ static isIdeograph(char: string): boolean; @@ -944,7 +944,7 @@ export class Character { * * @syscap SystemCapability.Global.I18n * @param { string } char - the character to be tested - * @return Returns true if the character is a Letter + * @returns Returns true if the character is a Letter * @since 9 */ static isLetter(char: string): boolean; @@ -954,7 +954,7 @@ export class Character { * * @syscap SystemCapability.Global.I18n * @param { string } char - the character to be tested - * @return Returns true if the character is a LowerCase character + * @returns Returns true if the character is a LowerCase character * @since 9 */ static isLowerCase(char: string): boolean; @@ -964,7 +964,7 @@ export class Character { * * @syscap SystemCapability.Global.I18n * @param { string } char - the character to be tested - * @return Returns true if the character is a UpperCase character + * @returns Returns true if the character is a UpperCase character * @since 9 */ static isUpperCase(char: string): boolean; @@ -974,7 +974,7 @@ export class Character { * * @syscap SystemCapability.Global.I18n * @param { string } char - the character to be tested - * @return Returns the general category of the specified character. + * @returns Returns the general category of the specified character. * @since 9 */ static getType(char: string): string; @@ -984,7 +984,7 @@ export class Character { * check out whether system is 24-hour system. * * @syscap SystemCapability.Global.I18n - * @return Returns a boolean represent whether system is 24-hour system. + * @returns Returns a boolean represent whether system is 24-hour system. * @since 7 * @deprecated since 9 * @useinstead ohos.System.is24HourClock @@ -997,7 +997,7 @@ export class Character { * @permission ohos.permission.UPDATE_CONFIGURATION * @syscap SystemCapability.Global.I18n * @param option represent the boolean to be set. - * @return Returns a boolean represent whether setting 24-hour system success. + * @returns Returns a boolean represent whether setting 24-hour system success. * @since 7 * @deprecated since 9 * @useinstead ohos.System.set24HourClock @@ -1011,7 +1011,7 @@ export class Character { * @syscap SystemCapability.Global.I18n * @param language the language to be added. * @param index the position of preferred language list to be inserted. - * @return Returns a boolean represent whether language added success. + * @returns Returns a boolean represent whether language added success. * @since 8 * @deprecated since 9 * @useinstead ohos.System.addPreferredLanguage @@ -1024,7 +1024,7 @@ export function addPreferredLanguage(language: string, index?: number): boolean; * @permission ohos.permission.UPDATE_CONFIGURATION * @syscap SystemCapability.Global.I18n * @param index the position of removed language in preferred language list. - * @return Returns a boolean represent whether removed success. + * @returns Returns a boolean represent whether removed success. * @since 8 * @deprecated since 9 * @useinstead ohos.System.removePreferredLanguage @@ -1035,7 +1035,7 @@ export function removePreferredLanguage(index: number): boolean; * Access the system preferred language list. * * @syscap SystemCapability.Global.I18n - * @return Returns a string Array represent the preferred language list. + * @returns Returns a string Array represent the preferred language list. * @since 8 * @deprecated since 9 * @useinstead ohos.System.getPreferredLanguageList @@ -1046,7 +1046,7 @@ export function getPreferredLanguageList(): Array; * Get the first preferred language of system. * * @syscap SystemCapability.Global.I18n - * @return Returns a string represent the first preferred language of system. + * @returns Returns a string represent the first preferred language of system. * @since 8 * @deprecated since 9 * @useinstead ohos.System.getFirstPreferredLanguage @@ -1058,7 +1058,7 @@ export function getFirstPreferredLanguage(): string; * * @syscap SystemCapability.Global.I18n * @param zoneID TimeZone ID used to create TimeZone Object. - * @return Returns a TimeZone object corresponds to zoneID. + * @returns Returns a TimeZone object corresponds to zoneID. * @since 7 */ export function getTimeZone(zoneID?: string): TimeZone; @@ -1074,7 +1074,7 @@ export class TimeZone { * Get the id of the TimeZone object. * * @syscap SystemCapability.Global.I18n - * @return Returns a string represents the timezone id. + * @returns Returns a string represents the timezone id. * @since 7 */ getID(): string; @@ -1084,8 +1084,8 @@ export class TimeZone { * * @syscap SystemCapability.Global.I18n * @param locale the locale tag use to display timezone object's name. - * @param isDST wether conside daylight saving time when display timezone object's name. - * @return Returns a string represents the display name. + * @param isDST wether consider daylight saving time when display timezone object's name. + * @returns Returns a string represents the display name. * @since 7 */ getDisplayName(locale?: string, isDST?: boolean): string; @@ -1094,7 +1094,7 @@ export class TimeZone { * Get the raw offset of the TimeZone object. * * @syscap SystemCapability.Global.I18n - * @return Returns a number represents the raw offset. + * @returns Returns a number represents the raw offset. * @since 7 */ getRawOffset(): number; @@ -1103,8 +1103,8 @@ export class TimeZone { * Get the offset of the TimeZone object. * * @syscap SystemCapability.Global.I18n - * @date Indicates a date use to compute offset. - * @return Returns a number represents the offset with date. + * @param date Indicates a date use to compute offset. + * @returns Returns a number represents the offset with date. * @since 7 */ getOffset(date?: number): number; @@ -1113,7 +1113,7 @@ export class TimeZone { * Get available TimeZone ID list. * * @syscap SystemCapability.Global.I18n - * @return Returns a string array represents the available TimeZone ID list. + * @returns Returns a string array represents the available TimeZone ID list. * @since 9 */ static getAvailableIDs(): Array; @@ -1122,7 +1122,7 @@ export class TimeZone { * Get available Zone City ID list. * * @syscap SystemCapability.Global.I18n - * @return Returns a string array represents the available Zone City ID list. + * @returns Returns a string array represents the available Zone City ID list. * @since 9 */ static getAvailableZoneCityIDs(): Array; @@ -1133,7 +1133,7 @@ export class TimeZone { * @syscap SystemCapability.Global.I18n * @param cityID Zone City ID. * @param locale locale used to display city name. - * @return Returns a string represents the display name of City in locale. + * @returns Returns a string represents the display name of City in locale. * @since 9 */ static getCityDisplayName(cityID: string, locale: string): string; @@ -1143,7 +1143,7 @@ export class TimeZone { * * @syscap SystemCapability.Global.I18n * @param cityID Zone City ID. - * @return Returns a TimeZone Object from city ID. + * @returns Returns a TimeZone Object from city ID. * @since 9 */ static getTimezoneFromCity(cityID: string): TimeZone; @@ -1160,7 +1160,7 @@ export class Transliterator { * Get a string array of all available transliterator ids. * * @syscap SystemCapability.Global.I18n - * @return Returns a string array of all available transliterator ids. + * @returns Returns a string array of all available transliterator ids. * @since 9 */ static getAvailableIDs(): string[]; @@ -1169,10 +1169,10 @@ export class Transliterator { * Get a Transliterator that is specified by id name. * * @syscap SystemCapability.Global.I18n - * @param id specified the type of Transliterator. id is formed by source and dest. Transliterator will tranliste + * @param id specified the type of Transliterator. id is formed by source and dest. Transliterator will transliterate * the input string from source format to the dest format. For example, a Simplified Chinese to Latn * Transliterator will transform the text written in Chinese to Latn characters. - * @return Returns Transliterator that is specified by id name. + * @returns Returns Transliterator that is specified by id name. * @since 9 */ static getInstance(id: string): Transliterator; @@ -1182,7 +1182,7 @@ export class Transliterator { * * @syscap SystemCapability.Global.I18n * @param id text to be transliterated. - * @return Returns the output text that is tranlisterated from source format to the dest format. + * @returns Returns the output text that is transliterated from source format to the dest format. * @since 9 */ transform(text: string): string; diff --git a/api/@ohos.inputmethod.d.ts b/api/@ohos.inputmethod.d.ts index b551539641e0cf31f9e9d55d2575d4b930b6521b..55afa0702a5b298be51da8345ace0560d922540b 100644 --- a/api/@ohos.inputmethod.d.ts +++ b/api/@ohos.inputmethod.d.ts @@ -23,90 +23,6 @@ import InputMethodSubtype from './@ohos.inputMethodSubtype'; * @syscap SystemCapability.MiscServices.InputMethodFramework */ declare namespace inputMethod { - /** - * Errorcode 201. The permissions check fails. - * @syscap SystemCapability.MiscServices.InputMethodFramework - * @since 9 - */ - const EXCEPTION_PERMISSION: number; - - /** - * Errorcode 401. The parameters check fails. - * @syscap SystemCapability.MiscServices.InputMethodFramework - * @since 9 - */ - const EXCEPTION_PARAMCHECK: number; - - /** - * Errorcode 801. Call unsupported api. - * @syscap SystemCapability.MiscServices.InputMethodFramework - * @since 9 - */ - const EXCEPTION_UNSUPPORTED: number; - - /** - * Errorcode 12800001. Package manager error. - * @syscap SystemCapability.MiscServices.InputMethodFramework - * @since 9 - */ - const EXCEPTION_PACKAGEMANAGER: number; - - /** - * Errorcode 12800002. Input method engine error. - * @syscap SystemCapability.MiscServices.InputMethodFramework - * @since 9 - */ - const EXCEPTION_IMENGINE: number; - - /** - * Errorcode 12800003. Input method client error. - * @syscap SystemCapability.MiscServices.InputMethodFramework - * @since 9 - */ - const EXCEPTION_IMCLIENT: number; - - /** - * Errorcode 12800004. Key event processing error. - * @syscap SystemCapability.MiscServices.InputMethodFramework - * @since 9 - */ - const EXCEPTION_KEYEVENT: number; - - /** - * Errorcode 12800005. Configuration persisting error. - * @syscap SystemCapability.MiscServices.InputMethodFramework - * @since 9 - */ - const EXCEPTION_CONFPERSIST: number; - - /** - * Errorcode 12800006. Input method controller error. - * @syscap SystemCapability.MiscServices.InputMethodFramework - * @since 9 - */ - const EXCEPTION_CONTROLLER: number; - - /** - * Errorcode 12800007. Input method settings extension error. - * @syscap SystemCapability.MiscServices.InputMethodFramework - * @since 9 - */ - const EXCEPTION_SETTINGS: number; - - /** - * Errorcode 12800008. Input method manager service error. - * @syscap SystemCapability.MiscServices.InputMethodFramework - * @since 9 - */ - const EXCEPTION_IMMS: number; - - /** - * Errorcode 12899999. Others error. - * @syscap SystemCapability.MiscServices.InputMethodFramework - * @since 9 - */ - const EXCEPTION_OTHERS: number; - /** * Keyboard max number * @since 8 @@ -133,11 +49,8 @@ declare namespace inputMethod { * Input method setting * @since 9 * @return :- - * @throws {BusinessError} 201 - permissions check fails. - * @throws {BusinessError} 401 - parameter error. * @throws {BusinessError} 12800007 - settings extension error. * @syscap SystemCapability.MiscServices.InputMethodFramework - * @StageModelOnly */ function getSetting(): InputMethodSetting; @@ -145,11 +58,8 @@ declare namespace inputMethod { * Input method controller * @since 9 * @return :- - * @throws {BusinessError} 201 - permissions check fails. - * @throws {BusinessError} 401 - parameter error. * @throws {BusinessError} 12800006 - input method controller error. * @syscap SystemCapability.MiscServices.InputMethodFramework - * @StageModelOnly */ function getController(): InputMethodController; @@ -161,10 +71,9 @@ declare namespace inputMethod { * @permission ohos.permission.CONNECT_IME_ABILITY * @throws {BusinessError} 201 - permissions check fails. * @throws {BusinessError} 401 - parameter error. - * @throws {BusinessError} 12800007 - settings extension error. * @throws {BusinessError} 12800005 - configuration persisting error. + * @throws {BusinessError} 12800008 - input method manager service error. * @syscap SystemCapability.MiscServices.InputMethodFramework - * @StageModelOnly */ function switchInputMethod(target: InputMethodProperty, callback: AsyncCallback): void; @@ -176,10 +85,9 @@ declare namespace inputMethod { * @permission ohos.permission.CONNECT_IME_ABILITY * @throws {BusinessError} 201 - permissions check fails. * @throws {BusinessError} 401 - parameter error. - * @throws {BusinessError} 12800007 - settings extension error. * @throws {BusinessError} 12800005 - configuration persisting error. + * @throws {BusinessError} 12800008 - input method manager service error. * @syscap SystemCapability.MiscServices.InputMethodFramework - * @StageModelOnly */ function switchInputMethod(target: InputMethodProperty): Promise; @@ -187,11 +95,7 @@ declare namespace inputMethod { * Get current input method * @since 9 * @return The InputMethodProperty object of the current input method - * @throws {BusinessError} 201 - permissions check fails. - * @throws {BusinessError} 401 - parameter error. - * @throws {BusinessError} 12800007 - settings extension error. * @syscap SystemCapability.MiscServices.InputMethodFramework - * @StageModelOnly */ function getCurrentInputMethod(): InputMethodProperty; @@ -204,9 +108,8 @@ declare namespace inputMethod { * @throws {BusinessError} 201 - permissions check fails. * @throws {BusinessError} 401 - parameter error. * @throws {BusinessError} 12800005 - configuration persisting error. - * @throws {BusinessError} 12800007 - settings extension error. + * @throws {BusinessError} 12800008 - input method manager service error. * @syscap SystemCapability.MiscServices.InputMethodFramework - * @StageModelOnly */ function switchCurrentInputMethodSubtype(target: InputMethodSubtype, callback: AsyncCallback): void; @@ -219,9 +122,8 @@ declare namespace inputMethod { * @throws {BusinessError} 201 - permissions check fails. * @throws {BusinessError} 401 - parameter error. * @throws {BusinessError} 12800005 - configuration persisting error. - * @throws {BusinessError} 12800007 - settings extension error. + * @throws {BusinessError} 12800008 - input method manager service error. * @syscap SystemCapability.MiscServices.InputMethodFramework - * @StageModelOnly */ function switchCurrentInputMethodSubtype(target: InputMethodSubtype): Promise; @@ -229,11 +131,7 @@ declare namespace inputMethod { * Get the current input method subtype * @since 9 * @return The InputMethodSubtype object of the current input method - * @throws {BusinessError} 201 - permissions check fails. - * @throws {BusinessError} 401 - parameter error. - * @throws {BusinessError} 12800007 - settings extension error. * @syscap SystemCapability.MiscServices.InputMethodFramework - * @StageModelOnly */ function getCurrentInputMethodSubtype(): InputMethodSubtype; @@ -247,9 +145,8 @@ declare namespace inputMethod { * @throws {BusinessError} 201 - permissions check fails. * @throws {BusinessError} 401 - parameter error. * @throws {BusinessError} 12800005 - configuration persisting error. - * @throws {BusinessError} 12800007 - settings extension error. + * @throws {BusinessError} 12800008 - input method manager service error. * @syscap SystemCapability.MiscServices.InputMethodFramework - * @StageModelOnly */ function switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype, callback: AsyncCallback): void; @@ -263,9 +160,8 @@ declare namespace inputMethod { * @throws {BusinessError} 201 - permissions check fails. * @throws {BusinessError} 401 - parameter error. * @throws {BusinessError} 12800005 - configuration persisting error. - * @throws {BusinessError} 12800007 - settings extension error. + * @throws {BusinessError} 12800008 - input method manager service error. * @syscap SystemCapability.MiscServices.InputMethodFramework - * @StageModelOnly */ function switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype): Promise; @@ -296,12 +192,10 @@ declare namespace inputMethod { * @since 9 * @param inputMethodProperty Indicates the specified input method * @return :- - * @throws {BusinessError} 201 - permissions check fails. * @throws {BusinessError} 401 - parameter error. * @throws {BusinessError} 12800001 - package manager error. * @throws {BusinessError} 12800008 - input method manager service error. * @syscap SystemCapability.MiscServices.InputMethodFramework - * @StageModelOnly */ listInputMethodSubtype(inputMethodProperty: InputMethodProperty, callback: AsyncCallback>): void; @@ -310,12 +204,10 @@ declare namespace inputMethod { * @since 9 * @param inputMethodProperty Indicates the specified input method * @return :- - * @throws {BusinessError} 201 - permissions check fails. * @throws {BusinessError} 401 - parameter error. * @throws {BusinessError} 12800001 - package manager error. * @throws {BusinessError} 12800008 - input method manager service error. * @syscap SystemCapability.MiscServices.InputMethodFramework - * @StageModelOnly */ listInputMethodSubtype(inputMethodProperty: InputMethodProperty): Promise>; @@ -323,12 +215,9 @@ declare namespace inputMethod { * List subtype of current input method * @since 9 * @return :- - * @throws {BusinessError} 201 - permissions check fails. - * @throws {BusinessError} 401 - parameter error. * @throws {BusinessError} 12800001 - package manager error. * @throws {BusinessError} 12800008 - input method manager service error. * @syscap SystemCapability.MiscServices.InputMethodFramework - * @StageModelOnly */ listCurrentInputMethodSubtype(callback: AsyncCallback>): void; @@ -336,12 +225,9 @@ declare namespace inputMethod { * List subtype of current input method * @since 9 * @return :- - * @throws {BusinessError} 201 - permissions check fails. - * @throws {BusinessError} 401 - parameter error. * @throws {BusinessError} 12800001 - package manager error. * @throws {BusinessError} 12800008 - input method manager service error. * @syscap SystemCapability.MiscServices.InputMethodFramework - * @StageModelOnly */ listCurrentInputMethodSubtype(): Promise>; @@ -352,12 +238,10 @@ declare namespace inputMethod { * If true, collect enabled input methods. * If false, collect disabled input methods. * @return :- - * @throws {BusinessError} 201 - permissions check fails. * @throws {BusinessError} 401 - parameter error. * @throws {BusinessError} 12800001 - package manager error. * @throws {BusinessError} 12800008 - input method manager service error. * @syscap SystemCapability.MiscServices.InputMethodFramework - * @StageModelOnly */ getInputMethods(enable: boolean, callback: AsyncCallback>): void; @@ -368,12 +252,10 @@ declare namespace inputMethod { * If true, collect enabled input methods. * If false, collect disabled input methods. * @return :- - * @throws {BusinessError} 201 - permissions check fails. * @throws {BusinessError} 401 - parameter error. * @throws {BusinessError} 12800001 - package manager error. * @throws {BusinessError} 12800008 - input method manager service error. * @syscap SystemCapability.MiscServices.InputMethodFramework - * @StageModelOnly */ getInputMethods(enable: boolean): Promise>; @@ -396,13 +278,8 @@ declare namespace inputMethod { * @return :- * @permission ohos.permission.CONNECT_IME_ABILITY * @throws {BusinessError} 201 - permissions check fails. - * @throws {BusinessError} 401 - parameter error. - * @throws {BusinessError} 12800001 - package manager error. - * @throws {BusinessError} 12800007 - settings extension error. - * @throws {BusinessError} 12800005 - configuration persisting error. * @throws {BusinessError} 12800008 - input method manager service error. * @syscap SystemCapability.MiscServices.InputMethodFramework - * @StageModelOnly */ showOptionalInputMethods(callback: AsyncCallback): void; @@ -412,13 +289,8 @@ declare namespace inputMethod { * @return - * @permission ohos.permission.CONNECT_IME_ABILITY * @throws {BusinessError} 201 - permissions check fails. - * @throws {BusinessError} 401 - parameter error. - * @throws {BusinessError} 12800001 - package manager error. - * @throws {BusinessError} 12800005 - configuration persisting error. - * @throws {BusinessError} 12800007 - settings extension error. * @throws {BusinessError} 12800008 - input method manager service error. * @syscap SystemCapability.MiscServices.InputMethodFramework - * @StageModelOnly */ showOptionalInputMethods(): Promise; @@ -446,8 +318,7 @@ declare namespace inputMethod { * @since 9 * @return :- * @throws {BusinessError} 201 - permissions check fails. - * @throws {BusinessError} 401 - parameter error. - * @throws {BusinessError} 12800002 - input method engine error. + * @throws {BusinessError} 12800003 - input method client error. * @throws {BusinessError} 12800008 - input method manager service error. * @syscap SystemCapability.MiscServices.InputMethodFramework */ @@ -458,8 +329,7 @@ declare namespace inputMethod { * @since 9 * @return :- * @throws {BusinessError} 201 - permissions check fails. - * @throws {BusinessError} 401 - parameter error. - * @throws {BusinessError} 12800002 - input method engine error. + * @throws {BusinessError} 12800003 - input method client error. * @throws {BusinessError} 12800008 - input method manager service error. * @syscap SystemCapability.MiscServices.InputMethodFramework */ @@ -491,8 +361,7 @@ declare namespace inputMethod { * @return :- * @permission ohos.permission.CONNECT_IME_ABILITY * @throws {BusinessError} 201 - permissions check fails. - * @throws {BusinessError} 401 - parameter error. - * @throws {BusinessError} 12800002 - input method engine error. + * @throws {BusinessError} 12800003 - input method client error. * @throws {BusinessError} 12800008 - input method manager service error. * @syscap SystemCapability.MiscServices.InputMethodFramework */ @@ -504,8 +373,7 @@ declare namespace inputMethod { * @return :- * @permission ohos.permission.CONNECT_IME_ABILITY * @throws {BusinessError} 201 - permissions check fails. - * @throws {BusinessError} 401 - parameter error. - * @throws {BusinessError} 12800002 - input method engine error. + * @throws {BusinessError} 12800003 - input method client error. * @throws {BusinessError} 12800008 - input method manager service error. * @syscap SystemCapability.MiscServices.InputMethodFramework */ @@ -517,8 +385,7 @@ declare namespace inputMethod { * @return :- * @permission ohos.permission.CONNECT_IME_ABILITY * @throws {BusinessError} 201 - permissions check fails. - * @throws {BusinessError} 401 - parameter error. - * @throws {BusinessError} 12800002 - input method engine error. + * @throws {BusinessError} 12800003 - input method client error. * @throws {BusinessError} 12800008 - input method manager service error. * @syscap SystemCapability.MiscServices.InputMethodFramework */ @@ -530,8 +397,7 @@ declare namespace inputMethod { * @return :- * @permission ohos.permission.CONNECT_IME_ABILITY * @throws {BusinessError} 201 - permissions check fails. - * @throws {BusinessError} 401 - parameter error. - * @throws {BusinessError} 12800002 - input method engine error. + * @throws {BusinessError} 12800003 - input method client error. * @throws {BusinessError} 12800008 - input method manager service error. * @syscap SystemCapability.MiscServices.InputMethodFramework */ @@ -566,14 +432,14 @@ declare namespace inputMethod { * @since 9 * @syscap SystemCapability.MiscServices.InputMethodFramework */ - readonly name?: string; + readonly name: string; /** * The id of input method * @since 9 * @syscap SystemCapability.MiscServices.InputMethodFramework */ - readonly id?: string; + readonly id: string; /** * The label of input method @@ -601,7 +467,7 @@ declare namespace inputMethod { * @since 9 * @syscap SystemCapability.MiscServices.InputMethodFramework */ - extra?: object; + extra: object; } } diff --git a/api/@ohos.inputmethodengine.d.ts b/api/@ohos.inputmethodengine.d.ts index 9046751db98fad6e1302c64e3a4c694d98a15538..00f2ac215d9cd738852a78131dcdd6cc6d421371 100644 --- a/api/@ohos.inputmethodengine.d.ts +++ b/api/@ohos.inputmethodengine.d.ts @@ -217,10 +217,6 @@ declare namespace inputMethodEngine { /** * @since 9 * @return InputMethodAbility object of the current input method - * @throws {BusinessError} 201 - permissions check fails. - * @throws {BusinessError} 401 - parameter error. - * @throws {BusinessError} 801 - call unsupported api. - * @throws {BusinessError} 12800002 - input method engine error. * @syscap SystemCapability.MiscServices.InputMethodFramework */ function getInputMethodAbility(): InputMethodAbility; @@ -235,9 +231,6 @@ declare namespace inputMethodEngine { /** * @since 9 * @return KeyboardDelegate object of the current input method - * @throws {BusinessError} 201 - permissions check fails. - * @throws {BusinessError} 401 - parameter error. - * @throws {BusinessError} 12800002 - input method engine error. * @syscap SystemCapability.MiscServices.InputMethodFramework */ function getKeyboardDelegate(): KeyboardDelegate; @@ -255,20 +248,14 @@ declare namespace inputMethodEngine { interface KeyboardController { /** * @since 9 - * @throws {BusinessError} 201 - permissions check fails. - * @throws {BusinessError} 401 - parameter error. - * @throws {BusinessError} 12800002 - input method engine error. - * @throws {BusinessError} 12800008 - input method manager service error. + * @throws {BusinessError} 12800003 - input method client error. * @syscap SystemCapability.MiscServices.InputMethodFramework */ hide(callback: AsyncCallback): void; /** * @since 9 - * @throws {BusinessError} 201 - permissions check fails. - * @throws {BusinessError} 401 - parameter error. - * @throws {BusinessError} 12800002 - input method engine error. - * @throws {BusinessError} 12800008 - input method manager service error. + * @throws {BusinessError} 12800003 - input method client error. * @syscap SystemCapability.MiscServices.InputMethodFramework */ hide(): Promise; @@ -416,7 +403,7 @@ declare namespace inputMethodEngine { * @return :- * @syscap SystemCapability.MiscServices.InputMethodFramework */ - off(ype: 'setSubtype', callback?: (inputMethodSubtype: InputMethodSubtype) => void): void; + off(type: 'setSubtype', callback?: (inputMethodSubtype: InputMethodSubtype) => void): void; } /** @@ -531,7 +518,6 @@ declare namespace inputMethodEngine { interface InputClient { /** * @since 9 - * @throws {BusinessError} 201 - permissions check fails. * @throws {BusinessError} 401 - parameter error. * @throws {BusinessError} 12800003 - input method client error. * @syscap SystemCapability.MiscServices.InputMethodFramework @@ -540,7 +526,6 @@ declare namespace inputMethodEngine { /** * @since 9 - * @throws {BusinessError} 201 - permissions check fails. * @throws {BusinessError} 401 - parameter error. * @throws {BusinessError} 12800003 - input method client error. * @syscap SystemCapability.MiscServices.InputMethodFramework @@ -549,8 +534,8 @@ declare namespace inputMethodEngine { /** * @since 9 - * @throws {BusinessError} 201 - permissions check fails. * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 12800002 - Input method engine error. * @throws {BusinessError} 12800003 - input method client error. * @syscap SystemCapability.MiscServices.InputMethodFramework */ @@ -558,8 +543,8 @@ declare namespace inputMethodEngine { /** * @since 9 - * @throws {BusinessError} 201 - permissions check fails. * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 12800002 - Input method engine error. * @throws {BusinessError} 12800003 - input method client error. * @syscap SystemCapability.MiscServices.InputMethodFramework */ @@ -567,8 +552,8 @@ declare namespace inputMethodEngine { /** * @since 9 - * @throws {BusinessError} 201 - permissions check fails. * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 12800002 - Input method engine error. * @throws {BusinessError} 12800003 - input method client error. * @syscap SystemCapability.MiscServices.InputMethodFramework */ @@ -576,8 +561,8 @@ declare namespace inputMethodEngine { /** * @since 9 - * @throws {BusinessError} 201 - permissions check fails. * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 12800002 - Input method engine error. * @throws {BusinessError} 12800003 - input method client error. * @syscap SystemCapability.MiscServices.InputMethodFramework */ @@ -585,8 +570,8 @@ declare namespace inputMethodEngine { /** * @since 9 - * @throws {BusinessError} 201 - permissions check fails. * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 12800002 - Input method engine error. * @throws {BusinessError} 12800003 - input method client error. * @syscap SystemCapability.MiscServices.InputMethodFramework */ @@ -594,8 +579,8 @@ declare namespace inputMethodEngine { /** * @since 9 - * @throws {BusinessError} 201 - permissions check fails. * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 12800002 - Input method engine error. * @throws {BusinessError} 12800003 - input method client error. * @syscap SystemCapability.MiscServices.InputMethodFramework */ @@ -603,44 +588,42 @@ declare namespace inputMethodEngine { /** * @since 9 - * @throws {BusinessError} 201 - permissions check fails. * @throws {BusinessError} 401 - parameter error. * @throws {BusinessError} 12800003 - input method client error. + * @throws {BusinessError} 12800006 - Input method controller error. * @syscap SystemCapability.MiscServices.InputMethodFramework */ getForward(length: number, callback: AsyncCallback): void; /** * @since 9 - * @throws {BusinessError} 201 - permissions check fails. * @throws {BusinessError} 401 - parameter error. * @throws {BusinessError} 12800003 - input method client error. + * @throws {BusinessError} 12800006 - Input method controller error. * @syscap SystemCapability.MiscServices.InputMethodFramework */ getForward(length: number): Promise; /** * @since 9 - * @throws {BusinessError} 201 - permissions check fails. * @throws {BusinessError} 401 - parameter error. * @throws {BusinessError} 12800003 - input method client error. + * @throws {BusinessError} 12800006 - Input method controller error. * @syscap SystemCapability.MiscServices.InputMethodFramework */ getBackward(length: number, callback: AsyncCallback): void; /** * @since 9 - * @throws {BusinessError} 201 - permissions check fails. * @throws {BusinessError} 401 - parameter error. * @throws {BusinessError} 12800003 - input method client error. + * @throws {BusinessError} 12800006 - Input method controller error. * @syscap SystemCapability.MiscServices.InputMethodFramework */ getBackward(length: number): Promise; /** * @since 9 - * @throws {BusinessError} 201 - permissions check fails. - * @throws {BusinessError} 401 - parameter error. * @throws {BusinessError} 12800003 - input method client error. * @syscap SystemCapability.MiscServices.InputMethodFramework */ @@ -648,8 +631,6 @@ declare namespace inputMethodEngine { /** * @since 9 - * @throws {BusinessError} 201 - permissions check fails. - * @throws {BusinessError} 401 - parameter error. * @throws {BusinessError} 12800003 - input method client error. * @syscap SystemCapability.MiscServices.InputMethodFramework */ @@ -662,24 +643,20 @@ declare namespace inputMethodEngine { * @syscap SystemCapability.MiscServices.InputMethodFramework * @param direction Indicates the distance of cursor to be moved. * @return - - * @throws {BusinessError} 201 - permissions check fails. * @throws {BusinessError} 401 - parameter error. * @throws {BusinessError} 12800003 - input method client error. - * @StageModelOnly */ moveCursor(direction: number, callback: AsyncCallback): void; /** - * Move curosr from input method. + * Move cursor from input method. * * @since 9 * @syscap SystemCapability.MiscServices.InputMethodFramework * @param direction Indicates the distance of cursor to be moved. * @return - - * @throws {BusinessError} 201 - permissions check fails. * @throws {BusinessError} 401 - parameter error. * @throws {BusinessError} 12800003 - input method client error. - * @StageModelOnly */ moveCursor(direction: number): Promise; } @@ -786,4 +763,4 @@ declare namespace inputMethodEngine { } } -export default inputMethodEngine; \ No newline at end of file +export default inputMethodEngine; diff --git a/api/@ohos.inputmethodextensionability.d.ts b/api/@ohos.inputmethodextensionability.d.ts index 9736dd016caeeb13a3e2bbf9d5ec8825ad8cf429..5961f6e39d5590ea01e00bcfc72e6ea3aaa24437 100644 --- a/api/@ohos.inputmethodextensionability.d.ts +++ b/api/@ohos.inputmethodextensionability.d.ts @@ -15,7 +15,6 @@ import rpc from "./@ohos.rpc"; import Want from './@ohos.application.Want'; -import ExtensionAbility from './@ohos.application.ExtensionAbility'; import InputMethodExtensionContext from "./@ohos.inputmethodextensioncontext"; /** @@ -23,14 +22,12 @@ import InputMethodExtensionContext from "./@ohos.inputmethodextensioncontext"; * * @since 9 * @syscap SystemCapability.MiscServices.InputMethodFramework - * @StageModelOnly */ -export default class InputMethodExtensionAbility extends ExtensionAbility { +export default class InputMethodExtensionAbility { /** * Indicates input method extension ability context. * @since 9 * @syscap SystemCapability.MiscServices.InputMethodFramework - * @StageModelOnly */ context: InputMethodExtensionContext; @@ -42,7 +39,6 @@ export default class InputMethodExtensionAbility extends ExtensionAbility { * @param want Indicates the want of created service extension. * @return - * @throws {BusinessError} 401 - parameter error. - * @StageModelOnly */ onCreate(want: Want): void; @@ -53,59 +49,6 @@ export default class InputMethodExtensionAbility extends ExtensionAbility { * @syscap SystemCapability.MiscServices.InputMethodFramework * @return - * @throws {BusinessError} 401 - parameter error. - * @StageModelOnly */ onDestroy(): void; - - /** - * Called back when a input method extension is started. - * - * @since 9 - * @syscap SystemCapability.MiscServices.InputMethodFramework - * @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. - * @return - - * @throws {BusinessError} 401 - parameter error. - * @StageModelOnly - */ - onRequest(want: Want, startId: number): void; - - /** - * Called back when a input method extension is first connected to an ability. - * - * @since 9 - * @syscap SystemCapability.MiscServices.InputMethodFramework - * @param want Indicates connection information about the Service ability. - * @return Returns the proxy of the Service ability. - * @throws {BusinessError} 401 - parameter error. - * @StageModelOnly - */ - onConnect(want: Want): rpc.RemoteObject; - - /** - * Called back when all abilities connected to a input method extension are disconnected. - * - * @since 9 - * @syscap SystemCapability.MiscServices.InputMethodFramework - * @param want Indicates disconnection information about the service extension. - * @return - - * @throws {BusinessError} 401 - parameter error. - * @StageModelOnly - */ - onDisconnect(want: Want): void; - - /** - * Called when a new client attempts to connect to a input method extension after all previous client connections to it - * are disconnected. - * - * @since 9 - * @syscap SystemCapability.MiscServices.InputMethodFramework - * @param want Indicates the want of the service extension being connected. - * @return - - * @throws {BusinessError} 401 - parameter error. - * @StageModelOnly - */ - onReconnect(want: Want): void; } \ No newline at end of file diff --git a/api/@ohos.inputmethodextensioncontext.d.ts b/api/@ohos.inputmethodextensioncontext.d.ts index c09bd7e0a3264171c298d1168d60a9e2d161c9d8..c6521740a984df5511fd163265a4de68c5c566cb 100644 --- a/api/@ohos.inputmethodextensioncontext.d.ts +++ b/api/@ohos.inputmethodextensioncontext.d.ts @@ -23,45 +23,14 @@ import ExtensionContext from './application/ExtensionContext'; * * @since 9 * @syscap SystemCapability.MiscServices.InputMethodFramework - * @StageModelOnly */ export default class InputMethodExtensionContext extends ExtensionContext { - /** - * Input method extension uses this method to start a specific ability. - * - * @since 9 - * @deprecated since 9 - * @syscap SystemCapability.MiscServices.InputMethodFramework - * @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; - - /** - * Destroy the input method extension. - * - * @since 9 - * @deprecated since 9 - * @useinstead ohos.inputmethodextensioncontext.InputMethodExtensionContext.destroy - * @syscap SystemCapability.MiscServices.InputMethodFramework - * @return - - * @StageModelOnly - */ - terminateSelf(callback: AsyncCallback): void; - terminateSelf(): Promise; - /** * Destroy the input method extension. * * @since 9 * @syscap SystemCapability.MiscServices.InputMethodFramework * @return - - * @throws {BusinessError} 401 - parameter error. - * @StageModelOnly */ destroy(callback: AsyncCallback): void; @@ -71,8 +40,6 @@ export default class InputMethodExtensionContext extends ExtensionContext { * @since 9 * @syscap SystemCapability.MiscServices.InputMethodFramework * @return - - * @throws {BusinessError} 401 - parameter error. - * @StageModelOnly */ destroy(): Promise; } \ No newline at end of file diff --git a/api/@ohos.intl.d.ts b/api/@ohos.intl.d.ts index 38e51ec9b22788afb32eaca56695a9717fafe4bb..fa8569eb60700b38e3370feab17eb56bb7eec61d 100755 --- a/api/@ohos.intl.d.ts +++ b/api/@ohos.intl.d.ts @@ -211,7 +211,7 @@ export class Locale { * Convert the locale information to string. * * @syscap SystemCapability.Global.I18n - * @return Returns locale information in string form. + * @returns Returns locale information in string form. * @since 6 */ toString(): string; @@ -220,7 +220,7 @@ export class Locale { * Maximize the locale's base information. * * @syscap SystemCapability.Global.I18n - * @return Returns maximized locale. + * @returns Returns maximized locale. * @since 6 */ maximize(): Locale; @@ -229,7 +229,7 @@ export class Locale { * Minimize the locale's base information. * * @syscap SystemCapability.Global.I18n - * @return Returns minimized locale. + * @returns Returns minimized locale. * @since 6 */ minimize(): Locale; @@ -540,7 +540,7 @@ export class DateTimeFormat { * * @syscap SystemCapability.Global.I18n * @param date Indicates the Date object to be formatted. - * @return Returns a date string formatted based on the specified locale. + * @returns Returns a date string formatted based on the specified locale. * @since 6 */ format(date: Date): string; @@ -551,7 +551,7 @@ export class DateTimeFormat { * @syscap SystemCapability.Global.I18n * @param startDate Indicates the start date of the date range. * @param endDate Indicates the end date of the date range. - * @return Returns a date string formatted based on the specified locale. + * @returns Returns a date string formatted based on the specified locale. * @since 6 */ formatRange(startDate: Date, endDate: Date): string; @@ -560,7 +560,7 @@ export class DateTimeFormat { * Obtains the options of the DateTimeFormat object. * * @syscap SystemCapability.Global.I18n - * @return Returns the options of the DateTimeFormat object. + * @returns Returns the options of the DateTimeFormat object. * @since 6 */ resolvedOptions(): DateTimeOptions; @@ -871,7 +871,7 @@ export class NumberFormat { * * @syscap SystemCapability.Global.I18n * @param number Indicates the number to be formatted. - * @return Returns a number string formatted based on the specified locale. + * @returns Returns a number string formatted based on the specified locale. * @since 6 */ format(number: number): string; @@ -880,7 +880,7 @@ export class NumberFormat { * Obtains the options of the NumberFormat object. * * @syscap SystemCapability.Global.I18n - * @return Returns the options of the NumberFormat object. + * @returns Returns the options of the NumberFormat object. * @since 6 */ resolvedOptions(): NumberOptions; @@ -1056,7 +1056,7 @@ export class Collator { * @syscap SystemCapability.Global.I18n * @param first The first string to compare. * @param second The second string to compare. - * @return Returns a number indicating how first compare to second: + * @returns Returns a number indicating how first compare to second: * a negative value if string1 comes before string2; * a positive value if string1 comes after string2; * 0 if they are considered equal. @@ -1065,11 +1065,11 @@ export class Collator { compare(first: string, second: string): number; /** - * Returns a new object with properties reflecting the locale and collation options computed + * Returns a new object with properties that reflect the locale and collation options computed * during initialization of the object. * * @syscap SystemCapability.Global.I18n - * @return Returns a CollatorOptions object reflecting the properties of this object. + * @returns Returns a CollatorOptions object with properties that reflect the properties of this object. * @since 8 */ resolvedOptions(): CollatorOptions; @@ -1240,7 +1240,7 @@ export class PluralRules { * * @syscap SystemCapability.Global.I18n * @param n The number to get a plural rule for. - * @return A string representing the pluralization category of the number, + * @returns A string representing the pluralization category of the number, * can be one of zero, one, two, few, many or other. * @since 8 */ @@ -1404,11 +1404,11 @@ export class RelativeTimeFormat { formatToParts(value: number, unit: string): Array; /** - * Returns a new object with properties reflecting the locale and formatting options computed during + * Returns a new object with properties that reflect the locale and formatting options computed during * initialization of the object. * * @syscap SystemCapability.Global.I18n - * @returns RelativeTimeFormatOptions which reflecting the locale and formatting options of the object. + * @returns RelativeTimeFormatOptions which reflect the locale and formatting options of the object. * @since 8 */ resolvedOptions(): RelativeTimeFormatResolvedOptions; diff --git a/api/@ohos.multimedia.audio.d.ts b/api/@ohos.multimedia.audio.d.ts index 0a92de745b8a55f2e485868a1e114147489e161a..3ecfb1b9bdc0299e347cf890e5c7ac237ed3a224 100644 --- a/api/@ohos.multimedia.audio.d.ts +++ b/api/@ohos.multimedia.audio.d.ts @@ -18,16 +18,80 @@ import {ErrorCallback, AsyncCallback, Callback} from './basic'; /** * @name audio * @since 7 - * @import import audio from '@ohos.multimedia.audio' */ declare namespace audio { /** - * Define local device network id for audio - * @since 9 - * @syscap SystemCapability.Multimedia.Audio.Device - * @systemapi - */ + * Enumerates audio errors. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Core + */ + enum AudioErrors { + /** + * Invalid parameter. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Core + */ + ERROR_INVALID_PARAM = 6800101, + /** + * Allocate memory failed. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Core + */ + ERROR_NO_MEMORY = 6800102, + /** + * Operation not permit at current state. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Core + */ + ERROR_ILLEGAL_STATE = 6800103, + /** + * Unsupported option. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Core + */ + ERROR_UNSUPPORTED = 6800104, + /** + * Time out. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Core + */ + ERROR_TIMEOUT = 6800105, + /** + * Audio specific errors. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Core + */ + ERROR_STREAM_LIMIT = 6800201, + /** + * Default error. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Core + */ + ERROR_SYSTEM = 6800301 + } + + /** + * Define local device network id for audio + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Device + * @systemapi + */ const LOCAL_NETWORK_ID: string; + + /** + * Define default volume group id for audio + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Volume + */ + const DEFAULT_VOLUME_GROUP_ID: number; + + /** + * Define default interrupt group id for audio + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Interrupt + */ + const DEFAULT_INTERRUPT_GROUP_ID: number; + /** * Obtains an AudioManager instance. * @return AudioManager object. @@ -72,23 +136,25 @@ declare namespace audio { */ function createAudioRenderer(options: AudioRendererOptions): Promise; - /** - * Obtains a TonePlayer instance. This method uses an asynchronous callback to return the renderer instance. - * @param options Tone playing attribute. - * @return Promise used to return the tone player instance. - * @since 9 - * @syscap SystemCapability.Multimedia.Audio.Tone - */ - function createTonePlayer(options: AudioRendererInfo, callback: AsyncCallback): void; - - /** - * Obtains a TonePlayer instance. This method uses a promise to return the renderer instance. - * @param options Tone playing attribute. - * @return Promise used to return the tone player instance. - * @since 9 - * @syscap SystemCapability.Multimedia.Audio.Tone - */ - function createTonePlayer(options: AudioRendererInfo): Promise; + /** + * Obtains a TonePlayer instance. This method uses an asynchronous callback to return the renderer instance. + * @param options Tone playing attribute. + * @return Promise used to return the tone player instance. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + * @systemapi + */ + function createTonePlayer(options: AudioRendererInfo, callback: AsyncCallback): void; + + /** + * Obtains a TonePlayer instance. This method uses a promise to return the renderer instance. + * @param options Tone playing attribute. + * @return Promise used to return the tone player instance. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + * @systemapi + */ + function createTonePlayer(options: AudioRendererInfo): Promise; /** * Enumerates the audio states. @@ -325,22 +391,41 @@ declare namespace audio { * Enumerates the active device types. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.CommunicationDeviceType */ - enum ActiveDeviceType { + enum ActiveDeviceType { /** * Speaker. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.CommunicationDeviceType.SPEAKER */ SPEAKER = 2, /** * Bluetooth device using the SCO link. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device + * @deprecated since 9 */ BLUETOOTH_SCO = 7, } + /** + * Enumerates the available device types for communication. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Communication + */ + enum CommunicationDeviceType { + /** + * Speaker. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Communication + */ + SPEAKER = 2 + } + /** * Enumerates ringer modes. * @since 7 @@ -576,7 +661,7 @@ declare namespace audio { */ enum StreamUsage { /** - * Unkown usage. + * Unknown usage. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Core */ @@ -598,7 +683,7 @@ declare namespace audio { * @since 9 * @syscap SystemCapability.Multimedia.Audio.Core */ - STREAM_USAGE_VOICE_ASSISTANT = 3, + STREAM_USAGE_VOICE_ASSISTANT = 3, /** * Notification or ringtone usage. * @since 7 @@ -608,19 +693,19 @@ declare namespace audio { } /** - * Enumerates the focus type. + * Enumerates the audio interrupt request type. * @since 9 - * @syscap SystemCapability.Multimedia.Audio.Core + * @syscap SystemCapability.Multimedia.Audio.Interrupt * @systemapi */ - enum FocusType { + enum InterruptRequestType { /** - * Recording type. + * Default type to request audio interrupt. * @since 9 - * @syscap SystemCapability.Multimedia.Audio.Core + * @syscap SystemCapability.Multimedia.Audio.Interrupt * @systemapi */ - FOCUS_TYPE_RECORDING = 0, + INTERRUPT_REQUEST_TYPE_DEFAULT = 0, } /** @@ -681,7 +766,8 @@ declare namespace audio { rendererFlags: number; } - /** Describes audio renderer filter. + /** + * Describes audio renderer filter. * @since 9 * @syscap SystemCapability.Multimedia.Audio.Core * @systemapi @@ -733,19 +819,19 @@ declare namespace audio { /** * Enumerates the interrupt modes. * @since 9 - * @syscap SystemCapability.Multimedia.Audio.Core + * @syscap SystemCapability.Multimedia.Audio.Interrupt */ enum InterruptMode { /** * Mode that different stream share one interrupt unit. * @since 9 - * @syscap SystemCapability.Multimedia.Audio.Core + * @syscap SystemCapability.Multimedia.Audio.Interrupt */ SHARE_MODE = 0, /** * Mode that each stream has independent interrupt unit. * @since 9 - * @syscap SystemCapability.Multimedia.Audio.Core + * @syscap SystemCapability.Multimedia.Audio.Interrupt */ INDEPENDENT_MODE = 1 } @@ -897,6 +983,7 @@ declare namespace audio { * Enumerates interrupt action types. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Renderer + * @deprecated since 9 */ enum InterruptActionType { @@ -904,6 +991,7 @@ declare namespace audio { * Focus gain event. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Renderer + * @deprecated since 9 */ TYPE_ACTIVATED = 0, @@ -911,6 +999,7 @@ declare namespace audio { * Audio interruption event. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Renderer + * @deprecated since 9 */ TYPE_INTERRUPT = 1 } @@ -984,6 +1073,8 @@ declare namespace audio { * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setVolume */ setVolume(volumeType: AudioVolumeType, volume: number, callback: AsyncCallback): void; /** @@ -994,6 +1085,8 @@ declare namespace audio { * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setVolume */ setVolume(volumeType: AudioVolumeType, volume: number): Promise; /** @@ -1002,6 +1095,8 @@ declare namespace audio { * @param callback Callback used to return the volume. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getVolume */ getVolume(volumeType: AudioVolumeType, callback: AsyncCallback): void; /** @@ -1010,6 +1105,8 @@ declare namespace audio { * @return Promise used to return the volume. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getVolume */ getVolume(volumeType: AudioVolumeType): Promise; /** @@ -1018,6 +1115,8 @@ declare namespace audio { * @param callback Callback used to return the minimum volume. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getMinVolume */ getMinVolume(volumeType: AudioVolumeType, callback: AsyncCallback): void; /** @@ -1026,6 +1125,8 @@ declare namespace audio { * @return Promise used to return the minimum volume. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getMinVolume */ getMinVolume(volumeType: AudioVolumeType): Promise; /** @@ -1034,6 +1135,8 @@ declare namespace audio { * @param callback Callback used to return the maximum volume. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getMaxVolume */ getMaxVolume(volumeType: AudioVolumeType, callback: AsyncCallback): void; /** @@ -1042,6 +1145,8 @@ declare namespace audio { * @return Promise used to return the maximum volume. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getMaxVolume */ getMaxVolume(volumeType: AudioVolumeType): Promise; /** @@ -1050,6 +1155,8 @@ declare namespace audio { * @param callback Callback used to return the device list. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioRoutingManager#getDevices */ getDevices(deviceFlag: DeviceFlag, callback: AsyncCallback): void; /** @@ -1058,42 +1165,10 @@ declare namespace audio { * @return Promise used to return the device list. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioRoutingManager#getDevices */ getDevices(deviceFlag: DeviceFlag): Promise; - /** - * Get the volume group list for a networkId. This method uses an asynchronous callback to return the result. - * @param networkId Device network id - * @param callback Callback used to return the result. - * @since 9 - * @syscap SystemCapability.Multimedia.Audio.Volume - * @systemapi - */ - getVolumeGroups(networkId: string, callback: AsyncCallback): void; - /** - * Get the volume group list for a networkId. This method uses a promise to return the result. - * @param networkId Device network id - * @return Promise used to return the result. - * @since 9 - * @syscap SystemCapability.Multimedia.Audio.Volume - * @systemapi - */ - getVolumeGroups(networkId: string): Promise; - /** - * Obtains an AudioGroupManager instance. This method uses an asynchronous callback to return the result. - * @param callback Callback used to return the result. - * @since 9 - * @syscap SystemCapability.Multimedia.Audio.Volume - * @systemapi - */ - getGroupManager(groupId: number, callback: AsyncCallback): void; - /** - * Obtains an AudioGroupManager instance. This method uses a promise to return the result. - * @param callback Callback used to return the result. - * @since 9 - * @syscap SystemCapability.Multimedia.Audio.Volume - * @systemapi - */ - getGroupManager(groupId: number): Promise; /** * Mutes a stream. This method uses an asynchronous callback to return the result. * @param volumeType Audio stream type. @@ -1101,6 +1176,8 @@ declare namespace audio { * @param callback Callback used to return the result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#mute */ mute(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback): void; /** @@ -1110,6 +1187,8 @@ declare namespace audio { * @return Promise used to return the result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#mute */ mute(volumeType: AudioVolumeType, mute: boolean): Promise; /** @@ -1119,6 +1198,8 @@ declare namespace audio { * muted, and false means the opposite. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#isMute */ isMute(volumeType: AudioVolumeType, callback: AsyncCallback): void; /** @@ -1128,6 +1209,8 @@ declare namespace audio { * and false means the opposite. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#isMute */ isMute(volumeType: AudioVolumeType): Promise; /** @@ -1137,6 +1220,8 @@ declare namespace audio { * active, and false means the opposite. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioStreamManager#isActive */ isActive(volumeType: AudioVolumeType, callback: AsyncCallback): void; /** @@ -1146,6 +1231,8 @@ declare namespace audio { * and false means the opposite. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Volume + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioStreamManager#isActive */ isActive(volumeType: AudioVolumeType): Promise; /** @@ -1155,6 +1242,8 @@ declare namespace audio { * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device * @permission ohos.permission.MICROPHONE + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setMicrophoneMute */ setMicrophoneMute(mute: boolean, callback: AsyncCallback): void; /** @@ -1164,6 +1253,8 @@ declare namespace audio { * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device * @permission ohos.permission.MICROPHONE + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setMicrophoneMute */ setMicrophoneMute(mute: boolean): Promise; /** @@ -1173,6 +1264,8 @@ declare namespace audio { * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device * @permission ohos.permission.MICROPHONE + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#isMicrophoneMute */ isMicrophoneMute(callback: AsyncCallback): void; /** @@ -1182,6 +1275,8 @@ declare namespace audio { * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device * @permission ohos.permission.MICROPHONE + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#isMicrophoneMute */ isMicrophoneMute(): Promise; /** @@ -1191,6 +1286,8 @@ declare namespace audio { * @since 7 * @syscap SystemCapability.Multimedia.Audio.Communication * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setRingerMode */ setRingerMode(mode: AudioRingMode, callback: AsyncCallback): void; /** @@ -1200,6 +1297,8 @@ declare namespace audio { * @since 7 * @syscap SystemCapability.Multimedia.Audio.Communication * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setRingerMode */ setRingerMode(mode: AudioRingMode): Promise; /** @@ -1207,6 +1306,8 @@ declare namespace audio { * @param callback Callback used to return the ringer mode. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Communication + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getRingerMode */ getRingerMode(callback: AsyncCallback): void; /** @@ -1214,6 +1315,8 @@ declare namespace audio { * @return Promise used to return the ringer mode. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Communication + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getRingerMode */ getRingerMode(): Promise; /** @@ -1260,6 +1363,8 @@ declare namespace audio { * @param callback Callback used to return the result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioRoutingManager#setCommunicationDevice */ setDeviceActive(deviceType: ActiveDeviceType, active: boolean, callback: AsyncCallback): void; /** @@ -1270,6 +1375,8 @@ declare namespace audio { * @return Promise used to return the result. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioRoutingManager#setCommunicationDevice */ setDeviceActive(deviceType: ActiveDeviceType, active: boolean): Promise; /** @@ -1278,6 +1385,8 @@ declare namespace audio { * @param callback Callback used to return the active status of the device. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioRoutingManager#isCommunicationDeviceActive */ isDeviceActive(deviceType: ActiveDeviceType, callback: AsyncCallback): void; /** @@ -1286,6 +1395,8 @@ declare namespace audio { * @return Promise used to return the active status of the device. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioRoutingManager#isCommunicationDeviceActive */ isDeviceActive(deviceType: ActiveDeviceType): Promise; /** @@ -1294,6 +1405,8 @@ declare namespace audio { * @since 8 * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeManager#event:volumeChange */ on(type: 'volumeChange', callback: Callback): void; /** @@ -1302,6 +1415,8 @@ declare namespace audio { * @since 8 * @syscap SystemCapability.Multimedia.Audio.Communication * @systemapi + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#event:ringerModeChange */ on(type: 'ringerModeChange', callback: Callback): void; /** @@ -1343,6 +1458,8 @@ declare namespace audio { * @param callback Callback used to obtain the device update details. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioRoutingManager#event:deviceChange */ on(type: 'deviceChange', callback: Callback): void; @@ -1351,6 +1468,8 @@ declare namespace audio { * @param callback Callback used to obtain the device update details. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Device + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.AudioRoutingManager#event:deviceChange */ off(type: 'deviceChange', callback?: Callback): void; @@ -1376,97 +1495,74 @@ declare namespace audio { off(type: 'interrupt', interrupt: AudioInterrupt, callback?: Callback): void; /** - * Request independent interrupt event. - * @param focusType The focus type. - * @param callback Callback used to return the result. + * Obtains an AudioVolumeManager instance. + * @return AudioVolumeManager instance. * @since 9 - * @syscap SystemCapability.Multimedia.Audio.Renderer - * @systemapi + * @syscap SystemCapability.Multimedia.Audio.Volume */ - requestIndependentInterrupt(focusType: FocusType, callback: AsyncCallback): void; + getVolumeManager(): AudioVolumeManager; /** - * Request independent interrupt event. - * @param focusType The focus type. - * @return Promise used to return the result. + * Obtains an AudioStreamManager instance. This method uses an asynchronous callback to return the result. + * @return AudioStreamManager instance. * @since 9 - * @syscap SystemCapability.Multimedia.Audio.Renderer - * @systemapi + * @syscap SystemCapability.Multimedia.Audio.Core */ - requestIndependentInterrupt(focusType: FocusType): Promise; + getStreamManager(): AudioStreamManager; /** - * Abandon the requested independent interrupt event. - * @param focusType The focus type. - * @param callback Callback used to return the result. + * Obtains an AudioRoutingManager instance. + * @return AudioRoutingManager instance. * @since 9 - * @syscap SystemCapability.Multimedia.Audio.Renderer - * @systemapi + * @syscap SystemCapability.Multimedia.Audio.Device */ - abandonIndependentInterrupt(focusType: FocusType, callback: AsyncCallback): void; + getRoutingManager(): AudioRoutingManager; + } + /** + * Enumerates audio interrupt request result type. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Interrupt + * @systemapi + */ + enum InterruptRequestResultType { /** - * Abandon the requested independent interrupt event. - * @param focusType The focus type. - * @return Promise used to return the result. + * Request audio interrupt success * @since 9 - * @syscap SystemCapability.Multimedia.Audio.Renderer + * @syscap SystemCapability.Multimedia.Audio.Interrupt * @systemapi */ - abandonIndependentInterrupt(focusType: FocusType): Promise; - + INTERRUPT_REQUEST_GRANT = 0, /** - * Listens for independent interruption events. When the audio of an application is interrupted by another application, - * the callback is invoked to notify the former application. - * @param type Type of the event to listen for. Only the independentInterrupt event is supported. - * @param callback Callback invoked for the independent interruption event. + * Request audio interrupt fail, may have higher priority type * @since 9 - * @syscap SystemCapability.Multimedia.Audio.Renderer + * @syscap SystemCapability.Multimedia.Audio.Interrupt * @systemapi */ - on(type: 'independentInterrupt', callback: Callback): void; + INTERRUPT_REQUEST_REJECT = 1 + } + /** + * Describes audio interrupt operation results. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Interrupt + * @systemapi + */ + interface InterruptResult { /** - * Cancels the listening of independent interruption events. - * @param type Type of the event to listen for. Only the independentInterrupt event is supported. - * @param callback Callback invoked for the independent interruption event. + * Interrupt request or abandon result. * @since 9 - * @syscap SystemCapability.Multimedia.Audio.Renderer + * @syscap SystemCapability.Multimedia.Audio.Interrupt * @systemapi */ - off(type: 'independentInterrupt', callback?: Callback): void; - + requestResult: InterruptRequestResultType; /** - * Obtains an AudioStreamManager instance. This method uses an asynchronous callback to return the result. - * @param callback Callback used to return the result. + * Interrupt node as a unit to receive interrupt change event. * @since 9 - * @syscap SystemCapability.Multimedia.Audio.Core - */ - getStreamManager(callback: AsyncCallback): void; - - /** - * Obtains an AudioStreamManager instance. This method uses a promise to return the result. - * @return Promise used to return the result. - * @since 9 - * @syscap SystemCapability.Multimedia.Audio.Core - */ - getStreamManager(): Promise; - - /** - * Obtains an AudioRoutingManager instance. This method uses an asynchronous callback to return the result. - * @param callback Callback used to return the result. - * @since 9 - * @syscap SystemCapability.Multimedia.Audio.Device - */ - getRoutingManager(callback: AsyncCallback): void; - - /** - * Obtains an AudioRoutingManager instance. This method uses a promise to return the result. - * @param callback Callback used to return the result. - * @since 9 - * @syscap SystemCapability.Multimedia.Audio.Device + * @syscap SystemCapability.Multimedia.Audio.Interrupt + * @systemapi */ - getRoutingManager(): Promise; + interruptNode: number; } /** @@ -1491,22 +1587,67 @@ declare namespace audio { * @syscap SystemCapability.Multimedia.Audio.Device */ getDevices(deviceFlag: DeviceFlag): Promise; + /** * Subscribes to device change events. When a device is connected/disconnected, registered clients will receive * the callback. * @param deviceFlag Audio device flag. * @param callback Callback used to obtain the device update details. + * @throws { BusinessError } 401 - if input parameter type or number mismatch + * @throws { BusinessError } 6800101 - if input parameter value error * @since 9 * @syscap SystemCapability.Multimedia.Audio.Device */ on(type: 'deviceChange', deviceFlag: DeviceFlag, callback: Callback): void; + /** * UnSubscribes to device change events. * @param callback Callback used to obtain the device update details. + * @throws { BusinessError } 401 - if input parameter type or number mismatch + * @throws { BusinessError } 6800101 - if input parameter value error * @since 9 * @syscap SystemCapability.Multimedia.Audio.Device */ off(type: 'deviceChange', callback?: Callback): void; + + /** + * Sets a device to the active state. This method uses an asynchronous callback to return the result. + * @param deviceType Audio device type. + * @param active Active status to set. The value true means to set the device to the active status, and false + * means the opposite. + * @param callback Callback used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Communication + */ + setCommunicationDevice(deviceType: CommunicationDeviceType, active: boolean, callback: AsyncCallback): void; + /** + * Sets a device to the active state. This method uses a promise to return the result. + * @param deviceType Audio device type. + * @param active Active status to set. The value true means to set the device to the active status, and false + * means the opposite. + * @return Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Communication + */ + setCommunicationDevice(deviceType: CommunicationDeviceType, active: boolean): Promise; + + /** + * Checks whether a device is active. This method uses an asynchronous callback to return the query result. + * @param deviceType Audio device type. + * @param callback Callback used to return the active status of the device. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Communication + */ + isCommunicationDeviceActive(deviceType: CommunicationDeviceType, callback: AsyncCallback): void; + /** + * Checks whether a device is active. This method uses a promise to return the query result. + * @param deviceType Audio device type. + * @return Promise used to return the active status of the device. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Communication + */ + isCommunicationDeviceActive(deviceType: CommunicationDeviceType): Promise; + /** * Select the output device. This method uses an asynchronous callback to return the result. * @param outputAudioDevices Audio device description @@ -1525,6 +1666,7 @@ declare namespace audio { * @systemapi */ selectOutputDevice(outputAudioDevices: AudioDeviceDescriptors): Promise; + /** * Select the output device with desired AudioRenderer. This method uses an asynchronous callback to return the result. * @param filter Filter for AudioRenderer. @@ -1545,6 +1687,7 @@ declare namespace audio { * @systemapi */ selectOutputDeviceByFilter(filter: AudioRendererFilter, outputAudioDevices: AudioDeviceDescriptors): Promise; + /** * Select the input device. This method uses an asynchronous callback to return the result. * @param inputAudioDevices Audio device description @@ -1563,13 +1706,6 @@ declare namespace audio { * @systemapi */ selectInputDevice(inputAudioDevices: AudioDeviceDescriptors): Promise; - /** - * Listens for system microphone state change events. This method uses a callback to get microphone change events. - * @param callback Callback used to get the system microphone state change event. - * @since 9 - * @syscap SystemCapability.Multimedia.Audio.Device - */ - on(type: 'micStateChange', callback: Callback): void; } /** @@ -1585,7 +1721,6 @@ declare namespace audio { * @syscap SystemCapability.Multimedia.Audio.Renderer */ getCurrentAudioRendererInfoArray(callback: AsyncCallback): void; - /** * Get information of current existing audio renderers. * @return Promise used to return the information of current existing audio renderers. @@ -1601,7 +1736,6 @@ declare namespace audio { * @syscap SystemCapability.Multimedia.Audio.Renderer */ getCurrentAudioCapturerInfoArray(callback: AsyncCallback): void; - /** * Get information of current existing audio capturers. * @return Promise used to return the information of current existing audio capturers. @@ -1615,6 +1749,8 @@ declare namespace audio { * registered clients will receive the callback. * @param type Type of the event to listen for. Only the audioRendererChange event is supported. * @param callback Callback invoked for the audio renderer change event. + * @throws { BusinessError } 401 - if input parameter type or number mismatch + * @throws { BusinessError } 6800101 - if input parameter value error * @since 9 * @syscap SystemCapability.Multimedia.Audio.Renderer */ @@ -1622,16 +1758,20 @@ declare namespace audio { /** * UnSubscribes to audio renderer change events. + * @throws { BusinessError } 401 - if input parameter type or number mismatch + * @throws { BusinessError } 6800101 - if input parameter value error * @since 9 * @syscap SystemCapability.Multimedia.Audio.Renderer */ - off(type: "audioRendererChange"); + off(type: "audioRendererChange"): void; /** * Listens for audio capturer change events. When there is any audio capturer change, * registered clients will receive the callback. * @param type Type of the event to listen for. Only the audioCapturerChange event is supported. * @param callback Callback invoked for the audio capturer change event. + * @throws { BusinessError } 401 - if input parameter type or number mismatch + * @throws { BusinessError } 6800101 - if input parameter value error * @since 9 * @syscap SystemCapability.Multimedia.Audio.Capturer */ @@ -1639,19 +1779,92 @@ declare namespace audio { /** * UnSubscribes to audio capturer change events. + * @throws { BusinessError } 401 - if input parameter type or number mismatch + * @throws { BusinessError } 6800101 - if input parameter value error * @since 9 * @syscap SystemCapability.Multimedia.Audio.Capturer */ - off(type: "audioCapturerChange"); + off(type: "audioCapturerChange"): void; + + /** + * Checks whether a stream is active. This method uses an asynchronous callback to return the query result. + * @param volumeType Audio stream type. + * @param callback Callback used to return the active status of the stream. The value true means that the stream is + * active, and false means the opposite. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Renderer + */ + isActive(volumeType: AudioVolumeType, callback: AsyncCallback): void; + /** + * Checks whether a stream is active. This method uses a promise to return the query result. + * @param volumeType Audio stream type. + * @return Promise used to return the active status of the stream. The value true means that the stream is active, + * and false means the opposite. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Renderer + */ + isActive(volumeType: AudioVolumeType): Promise; + } + + /** + * Implements audio volume management. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Volume + */ + interface AudioVolumeManager { + /** + * Get the volume group list for a networkId. This method uses an asynchronous callback to return the result. + * @param networkId Distributed deice net work id + * @param callback Callback used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Volume + * @systemapi + */ + getVolumeGroupInfos(networkId: string, callback: AsyncCallback): void; + /** + * Get the volume group list for a networkId. This method uses a promise to return the result. + * @param networkId Distributed deice net work id + * @return Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Volume + * @systemapi + */ + getVolumeGroupInfos(networkId: string): Promise; + + /** + * Obtains an AudioVolumeGroupManager instance. This method uses an asynchronous callback to return the result. + * @param groupId volume group id, use LOCAL_VOLUME_GROUP_ID in default + * @param callback Callback used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Volume + */ + getVolumeGroupManager(groupId: number, callback: AsyncCallback): void; + /** + * Obtains an AudioVolumeGroupManager instance. This method uses a promise to return the result. + * @param groupId volume group id, use LOCAL_VOLUME_GROUP_ID in default + * @param callback Callback used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Volume + */ + getVolumeGroupManager(groupId: number): Promise; + + /** + * Listens for system volume change events. This method uses a callback to get volume change events. + * @param callback Callback used to get the system volume change event. + * @throws { BusinessError } 401 - if input parameter type or number mismatch + * @throws { BusinessError } 6800101 - if input parameter value error + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Volume + */ + on(type: 'volumeChange', callback: Callback): void; } /** * Implements audio volume group management. * @since 9 * @syscap SystemCapability.Multimedia.Audio.Volume - * @systemapi */ - interface AudioGroupManager { + interface AudioVolumeGroupManager { /** * Sets the volume for a stream. This method uses an asynchronous callback to return the result. * @param volumeType Audio stream type. @@ -1660,6 +1873,7 @@ declare namespace audio { * @since 9 * @syscap SystemCapability.Multimedia.Audio.Volume * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY + * @systemapi */ setVolume(volumeType: AudioVolumeType, volume: number, callback: AsyncCallback): void; /** @@ -1670,8 +1884,10 @@ declare namespace audio { * @since 9 * @syscap SystemCapability.Multimedia.Audio.Volume * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY + * @systemapi */ setVolume(volumeType: AudioVolumeType, volume: number): Promise; + /** * Obtains the volume of a stream. This method uses an asynchronous callback to return the query result. * @param volumeType Audio stream type. @@ -1681,13 +1897,14 @@ declare namespace audio { */ getVolume(volumeType: AudioVolumeType, callback: AsyncCallback): void; /** - * Obtains the volume of a stream. This method uses a promise to return the query result. - * @param volumeType Audio stream type. - * @return Promise used to return the volume. - * @since 9 - * @syscap SystemCapability.Multimedia.Audio.Volume - */ + * Obtains the volume of a stream. This method uses a promise to return the query result. + * @param volumeType Audio stream type. + * @return Promise used to return the volume. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Volume + */ getVolume(volumeType: AudioVolumeType): Promise; + /** * Obtains the minimum volume allowed for a stream. This method uses an asynchronous callback to return the query result. * @param volumeType Audio stream type. @@ -1704,6 +1921,7 @@ declare namespace audio { * @syscap SystemCapability.Multimedia.Audio.Volume */ getMinVolume(volumeType: AudioVolumeType): Promise; + /** * Obtains the maximum volume allowed for a stream. This method uses an asynchronous callback to return the query result. * @param volumeType Audio stream type. @@ -1720,6 +1938,7 @@ declare namespace audio { * @syscap SystemCapability.Multimedia.Audio.Volume */ getMaxVolume(volumeType: AudioVolumeType): Promise; + /** * Mutes a stream. This method uses an asynchronous callback to return the result. * @param volumeType Audio stream type. @@ -1727,6 +1946,8 @@ declare namespace audio { * @param callback Callback used to return the result. * @since 9 * @syscap SystemCapability.Multimedia.Audio.Volume + * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY + * @systemapi */ mute(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback): void; /** @@ -1736,8 +1957,11 @@ declare namespace audio { * @return Promise used to return the result. * @since 9 * @syscap SystemCapability.Multimedia.Audio.Volume + * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY + * @systemapi */ mute(volumeType: AudioVolumeType, mute: boolean): Promise; + /** * Checks whether a stream is muted. This method uses an asynchronous callback to return the query result. * @param volumeType Audio stream type. @@ -1756,6 +1980,98 @@ declare namespace audio { * @syscap SystemCapability.Multimedia.Audio.Volume */ isMute(volumeType: AudioVolumeType): Promise; + + /** + * Sets the ringer mode. This method uses an asynchronous callback to return the result. + * @param mode Ringer mode. + * @param callback Callback used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Volume + * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY + * @systemapi + */ + setRingerMode(mode: AudioRingMode, callback: AsyncCallback): void; + /** + * Sets the ringer mode. This method uses a promise to return the result. + * @param mode Ringer mode. + * @return Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Volume + * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY + * @systemapi + */ + setRingerMode(mode: AudioRingMode): Promise; + + /** + * Obtains the ringer mode. This method uses an asynchronous callback to return the query result. + * @param callback Callback used to return the ringer mode. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Volume + */ + getRingerMode(callback: AsyncCallback): void; + /** + * Obtains the ringer mode. This method uses a promise to return the query result. + * @return Promise used to return the ringer mode. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Volume + */ + getRingerMode(): Promise; + + /** + * Listens for ringer mode change events. This method uses a callback to get ringer mode changes. + * @param callback Callback used to get the updated ringer mode. + * @throws { BusinessError } 401 - if input parameter type or number mismatch + * @throws { BusinessError } 6800101 - if input parameter value error + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Volume + */ + on(type: 'ringerModeChange', callback: Callback): void; + + /** + * Mutes or unmutes the microphone. This method uses an asynchronous callback to return the result. + * @param mute Mute status to set. The value true means to mute the microphone, and false means the opposite. + * @param callback Callback used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Volume + * @permission ohos.permission.MANAGE_AUDIO_CONFIG + */ + setMicrophoneMute(mute: boolean, callback: AsyncCallback): void; + /** + * Mutes or unmutes the microphone. This method uses a promise to return the result. + * @param mute Mute status to set. The value true means to mute the microphone, and false means the opposite. + * @return Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Volume + * @permission ohos.permission.MANAGE_AUDIO_CONFIG + */ + setMicrophoneMute(mute: boolean): Promise; + + /** + * Checks whether the microphone is muted. This method uses an asynchronous callback to return the query result. + * @param Callback used to return the mute status of the microphone. The value true means that the microphone is + * muted, and false means the opposite. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Volume + */ + isMicrophoneMute(callback: AsyncCallback): void; + /** + * Checks whether the microphone is muted. This method uses a promise to return the query result. + * @return Promise used to return the mute status of the microphone. The value true means that the microphone is + * muted, and false means the opposite. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Volume + */ + isMicrophoneMute(): Promise; + + /** + * Listens for system microphone state change events. This method uses a callback to get microphone change events. + * @param callback Callback used to get the system microphone state change event. + * @throws { BusinessError } 401 - if input parameter type or number mismatch + * @throws { BusinessError } 6800101 - if input parameter value error + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Volume + */ + on(type: 'micStateChange', callback: Callback): void; } /** @@ -1766,15 +2082,16 @@ declare namespace audio { */ enum ConnectType { /** - * Descript connect type for local device. + * Connect type for local device. * @since 9 - * @syscap SystemCapability.Multimedia.Audio.Device + * @syscap SystemCapability.Multimedia.Audio.Volume */ CONNECT_TYPE_LOCAL = 1, + /** - * Descript virtual type for local device. + * Connect type for distributed device. * @since 9 - * @syscap SystemCapability.Multimedia.Audio.Device + * @syscap SystemCapability.Multimedia.Audio.Volume */ CONNECT_TYPE_DISTRIBUTED = 2 } @@ -1792,25 +2109,29 @@ declare namespace audio { * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi */ - readonly networkId: string; + readonly networkId: string; + /** * Volume group id. * @since 9 * @syscap SystemCapability.Multimedia.Audio.Volume */ readonly groupId: number; + /** * Volume mapping group id. * @since 9 * @syscap SystemCapability.Multimedia.Audio.Volume */ readonly mappingId: number; + /** * Volume group name. * @since 9 * @syscap SystemCapability.Multimedia.Audio.Volume */ readonly groupName: string; + /** * Connect type of device for this group. * @since 9 @@ -1952,42 +2273,42 @@ declare namespace audio { /** * Audio device id. * @since 9 - * @SysCap SystemCapability.Multimedia.Audio.Device + * @syscap SystemCapability.Multimedia.Audio.Device */ readonly id: number; /** * Audio device name. * @since 9 - * @SysCap SystemCapability.Multimedia.Audio.Device + * @syscap SystemCapability.Multimedia.Audio.Device */ readonly name: string; /** * Audio device address. * @since 9 - * @SysCap SystemCapability.Multimedia.Audio.Device + * @syscap SystemCapability.Multimedia.Audio.Device */ readonly address: string; /** * Supported sampling rates. * @since 9 - * @SysCap SystemCapability.Multimedia.Audio.Device + * @syscap SystemCapability.Multimedia.Audio.Device */ readonly sampleRates: Array; /** * Supported channel counts. * @since 9 - * @SysCap SystemCapability.Multimedia.Audio.Device + * @syscap SystemCapability.Multimedia.Audio.Device */ readonly channelCounts: Array; /** * Supported channel masks. * @since 9 - * @SysCap SystemCapability.Multimedia.Audio.Device + * @syscap SystemCapability.Multimedia.Audio.Device */ readonly channelMasks: Array; /** @@ -2064,6 +2385,8 @@ declare namespace audio { * is interrupted by another application, the callback is invoked to notify the former application. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Renderer + * @deprecated since 9 + * @useinstead ohos.multimedia.audio.InterruptEvent */ interface InterruptAction { @@ -2072,6 +2395,7 @@ declare namespace audio { * The value TYPE_ACTIVATED means the focus gain event, and TYPE_INTERRUPT means the audio interruption event. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Renderer + * @deprecated since 9 */ actionType: InterruptActionType; @@ -2079,6 +2403,7 @@ declare namespace audio { * Type of the audio interruption event. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Renderer + * @deprecated since 9 */ type?: InterruptType; @@ -2086,6 +2411,7 @@ declare namespace audio { * Hint for the audio interruption event. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Renderer + * @deprecated since 9 */ hint?: InterruptHint; @@ -2094,6 +2420,7 @@ declare namespace audio { * and false means that the focus fails to be gained or released. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Renderer + * @deprecated since 9 */ activated?: boolean; } @@ -2102,6 +2429,7 @@ declare namespace audio { * Describes input parameters of audio listening events. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Renderer + * @deprecated since 9 */ interface AudioInterrupt { @@ -2109,6 +2437,7 @@ declare namespace audio { * Audio stream usage type. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Renderer + * @deprecated since 9 */ streamUsage: StreamUsage; @@ -2116,6 +2445,7 @@ declare namespace audio { * Type of the media interrupted. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Renderer + * @deprecated since 9 */ contentType: ContentType; @@ -2124,6 +2454,7 @@ declare namespace audio { * The value true means that audio playback can be paused when it is interrupted, and false means the opposite. * @since 7 * @syscap SystemCapability.Multimedia.Audio.Renderer + * @deprecated since 9 */ pauseWhenDucked: boolean; } @@ -2174,6 +2505,7 @@ declare namespace audio { * @syscap SystemCapability.Multimedia.Audio.Renderer */ readonly state: AudioState; + /** * Obtains the renderer information provided while creating a renderer instance. This method uses an asynchronous * callback to return the result. @@ -2190,6 +2522,7 @@ declare namespace audio { * @syscap SystemCapability.Multimedia.Audio.Renderer */ getRendererInfo(): Promise; + /** * Obtains the renderer stream information. This method uses an asynchronous callback to return the result. * @param callback Callback used to return the stream information. @@ -2204,6 +2537,22 @@ declare namespace audio { * @syscap SystemCapability.Multimedia.Audio.Renderer */ getStreamInfo(): Promise; + + /** + * Obtains the renderer stream id. This method uses an asynchronous callback to return the result. + * @param callback Callback used to return the stream id. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Renderer + */ + getAudioStreamId(callback: AsyncCallback): void; + /** + * Obtains the renderer stream id. This method uses a promise to return the result. + * @return Promise used to return the stream id. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Renderer + */ + getAudioStreamId(): Promise; + /** * Starts the renderer. This method uses an asynchronous callback to return the result. * @param callback Callback used to return the result. @@ -2218,6 +2567,7 @@ declare namespace audio { * @syscap SystemCapability.Multimedia.Audio.Renderer */ start(): Promise; + /** * Writes the buffer. This method uses an asynchronous callback to return the result. * @param buffer Buffer to be written. @@ -2235,6 +2585,7 @@ declare namespace audio { * @syscap SystemCapability.Multimedia.Audio.Renderer */ write(buffer: ArrayBuffer): Promise; + /** * Obtains the timestamp in Unix epoch time (starts from January 1, 1970), in nanoseconds. This method uses an * asynchronous callback to return the result. @@ -2251,6 +2602,7 @@ declare namespace audio { * @syscap SystemCapability.Multimedia.Audio.Renderer */ getAudioTime(): Promise; + /** * Drains the playback buffer. This method uses an asynchronous callback to return the result. * @param callback Callback used to return the result. @@ -2265,6 +2617,7 @@ declare namespace audio { * @syscap SystemCapability.Multimedia.Audio.Renderer */ drain(): Promise; + /** * Pauses rendering. This method uses an asynchronous callback to return the result. * @param callback Callback used to return the result. @@ -2279,6 +2632,7 @@ declare namespace audio { * @syscap SystemCapability.Multimedia.Audio.Renderer */ pause(): Promise; + /** * Stops rendering. This method uses an asynchronous callback to return the result. * @param callback Callback used to return the result. @@ -2293,6 +2647,7 @@ declare namespace audio { * @syscap SystemCapability.Multimedia.Audio.Renderer */ stop(): Promise; + /** * Releases the renderer. This method uses an asynchronous callback to return the result. * @param callback Callback used to return the result. @@ -2307,6 +2662,7 @@ declare namespace audio { * @syscap SystemCapability.Multimedia.Audio.Renderer */ release(): Promise; + /** * Obtains a reasonable minimum buffer size in bytes for rendering. This method uses an asynchronous callback to * return the result. @@ -2322,6 +2678,7 @@ declare namespace audio { * @syscap SystemCapability.Multimedia.Audio.Renderer */ getBufferSize(): Promise; + /** * Sets the render rate. This method uses an asynchronous callback to return the result. * @param rate Audio render rate. @@ -2338,6 +2695,7 @@ declare namespace audio { * @syscap SystemCapability.Multimedia.Audio.Renderer */ setRenderRate(rate: AudioRendererRate): Promise; + /** * Obtains the current render rate. This method uses an asynchronous callback to return the result. * @param callback Callback used to return the audio render rate. @@ -2352,12 +2710,13 @@ declare namespace audio { * @syscap SystemCapability.Multimedia.Audio.Renderer */ getRenderRate(): Promise; + /** * Set interrupt mode. * @param mode The interrupt mode. * @param callback Callback used to return the result. * @since 9 - * @syscap SystemCapability.Multimedia.Audio.Renderer + * @syscap SystemCapability.Multimedia.Audio.Interrupt */ setInterruptMode(mode: InterruptMode, callback: AsyncCallback): void; /** @@ -2365,17 +2724,38 @@ declare namespace audio { * @param mode The interrupt mode. * @return Promise used to return the result. * @since 9 - * @syscap SystemCapability.Multimedia.Audio.Renderer + * @syscap SystemCapability.Multimedia.Audio.Interrupt */ setInterruptMode(mode: InterruptMode): Promise; + + /** + * Sets the volume for this stream. This method uses an asynchronous callback to return the result. + * @param volume Volume to set. The value range can be obtained by calling getMinVolume and getMaxVolume. + * @param callback Callback used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Renderer + */ + setVolume(volume: number, callback: AsyncCallback): void; + /** + * Sets the volume for a stream. This method uses a promise to return the result. + * @param volume Volume to set. The value range can be obtained by calling getMinVolume and getMaxVolume. + * @return Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Renderer + */ + setVolume(volume: number): Promise; + /** * Listens for audio interrupt events. This method uses a callback to get interrupt events. The interrupt event is * triggered when audio playback is interrupted. * @param callback Callback used to listen for interrupt callback. + * @throws { BusinessError } 401 - if input parameter type or number mismatch + * @throws { BusinessError } 6800101 - if input parameter value error * @since 9 - * @syscap SystemCapability.Multimedia.Audio.Renderer + * @syscap SystemCapability.Multimedia.Audio.Interrupt */ - on(type: 'interrupt', callback: Callback): void; + on(type: 'audioInterrupt', callback: Callback): void; + /** * Subscribes to mark reached events. When the number of frames rendered reaches the value of the frame parameter, * the callback is invoked. @@ -2391,6 +2771,7 @@ declare namespace audio { * @syscap SystemCapability.Multimedia.Audio.Renderer */ off(type: "markReach"): void; + /** * Subscribes to period reached events. When the period of frame rendering reaches the value of frame parameter, * the callback is invoked. @@ -2406,6 +2787,7 @@ declare namespace audio { * @syscap SystemCapability.Multimedia.Audio.Renderer */ off(type: "periodReach"): void; + /** * Subscribes audio state change event callback. * @param callback Callback invoked when state change. @@ -2438,7 +2820,7 @@ declare namespace audio { * @since 9 * @syscap SystemCapability.Multimedia.Audio.Core */ - SOURCE_TYPE_VOICE_RECOGNITION = 1, + SOURCE_TYPE_VOICE_RECOGNITION = 1, /** * Voice communication source type. * @since 8 @@ -2499,6 +2881,7 @@ declare namespace audio { * @syscap SystemCapability.Multimedia.Audio.Capturer */ readonly state: AudioState; + /** * Obtains the capturer information provided while creating a capturer instance. This method uses an asynchronous * callback to return the result. @@ -2531,6 +2914,21 @@ declare namespace audio { */ getStreamInfo(): Promise; + /** + * Obtains the capturer stream id. This method uses an asynchronous callback to return the result. + * @param callback Callback used to return the stream id. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Capturer + */ + getAudioStreamId(callback: AsyncCallback): void; + /** + * Obtains the capturer stream id. This method uses a promise to return the result. + * @return Promise used to return the stream id. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Capturer + */ + getAudioStreamId(): Promise; + /** * Starts capturing. This method uses an asynchronous callback to return the result. * @param callback Callback used to return the result. @@ -2668,6 +3066,13 @@ declare namespace audio { */ on(type: "stateChange", callback: Callback): void; } + + /** + * Enumerates tone types for player. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + * @systemapi + */ enum ToneType { /** * Dial tone for key 0. @@ -2784,7 +3189,7 @@ declare namespace audio { */ TONE_TYPE_COMMON_SUPERVISORY_CONGESTION = 102, /** - * Supervisory tone for radio path acknowlegment. + * Supervisory tone for radio path acknowledgment. * @since 9 * @syscap SystemCapability.Multimedia.Audio.Tone */ @@ -2814,7 +3219,7 @@ declare namespace audio { */ TONE_TYPE_COMMON_PROPRIETARY_BEEP = 200, /** - * Proprietary tone for positive acknowlegment. + * Proprietary tone for positive acknowledgment. * @since 9 * @syscap SystemCapability.Multimedia.Audio.Tone */ @@ -2837,10 +3242,11 @@ declare namespace audio { * Provides APIs for tone playing. * @since 9 * @syscap SystemCapability.Multimedia.Audio.Tone + * @systemapi */ interface TonePlayer { /** - * Starts player. This method uses an asynchronous callback to return the result. + * Loads tone. This method uses an asynchronous callback to return the result. * @param type Tone type to play. * @param callback Callback used to return the result. * @since 9 @@ -2848,7 +3254,7 @@ declare namespace audio { */ load(type: ToneType, callback: AsyncCallback): void; /** - * Starts tplayerone. This method uses a promise to return the result. + * Loads tone. This method uses a promise to return the result. * @param type Tone type to play. * @return Promise used to return the result. * @since 9 @@ -2903,4 +3309,4 @@ declare namespace audio { } } -export default audio; +export default audio; \ No newline at end of file diff --git a/api/@ohos.multimedia.avsession.d.ts b/api/@ohos.multimedia.avsession.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7934f63114b3aafe3f1e1422e80d3647afac232c --- /dev/null +++ b/api/@ohos.multimedia.avsession.d.ts @@ -0,0 +1,996 @@ +/* +* 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 { WantAgent } from './@ohos.wantAgent'; +import { KeyEvent } from './@ohos.multimodalInput.keyEvent'; +import { ElementName } from './bundleManager/elementName'; +import image from './@ohos.multimedia.image'; +import audio from './@ohos.multimedia.audio'; + +/** + * @name avSession + * @syscap SystemCapability.Multimedia.AVSession.Core + * @import import avsession from '@ohos.multimedia.avsession'; + * @since 9 + */ +declare namespace avSession { + /** + * Create an AVSession instance. An ability can only create one AVSession + * @param context The context of application + * @param tag A user-defined name for this session + * @param type The type of session {@link AVSessionType} + * @param {AsyncCallback} [callback] - callback. + * @returns {void | Promise} no callback returns Promise otherwise returns void + * @throws {BusinessError} 401 - parameter check failed + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + function createAVSession(context: Context, tag: string, type: AVSessionType, callback: AsyncCallback): void; + function createAVSession(context: Context, tag: string, type: AVSessionType): Promise; + + /** + * Get all avsession descriptors of the system + * @permission ohos.permission.MANAGE_MEDIA_RESOURCES + * @returns The array of {@link AVSessionDescriptor} + * @throws {BusinessError} 201 - permission denied + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @syscap SystemCapability.Multimedia.AVSession.Manager + * @systemapi + * @since 9 + */ + function getAllSessionDescriptors(callback: AsyncCallback>>): void; + function getAllSessionDescriptors(): Promise>>; + + /** + * Create an avsession controller + * @permission ohos.permission.MANAGE_MEDIA_RESOURCES + * @param sessionId Specifies the sessionId to create the controller. + * If provided 'default', the system will create a default controller, Used to control the system default session + * @returns An instance of {@link AVSessionController} + * @throws {BusinessError} 201 - permission denied + * @throws {BusinessError} 401 - parameter check failed + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist + * @syscap SystemCapability.Multimedia.AVSession.Manager + * @systemapi + * @since 9 + */ + function createController(sessionId: string, callback: AsyncCallback): void; + function createController(sessionId: string): Promise; + + /** + * Cast Audio to the remote devices or cast back local device + * @permission ohos.permission.MANAGE_MEDIA_RESOURCES + * @param audioDevices Specifies the audio devices to cast. + * @param sessionId Specifies the sessionId which to send to remote. + * 'all' means cast all the media audio of this device to remote. + * @throws {BusinessError} 201 - permission denied + * @throws {BusinessError} 401 - parameter check failed + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist + * @throws {BusinessError} {@link #ERR_CODE_REMOTE_CONNECTION_ERR} - remote connection error + * @syscap SystemCapability.Multimedia.AVSession.Manager + * @systemapi + * @since 9 + */ + function castAudio(session: SessionToken | 'all', audioDevices: Array, callback: AsyncCallback): void; + function castAudio(session: SessionToken | 'all', audioDevices: Array): Promise; + + /** + * Session token. Used to judge the legitimacy of the session. + * @permission ohos.permission.MANAGE_MEDIA_RESOURCES + * @syscap SystemCapability.Multimedia.AVSession.Manager + * @systemapi + * @since 9 + */ + interface SessionToken { + /** + * The unique session id of the avsession object + * @since 9 + */ + sessionId: string; + /** + * Process id of session + * @since 9 + */ + pid: number; + /** + * User id + * @since 9 + */ + uid: number; + } + /** + * Register or unregister system session changed callback + * @permission ohos.permission.MANAGE_MEDIA_RESOURCES + * @param type Registration Type, session creation, deletion or top priority session changed + * @param callback Used to returns the descriptor of created or delete session + * @throws {BusinessError} 201 - permission denied + * @throws {BusinessError} 401 - parameter check failed + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @syscap SystemCapability.Multimedia.AVSession.Manager + * @systemapi + * @since 9 + */ + function on(type: 'sessionCreate' | 'sessionDestroy' | 'topSessionChange', callback: (session: AVSessionDescriptor) => void): void; + function off(type: 'sessionCreate' | 'sessionDestroy' | 'topSessionChange', callback?: (session: AVSessionDescriptor) => void): void; + + /** + * Register or unregister Session service death callback, notifying the application to clean up resources. + * @param type Registration Type + * @param callback Used to handle the session service death event. + * @throws {BusinessError} 201 - permission denied + * @throws {BusinessError} 401 - parameter check failed + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + function on(type: 'sessionServiceDie', callback: () => void): void; + function off(type: 'sessionServiceDie', callback?: () => void): void; + + /** + * Send system media key event.The system automatically selects the recipient. + * @permission ohos.permission.MANAGE_MEDIA_RESOURCES + * @param event The key event to be send + * @throws {BusinessError} 201 - permission denied + * @throws {BusinessError} 401 - parameter check failed + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @throws {BusinessError} {@link #ERR_CODE_COMMAND_INVALID} - command not supported + * @syscap SystemCapability.Multimedia.AVSession.Manager + * @systemapi + * @since 9 + */ + function sendSystemAVKeyEvent(event: KeyEvent, callback: AsyncCallback): void; + function sendSystemAVKeyEvent(event: KeyEvent): Promise; + + /** + * Send system control command.The system automatically selects the recipient. + * @permission ohos.permission.MANAGE_MEDIA_RESOURCES + * @param command The command to be send. See {@link AVControlCommand} + * @throws {BusinessError} 201 - permission denied + * @throws {BusinessError} 401 - parameter check failed + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @throws {BusinessError} {@link #ERR_CODE_COMMAND_INVALID} - command not supported + * @throws {BusinessError} {@link #ERR_CODE_MESSAGE_OVERLOAD} - command or event overload + * @syscap SystemCapability.Multimedia.AVSession.Manager + * @systemapi + * @since 9 + */ + function sendSystemControlCommand(command: AVControlCommand, callback: AsyncCallback): void; + function sendSystemControlCommand(command: AVControlCommand): Promise; + + /** + * session type. + */ + type AVSessionType = 'audio' | 'video'; + /** + * AVSession object. + * @interface AVSession + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + interface AVSession { + /** + * unique session Id + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + readonly sessionId: string; + + /** + * Set the metadata of this session. + * In addition to the required properties, users can fill in partially supported properties + * @param data {@link AVMetadata} + * @throws {BusinessError} 401 - parameter check failed + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + setAVMetadata(data: AVMetadata, callback: AsyncCallback): void; + setAVMetadata(data: AVMetadata): Promise; + + /** + * Set the playback state of this session. + * @param state {@link AVPlaybackState} + * @throws {BusinessError} 401 - parameter check failed + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + setAVPlaybackState(state: AVPlaybackState, callback: AsyncCallback): void; + setAVPlaybackState(state: AVPlaybackState): Promise; + + /** + * Set the ability to start the session corresponding to + * @param ability The WantAgent for launch the ability + * @since 9 + * @syscap SystemCapability.Multimedia.AVSession.Core + * @throws {BusinessError} 401 - parameter check failed + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist + */ + setLaunchAbility(ability: WantAgent, callback: AsyncCallback): void; + setLaunchAbility(ability: WantAgent): Promise; + + /** + * Get the current session's own controller + * @returns The instance of {@link AVSessionController} + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + getController(callback: AsyncCallback): void; + getController(): Promise; + + /** + * Get output device information + * @returns The instance of {@link OutputDeviceInfo} + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + getOutputDevice(callback: AsyncCallback): void; + getOutputDevice(): Promise; + + /** + * Register or unregister playback command callback. + * As long as it is registered, it means that the ability supports this command. + * If you cancel the callback, you need to call off {@link off} + * When canceling the callback, need to update the supported commands list. + * Each playback command only supports registering one callback, + * and the new callback will replace the previous one. + * @param type Command to register. + * @param callback Used to handle callback commands + * @throws {BusinessError} 401 - parameter check failed + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + on(type: 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind', callback: () => void): void; + off(type: 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind', callback?: () => void): void; + + /** + * Register or unregister seek command callback + * @param type Registration Type 'seek' + * @param callback Used to handle seek command.The callback provide the seek time(ms) + * @throws {BusinessError} 401 - parameter check failed + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + on(type: 'seek', callback: (time: number) => void): void; + off(type: 'seek', callback?: (time: number) => void): void; + + /** + * Register or unregister setSpeed command callback + * @param type Registration Type 'setSpeed' + * @param callback Used to handle setSpeed command.The callback provide the speed value + * @throws {BusinessError} 401 - parameter check failed + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + on(type: 'setSpeed', callback: (speed: number) => void): void; + off(type: 'setSpeed', callback?: (speed: number) => void): void; + + /** + * Register or unregister setLoopMode command callback + * @param type Registration Type 'setLoopMode' + * @param callback Used to handle setLoopMode command.The callback provide the {@link LoopMode} + * @throws {BusinessError} 401 - parameter check failed + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + on(type: 'setLoopMode', callback: (mode: LoopMode) => void): void; + off(type: 'setLoopMode', callback?: (mode: LoopMode) => void): void; + + /** + * Register or unregister toggle favorite command callback + * @param type Registration Type 'toggleFavorite' + * @param callback Used to handle toggleFavorite command.The callback provide + * the assetId for which the favorite status needs to be switched. + * @throws {BusinessError} 401 - parameter check failed + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + on(type: 'toggleFavorite', callback: (assetId: string) => void): void; + off(type: 'toggleFavorite', callback?: (assetId: string) => void): void; + + /** + * Register or unregister media key handling callback + * @param type Registration Type + * @param callback Used to handle key events.The callback provide the KeyEvent + * @throws {BusinessError} 401 - parameter check failed + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + on(type: 'handleKeyEvent', callback: (event: KeyEvent) => void): void; + off(type: 'handleKeyEvent', callback?: (event: KeyEvent) => void): void; + + /** + * Register or unregister session output device change callback + * @param type Registration Type + * @param callback Used to handle output device changed. + * The callback provide the new device info {@link OutputDeviceInfo} + * @throws {BusinessError} 401 - parameter check failed + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + on(type: 'outputDeviceChange', callback: (device: OutputDeviceInfo) => void): void; + off(type: 'outputDeviceChange', callback?: (device: OutputDeviceInfo) => void): void; + + /** + * Activate the session, indicating that the session can accept control commands + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + activate(callback: AsyncCallback): void; + activate(): Promise; + + /** + * Deactivate the session, indicating that the session not ready to accept control commands + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + deactivate(callback: AsyncCallback): void; + deactivate(): Promise; + + /** + * Destroy this session, the server will clean up the session resources + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + destroy(callback: AsyncCallback): void; + destroy(): Promise; + } + + /** + * The metadata of the current media.Used to set the properties of the current media file + * @interface AVMetadata + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + interface AVMetadata { + /** + * Unique ID used to represent this media. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + assetId: string; + /** + * The title of this media, for display in media center. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + title?: string; + /** + * The artist of this media + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + artist?: string; + /** + * The author of this media + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + author?: string; + /** + * The album of this media + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + album?: string; + /** + * The writer of this media + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + writer?: string; + /** + * The composer of this media + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + composer?: string; + /** + * The duration of this media, used to automatically calculate playback position + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + duration?: number; + /** + * The image of the media as a {@link PixelMap} or an uri formatted String, + * used to display in media center. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + mediaImage?: image.PixelMap | string; + /** + * The publishDate of the media + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + publishDate?: Date; + /** + * The subtitle of the media, used for display + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + subtitle?: string; + /** + * The discription of the media, used for display + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + description?: string; + /** + * The lyric of the media, it should be in standard lyric format + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + lyric?: string; + /** + * The previous playable media id. + * Used to tell the controller if there is a previous playable media + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + previousAssetId?: string; + /** + * The next playable media id. + * Used to tell the controller if there is a next playable media + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + nextAssetId?: string; + } + + /** + * Used to indicate the playback state of the current media. + * If the playback state of the media changes, it needs to be updated synchronously + * @interface AVPlaybackState + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + interface AVPlaybackState { + /** + * Current playback state. See {@link PlaybackState} + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + state?: PlaybackState; + /** + * Current playback speed + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + speed?: number; + /** + * Current playback position of this media. See {@link PlaybackPosition} + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + position?: PlaybackPosition; + /** + * The current buffered time, the maximum playable position + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + bufferedTime?: number; + /** + * Current playback loop mode. See {@link LoopMode} + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + loopMode?: LoopMode; + /** + * Current Favorite Status + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + isFavorite?: boolean; + } + + /** + * Playback position definition + * @interface PlaybackPosition + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + interface PlaybackPosition { + /** + * Elapsed time(position) of this media set by the app. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + elapsedTime: number; + /** + * Record the system time when elapsedTime is set. + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + updateTime: number; + } + /** + * Target Device Information Definition + * @interface OutputDeviceInfo + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + interface OutputDeviceInfo { + /** + * Whether the remote device + * @since 9 + */ + isRemote: boolean; + /** + * Audio device id.The length of the audioDeviceId array is greater than 1 + * if output to multiple devices at the same time. + * @since 9 + */ + audioDeviceId: Array; + /** + * Device name. The length of the deviceName array is greater than 1 + * if output to multiple devices at the same time. + * @since 9 + */ + deviceName: Array; + } + /** + * Loop Play Mode Definition + * @enum {number} + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + enum LoopMode { + /** + * The default mode is sequential playback + * @since 9 + */ + LOOP_MODE_SEQUENCE = 0, + + /** + * Single loop mode + * @since 9 + */ + LOOP_MODE_SINGLE = 1, + + /** + * List loop mode + * @since 9 + */ + LOOP_MODE_LIST = 2, + + /** + * Shuffle playback mode + * @since 9 + */ + LOOP_MODE_SHUFFLE = 3, + } + + /** + * Definition of current playback state + * @enum {number} + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + enum PlaybackState { + /** + * Initial state. The initial state of media file + * @since 9 + */ + PLAYBACK_STATE_INITIAL = 0, + + /** + * Preparing state. Indicates that the media file is not ready to play, + * the media is loading or buffering + * @since 9 + */ + PLAYBACK_STATE_PREPARE = 1, + + /** + * Playing state. + * @since 9 + */ + PLAYBACK_STATE_PLAY = 2, + + /** + * Paused state. + * @since 9 + */ + PLAYBACK_STATE_PAUSE = 3, + + /** + * Fast forwarding state. + * @since 9 + */ + PLAYBACK_STATE_FAST_FORWARD = 4, + + /** + * Rewinding state. + * @since 9 + */ + PLAYBACK_STATE_REWIND = 5, + + /** + * Stopped state.The server will clear the media playback position and other information. + * @since 9 + */ + PLAYBACK_STATE_STOP = 6, + } + + /** + * The description of the session + * @interface AVSessionDescriptor + * @syscap SystemCapability.Multimedia.AVSession.Manager + * @systemapi + * @since 9 + */ + interface AVSessionDescriptor { + /** + * Unique ID of the session + * @since 9 + */ + sessionId: string; + /** + * Session type, currently supports audio or video + * @since 9 + */ + type: AVSessionType; + /** + * The session tag set by the application + * @since 9 + */ + sessionTag: string; + /** + * The elementName of the ability that created this session. See {@link ElementName} in bundle/elementName.d.ts + * @since 9 + */ + elementName: ElementName; + /** + * Session active state + * @since 9 + */ + isActive: boolean; + /** + * Is it the top priority session + * @since 9 + */ + isTopSession: boolean; + /** + * The current output device information. + * It will be undefined if this is a local session. + * @since 9 + */ + outputDevice: OutputDeviceInfo; + } + + /** + * Session controller,used to control media playback and get media information + * @interface AVSessionController + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + interface AVSessionController { + /** + * Unique session Id + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + readonly sessionId: string; + /** + * Get the playback status of the current session + * @returns AVPlaybackState {@link AVPlaybackState} + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist + * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist + * @since 9 + */ + getAVPlaybackState(callback: AsyncCallback): void; + getAVPlaybackState(): Promise; + + /** + * Get the metadata of the current session + * @returns AVMetadata {@link AVMetadata} + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist + * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist + * @since 9 + */ + getAVMetadata(callback: AsyncCallback): void; + getAVMetadata(): Promise; + + /** + * Get output device information + * @returns The instance of {@link OutputDeviceInfo} + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + getOutputDevice(callback: AsyncCallback): void; + getOutputDevice(): Promise; + + /** + * Send media key event to this session + * @param event The KeyEvent + * @throws {BusinessError} 401 - parameter check failed + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist + * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist + * @throws {BusinessError} {@link #ERR_CODE_COMMAND_INVALID} - command not supported + * @throws {BusinessError} {@link #ERR_CODE_SESSION_INACTIVE} - session inactive + * @since 9 + */ + sendAVKeyEvent(event: KeyEvent, callback: AsyncCallback): void; + sendAVKeyEvent(event: KeyEvent): Promise; + + /** + * Get the {@link WantAgent} of this session that can launch the session ability + * @returns WantAgent {@link WantAgent} + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist + * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist + * @since 9 + */ + getLaunchAbility(callback: AsyncCallback): void; + getLaunchAbility(): Promise; + + /** + * Get the adjusted playback position. The time automatically calculated by the system + * taking into account factors such as playback status, playback speed, and application update time. + * @returns current playback position in ms.Note that the returns value of each call will be different. + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist + * @since 9 + */ + getRealPlaybackPositionSync(): number; + + /** + * Check if the current session is active + * @returns the active state + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist + * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist + * @since 9 + */ + isActive(callback: AsyncCallback): void; + isActive(): Promise; + + /** + * Destroy the server controller + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist + * @since 9 + */ + destroy(callback: AsyncCallback): void; + destroy(): Promise; + + /** + * Get commands supported by the current session + * @returns An array of AVControlCommandType {@link AVControlCommandType} + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist + * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist + * @since 9 + */ + getValidCommands(callback: AsyncCallback>): void; + getValidCommands(): Promise>; + + /** + * Send control commands to this session + * @param command The command to be send. See {@link AVControlCommand} + * @throws {BusinessError} 401 - parameter check failed + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @throws {BusinessError} {@link #ERR_CODE_SESSION_NOT_EXIST} - session does not exist + * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist + * @throws {BusinessError} {@link #ERR_CODE_COMMAND_INVALID} - command not supported + * @throws {BusinessError} {@link #ERR_CODE_SESSION_INACTIVE} - session inactive + * @throws {BusinessError} {@link #ERR_CODE_MESSAGE_OVERLOAD} - command or event overload + * @since 9 + */ + sendControlCommand(command: AVControlCommand, callback: AsyncCallback): void; + sendControlCommand(command: AVControlCommand): Promise; + + /** + * Register or unregister metadata changed callback + * @param type 'metadataChange' + * @param filter The properties of {@link AVMetadata} that you cared about + * @param callback The callback used to handle metadata changed event. + * The callback function provides the {@link AVMetadata} parameter. + * It only contains the properties set in the filter. + * @throws {BusinessError} 401 - parameter check failed + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist + * @since 9 + */ + on(type: 'metadataChange', filter: Array | 'all', callback: (data: AVMetadata) => void); + off(type: 'metadataChange', callback?: (data: AVMetadata) => void); + + /** + * Register or unregister playback state changed callback + * @param type 'playbackStateChange' + * @param filter The properties of {@link AVPlaybackState} that you cared about + * @param callback The callback used to handle playback state changed event. + * The callback function provides the {@link AVPlaybackState} parameter. + * @throws {BusinessError} 401 - parameter check failed + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist + * @since 9 + */ + on(type: 'playbackStateChange', filter: Array | 'all', callback: (state: AVPlaybackState) => void); + off(type: 'playbackStateChange', callback?: (state: AVPlaybackState) => void); + + /** + * Register or unregister current session destroyed callback + * @param type 'sessionDestroy' + * @param callback The callback used to handle current session destroyed event. + * @throws {BusinessError} 401 - parameter check failed + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist + * @since 9 + */ + on(type: 'sessionDestroy', callback: () => void); + off(type: 'sessionDestroy', callback?: () => void); + + /** + * Register or unregister the active state of this session changed callback + * @param type 'activeStateChange' + * @param callback The callback used to handle the active state of this session changed event. + * The callback function provides the changed session state. + * @throws {BusinessError} 401 - parameter check failed + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist + * @since 9 + */ + on(type: 'activeStateChange', callback: (isActive: boolean) => void); + off(type: 'activeStateChange', callback?: (isActive: boolean) => void); + + /** + * Register or unregister the valid commands of the session changed callback + * @param type 'validCommandChange' + * @param callback The callback used to handle the changes. + * The callback function provides an array of AVControlCommandType. + * @throws {BusinessError} 401 - parameter check failed + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist + * @since 9 + */ + on(type: 'validCommandChange', callback: (commands: Array) => void); + off(type: 'validCommandChange', callback?: (commands: Array) => void); + + /** + * Register or unregister session output device change callback + * @param type Registration Type + * @param callback Used to handle output device changed. + * The callback provide the new device info {@link OutputDeviceInfo} + * @throws {BusinessError} 401 - parameter check failed + * @throws {BusinessError} {@link #ERR_CODE_SERVICE_EXCEPTION} - server exception + * @throws {BusinessError} {@link #ERR_CODE_CONTROLLER_NOT_EXIST} - controller does not exist + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + on(type: 'outputDeviceChange', callback: (device: OutputDeviceInfo) => void): void; + off(type: 'outputDeviceChange', callback?: (device: OutputDeviceInfo) => void): void; + } + + /** + * The type of control command + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + type AVControlCommandType = 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind' | + 'seek' | 'setSpeed' | 'setLoopMode' | 'toggleFavorite'; + + /** + * The definition of command to be sent to the session + * @interface AVControlCommand + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + interface AVControlCommand { + /** + * The command value {@link AVControlCommandType} + * @since 9 + */ + command: AVControlCommandType; + /** + * parameter of the command. Whether this command requires parameters, see {@link AVSessionCommand} + * seek command requires a number parameter + * setSpeed command requires a number parameter + * setLoopMode command requires a {@link LoopMode} parameter. + * toggleFavorite command requires assetId {@link AVMetadata.assetId} parameter + * other commands need no parameter + * @since 9 + */ + parameter?: LoopMode | string | number; + } + + /** + * Enumerates ErrorCode types, returns in BusinessError.code. + * @enum {number} + * @syscap SystemCapability.Multimedia.AVSession.Core + * @since 9 + */ + enum AVSessionErrorCode { + /** + * Server exception + * @since 9 + */ + ERR_CODE_SERVICE_EXCEPTION = 6600101, + + /** + * The session does not exist + * @since 9 + */ + ERR_CODE_SESSION_NOT_EXIST = 6600102, + + /** + * The controller does not exist + * @since 9 + */ + ERR_CODE_CONTROLLER_NOT_EXIST = 6600103, + + /** + * Remote connection error + * @since 9 + */ + ERR_CODE_REMOTE_CONNECTION_ERR = 6600104, + + /** + * Command not supported + * @since 9 + */ + ERR_CODE_COMMAND_INVALID = 6600105, + + /** + * Session inactive + * @since 9 + */ + ERR_CODE_SESSION_INACTIVE = 6600106, + + /** + * Command or event overload + * @since 9 + */ + ERR_CODE_MESSAGE_OVERLOAD = 6600107, + } +} + +export default avSession; diff --git a/api/@ohos.multimedia.camera.d.ts b/api/@ohos.multimedia.camera.d.ts index 18c9ad1114e260e8815a209e9f199aff24ac1b89..dc5e379fd6c47537f84cb6f69b563bd8f3b9497a 100644 --- a/api/@ohos.multimedia.camera.d.ts +++ b/api/@ohos.multimedia.camera.d.ts @@ -19,7 +19,6 @@ import { Context } from './app/context'; /** * @name camera * @syscap SystemCapability.Multimedia.Camera.Core - * @import import camera from '@ohos.multimedia.camera'; * @since 9 */ declare namespace camera { @@ -36,7 +35,7 @@ declare namespace camera { /** * Creates a CameraManager instance. * @param context Current application context. - * @return Promise used to return the CameraManager instance. + * @returns Promise used to return the CameraManager instance. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ @@ -59,19 +58,105 @@ declare namespace camera { * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - CAMERA_STATUS_DISAPPEAR, + CAMERA_STATUS_DISAPPEAR = 1, /** * Available status. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - CAMERA_STATUS_AVAILABLE, + CAMERA_STATUS_AVAILABLE = 2, /** * Unavailable status. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - CAMERA_STATUS_UNAVAILABLE + CAMERA_STATUS_UNAVAILABLE = 3 + } + + /** + * Profile for camera streams. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + interface Profile { + /** + * Camera format. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + readonly format: CameraFormat; + /** + * Picture size. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + readonly size: Size; + } + + /** + * Frame rate range. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + interface FrameRateRange { + /** + * Min frame rate. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + readonly min: number; + /** + * Max frame rate. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + readonly max: number; + } + + /** + * Video profile. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + interface VideoProfile extends Profile { + /** + * Frame rate in unit fps (frames per second). + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + readonly frameRateRange: FrameRateRange; + } + + /** + * Camera output capability. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + interface CameraOutputCapability { + /** + * Preview profiles. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + readonly previewProfiles: Array; + /** + * Photo profiles. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + readonly photoProfiles: Array; + /** + * Video profiles. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + readonly videoProfiles: Array; + /** + * All the supported metadata Object Types. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + readonly supportedMetadataObjectTypes: Array; } /** @@ -81,40 +166,84 @@ declare namespace camera { */ interface CameraManager { /** - * Gets all camera descriptions. + * Gets supported camera descriptions. * @param callback Callback used to return the array of supported cameras. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - getCameras(callback: AsyncCallback>): void; + getSupportedCameras(callback: AsyncCallback>): void; + + /** + * Gets supported camera descriptions. + * @returns Promise used to return an array of supported cameras. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + getSupportedCameras(): Promise>; + + /** + * Gets supported output capability for specific camera. + * @param camera Camera device. + * @param callback Callback used to return the camera output capability. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + getSupportedOutputCapability(camera: CameraDevice, callback: AsyncCallback): void; + + /** + * Gets supported output capability for specific camera. + * @param camera Camera device. + * @returns Promise used to return the camera output capability. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + getSupportedOutputCapability(camera: CameraDevice): Promise; + + /** + * Determine whether camera is muted. + * @returns Is camera muted. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + isCameraMuted(): boolean; /** - * Gets all camera descriptions. - * @return Promise used to return an array of supported cameras. + * Determine whether camera mute is supported. + * @returns Is camera mute supported. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi */ - getCameras(): Promise>; + isCameraMuteSupported(): boolean; /** - * Creates a CameraInput instance by camera id. - * @param cameraId Camera ID used to create the instance. + * Mute camera. + * @param mute Mute camera if TRUE, otherwise unmute camera. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + */ + muteCamera(mute: boolean): void; + + /** + * Creates a CameraInput instance by camera. + * @param camera Camera device used to create the instance. * @param callback Callback used to return the CameraInput instance. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core * @permission ohos.permission.CAMERA */ - createCameraInput(cameraId: string, callback: AsyncCallback): void; + createCameraInput(camera: CameraDevice, callback: AsyncCallback): void; /** - * Creates a CameraInput instance by camera id. - * @param cameraId Camera ID used to create the instance. - * @return Promise used to return the CameraInput instance. + * Creates a CameraInput instance by camera. + * @param camera Camera device used to create the instance. + * @returns Promise used to return the CameraInput instance. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core * @permission ohos.permission.CAMERA */ - createCameraInput(cameraId: string): Promise; + createCameraInput(camera: CameraDevice): Promise; /** * Creates a CameraInput instance by camera position and type. @@ -131,13 +260,107 @@ declare namespace camera { * Creates a CameraInput instance by camera position and type. * @param position Target camera position. * @param type Target camera type. - * @return Promise used to return the CameraInput instance. + * @returns Promise used to return the CameraInput instance. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core * @permission ohos.permission.CAMERA */ createCameraInput(position: CameraPosition, type: CameraType): Promise; + /** + * Creates a PreviewOutput instance. + * @param profile Preview output profile. + * @param surfaceId Surface object id used in camera photo output. + * @param callback Callback used to return the PreviewOutput instance. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + createPreviewOutput(profile: Profile, surfaceId: string, callback: AsyncCallback): void; + + /** + * Creates a PreviewOutput instance. + * @param profile Preview output profile. + * @param surfaceId Surface object id used in camera photo output. + * @returns Promise used to return the PreviewOutput instance. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + createPreviewOutput(profile: Profile, surfaceId: string): Promise; + + /** + * Creates a PhotoOutput instance. + * @param profile Photo output profile. + * @param surfaceId Surface object id used in camera photo output. + * @param callback Callback used to return the PhotoOutput instance. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + createPhotoOutput(profile: Profile, surfaceId: string, callback: AsyncCallback): void; + + /** + * Creates a PhotoOutput instance. + * @param profile Photo output profile. + * @param surfaceId Surface object id used in camera photo output. + * @returns Promise used to return the PhotoOutput instance. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + createPhotoOutput(profile: Profile, surfaceId: string): Promise; + + /** + * Creates a VideoOutput instance. + * @param profile Video profile. + * @param surfaceId Surface object id used in camera video output. + * @param callback Callback used to return the VideoOutput instance. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + createVideoOutput(profile: VideoProfile, surfaceId: string, callback: AsyncCallback): void; + + /** + * Creates a VideoOutput instance. + * @param profile Video profile. + * @param surfaceId Surface object id used in camera video output. + * @returns Promise used to return the VideoOutput instance. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + createVideoOutput(profile: VideoProfile, surfaceId: string): Promise; + + /** + * Creates a MetadataOutput instance. + * @param metadataObjectTypes Array of MetadataObjectType. + * @param callback Callback used to return the MetadataOutput instance. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + createMetadataOutput(metadataObjectTypes: Array, callback: AsyncCallback): void; + + /** + * Creates a MetadataOutput instance. + * @param metadataObjectTypes Array of MetadataObjectType. + * @returns Promise used to return the MetadataOutput instance. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + createMetadataOutput(metadataObjectTypes: Array): Promise; + + /** + * Gets a CaptureSession instance. + * @param callback Callback used to return the CaptureSession instance. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + createCaptureSession(callback: AsyncCallback): void; + + /** + * Gets a CaptureSession instance. + * @returns Promise used to return the CaptureSession instance. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + createCaptureSession(): Promise; + /** * Subscribes camera status change event callback. * @param type Event type. @@ -146,6 +369,16 @@ declare namespace camera { * @syscap SystemCapability.Multimedia.Camera.Core */ on(type: 'cameraStatus', callback: AsyncCallback): void; + + /** + * Subscribes camera mute change event callback. + * @param type Event type. + * @param callback Callback used to get the camera mute change. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + * @systemapi + */ + on(type: 'cameraMute', callback: AsyncCallback): void; } /** @@ -159,7 +392,7 @@ declare namespace camera { * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - camera: Camera; + camera: CameraDevice; /** * Current camera status. * @since 9 @@ -185,13 +418,13 @@ declare namespace camera { * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - CAMERA_POSITION_BACK, + CAMERA_POSITION_BACK = 1, /** * Front position. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - CAMERA_POSITION_FRONT + CAMERA_POSITION_FRONT = 2 } /** @@ -212,28 +445,28 @@ declare namespace camera { * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - CAMERA_TYPE_WIDE_ANGLE, + CAMERA_TYPE_WIDE_ANGLE = 1, /** * Ultra wide camera * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - CAMERA_TYPE_ULTRA_WIDE, + CAMERA_TYPE_ULTRA_WIDE = 2, /** * Telephoto camera * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - CAMERA_TYPE_TELEPHOTO, + CAMERA_TYPE_TELEPHOTO = 3, /** * True depth camera * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - CAMERA_TYPE_TRUE_DEPTH + CAMERA_TYPE_TRUE_DEPTH = 4 } /** @@ -254,22 +487,22 @@ declare namespace camera { * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - CAMERA_CONNECTION_USB_PLUGIN, + CAMERA_CONNECTION_USB_PLUGIN = 1, /** * Remote camera * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - CAMERA_CONNECTION_REMOTE + CAMERA_CONNECTION_REMOTE = 2 } /** - * Camera object. + * Camera device object. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - interface Camera { + interface CameraDevice { /** * Camera id attribute. * @since 9 @@ -317,284 +550,217 @@ declare namespace camera { } /** - * Camera input object. + * Point parameter. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - interface CameraInput { + interface Point { /** - * Gets camera id. - * @param callback Callback used to return the camera ID. + * x co-ordinate * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - getCameraId(callback: AsyncCallback): void; - + x: number; /** - * Gets camera id. - * @return Promise used to return the camera ID. + * y co-ordinate * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - getCameraId(): Promise; + y: number; + } + /** + * Camera input object. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + interface CameraInput { /** - * Check if device has flash light. - * @param callback Callback used to return the flash light support status. + * Open camera. + * @param callback Callback used to return the result. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - hasFlash(callback: AsyncCallback): void; + open(callback: AsyncCallback): void; /** - * Check if device has flash light. - * @return Promise used to return the flash light support status. + * Open camera. + * @returns Promise used to return the result. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - hasFlash(): Promise; + open(): Promise; /** - * Checks whether a specified flash mode is supported. - * @param flashMode Flash mode. - * @param callback Callback used to return the flash light support status. + * Close camera. + * @param callback Callback used to return the result. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - isFlashModeSupported(flashMode: FlashMode, callback: AsyncCallback): void; + close(callback: AsyncCallback): void; /** - * Checks whether a specified flash mode is supported. - * @param flashMode Flash mode - * @return Promise used to return flash mode support status. + * Close camera. + * @returns Promise used to return the result. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - isFlashModeSupported(flashMode: FlashMode): Promise; + close(): Promise; /** - * Gets current flash mode. - * @param callback Callback used to return the current flash mode. + * Releases instance. + * @param callback Callback used to return the result. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - getFlashMode(callback: AsyncCallback): void; + release(callback: AsyncCallback): void; /** - * Gets current flash mode. - * @return Promise used to return the flash mode. + * Releases instance. + * @returns Promise used to return the result. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - getFlashMode(): Promise; + release(): Promise; /** - * Sets flash mode. - * @param flashMode Target flash mode. - * @param callback Callback used to return the result. + * Subscribes error event callback. + * @param type Event type. + * @param camera Camera device. + * @param callback Callback used to get the camera input errors. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - setFlashMode(flashMode: FlashMode, callback: AsyncCallback): void; + on(type: 'error', camera: CameraDevice, callback: ErrorCallback): void; + } + /** + * Enum for CameraInput error code. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + enum CameraInputErrorCode { /** - * Sets flash mode. - * @param flashMode Target flash mode. - * @return Promise used to return the result. + * Unknown error. * @since 9 - * @syscap SystemCapability.Multimedia.Camera.Core */ - setFlashMode(flashMode: FlashMode): Promise; - + ERROR_UNKNOWN = -1, /** - * Checks whether a specified focus mode is supported. - * @param afMode Focus mode. - * @param callback Callback used to return the device focus support status. + * No permission. * @since 9 - * @syscap SystemCapability.Multimedia.Camera.Core */ - isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback): void; - + ERROR_NO_PERMISSION = 0, /** - * Checks whether a specified focus mode is supported. - * @param afMode Focus mode. - * @return Promise used to return the focus mode support status. + * Camera device preempted. * @since 9 - * @syscap SystemCapability.Multimedia.Camera.Core */ - isFocusModeSupported(afMode: FocusMode): Promise; - + ERROR_DEVICE_PREEMPTED = 1, /** - * Gets current focus mode. - * @param callback Callback used to return the current focus mode. + * Camera device disconnected. * @since 9 - * @syscap SystemCapability.Multimedia.Camera.Core */ - getFocusMode(callback: AsyncCallback): void; - + ERROR_DEVICE_DISCONNECTED = 2, /** - * Gets current focus mode. - * @return Promise used to return the focus mode. + * Camera device in use. * @since 9 - * @syscap SystemCapability.Multimedia.Camera.Core */ - getFocusMode(): Promise; - + ERROR_DEVICE_IN_USE = 3, /** - * Sets focus mode. - * @param afMode Target focus mode. - * @param callback Callback used to return the result. + * Driver error. * @since 9 - * @syscap SystemCapability.Multimedia.Camera.Core */ - setFocusMode(afMode: FocusMode, callback: AsyncCallback): void; + ERROR_DRIVER_ERROR = 4, + } + + /** + * Camera input error object. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + interface CameraInputError extends Error { + code: CameraInputErrorCode; + } + /** + * Enum for camera format type. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + enum CameraFormat { /** - * Sets focus mode. - * @param afMode Target focus mode. - * @return Promise used to return the result. + * RGBA 8888 Format. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - setFocusMode(afMode: FocusMode): Promise; + CAMERA_FORMAT_RGBA_8888 = 3, /** - * Gets all supported zoom ratio range. - * @param callback Callback used to return the zoom ratio range. + * YUV 420 Format. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - getZoomRatioRange(callback: AsyncCallback>): void; + CAMERA_FORMAT_YUV_420_SP = 1003, /** - * Gets all supported zoom ratio range. - * @return Promise used to return the zoom ratio range. + * JPEG Format. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - getZoomRatioRange(): Promise>; + CAMERA_FORMAT_JPEG = 2000 + } + /** + * Enum for flash mode. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + enum FlashMode { /** - * Gets zoom ratio. - * @param callback Callback used to return the current zoom ratio value. + * Close mode. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - getZoomRatio(callback: AsyncCallback): void; - + FLASH_MODE_CLOSE = 0, /** - * Gets zoom ratio. - * @return Promise used to return the zoom ratio value. - * @since 9 - * @syscap SystemCapability.Multimedia.Camera.Core - */ - getZoomRatio(): Promise; - - /** - * Sets zoom ratio. - * @param zoomRatio Target zoom ratio. - * @param callback Callback used to return the result. - * @since 9 - * @syscap SystemCapability.Multimedia.Camera.Core - */ - setZoomRatio(zoomRatio: number, callback: AsyncCallback): void; - - /** - * Sets zoom ratio. - * @param zoomRatio Target zoom ratio. - * @return Promise used to return the result. - * @since 9 - * @syscap SystemCapability.Multimedia.Camera.Core - */ - setZoomRatio(zoomRatio: number): Promise; - - /** - * Releases instance. - * @param callback Callback used to return the result. - * @since 9 - * @syscap SystemCapability.Multimedia.Camera.Core - */ - release(callback: AsyncCallback): void; - - /** - * Releases instance. - * @return Promise used to return the result. + * Open mode. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - release(): Promise; - + FLASH_MODE_OPEN = 1, /** - * Subscribes focus status change event callback. - * @param type Event type. - * @param callback Callback used to get the focus state change. + * Auto mode. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - on(type: 'focusStateChange', callback: AsyncCallback): void; - + FLASH_MODE_AUTO = 2, /** - * Subscribes error event callback. - * @param type Event type. - * @param callback Callback used to get the camera input errors. + * Always open mode. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - on(type: 'error', callback: ErrorCallback): void; - } - - /** - * Enum for CameraInput error code. - * @since 9 - * @syscap SystemCapability.Multimedia.Camera.Core - */ - enum CameraInputErrorCode { - /** - * Unknown error. - * @since 9 - */ - ERROR_UNKNOWN = -1 - } - - /** - * Camera input error object. - * @since 9 - * @syscap SystemCapability.Multimedia.Camera.Core - */ - interface CameraInputError extends Error { - code: CameraInputErrorCode; + FLASH_MODE_ALWAYS_OPEN = 3 } /** - * Enum for flash mode. + * Enum for exposure mode. * @since 9 - * @syscap SystemCapability.Multimedia.Camera.Core */ - enum FlashMode { + enum ExposureMode { /** - * Close mode. + * Lock exposure mode. * @since 9 - * @syscap SystemCapability.Multimedia.Camera.Core */ - FLASH_MODE_CLOSE = 0, + EXPOSURE_MODE_LOCKED = 0, /** - * Open mode. + * Auto exposure mode. * @since 9 - * @syscap SystemCapability.Multimedia.Camera.Core */ - FLASH_MODE_OPEN, - /** - * Auto mode. - * @since 9 - * @syscap SystemCapability.Multimedia.Camera.Core - */ - FLASH_MODE_AUTO, - /** - * Always open mode. + EXPOSURE_MODE_AUTO = 1, + /** + * Continuous automatic exposure. * @since 9 - * @syscap SystemCapability.Multimedia.Camera.Core */ - FLASH_MODE_ALWAYS_OPEN + EXPOSURE_MODE_CONTINUOUS_AUTO = 2 } /** @@ -614,19 +780,19 @@ declare namespace camera { * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - FOCUS_MODE_CONTINUOUS_AUTO, + FOCUS_MODE_CONTINUOUS_AUTO = 1, /** * Auto mode. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - FOCUS_MODE_AUTO, + FOCUS_MODE_AUTO = 2, /** * Locked mode. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - FOCUS_MODE_LOCKED + FOCUS_MODE_LOCKED = 3 } /** @@ -646,32 +812,52 @@ declare namespace camera { * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - FOCUS_STATE_FOCUSED, + FOCUS_STATE_FOCUSED = 1, /** * Unfocused state. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - FOCUS_STATE_UNFOCUSED + FOCUS_STATE_UNFOCUSED = 2 } /** - * Gets a CaptureSession instance. - * @param context Current application context. - * @param callback Callback used to return the CaptureSession instance. - * @since 9 - * @syscap SystemCapability.Multimedia.Camera.Core - */ - function createCaptureSession(context: Context, callback: AsyncCallback): void; - - /** - * Gets a CaptureSession instance. - * @param context Current application context. - * @return Promise used to return the CaptureSession instance. + * Enum for video stabilization mode. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - function createCaptureSession(context: Context): Promise; + enum VideoStabilizationMode { + /** + * Turn off video stablization. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + OFF = 0, + /** + * LOW mode provides basic stabilization effect. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + LOW = 1, + /** + * MIDDLE mode means algorithms can achieve better effects than LOW mode. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + MIDDLE = 2, + /** + * HIGH mode means algorithms can achieve better effects than MIDDLE mode. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + HIGH = 3, + /** + * Camera HDF can select mode automatically. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + AUTO = 4 + } /** * Capture session object. @@ -689,7 +875,7 @@ declare namespace camera { /** * Begin capture session config. - * @return Promise used to return the result. + * @returns Promise used to return the result. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ @@ -705,7 +891,7 @@ declare namespace camera { /** * Commit capture session config. - * @return Promise used to return the result. + * @returns Promise used to return the result. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ @@ -723,185 +909,530 @@ declare namespace camera { /** * Adds a camera input. * @param cameraInput Target camera input to add. - * @return Promise used to return the result. + * @returns Promise used to return the result. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ addInput(cameraInput: CameraInput): Promise; /** - * Adds a camera preview output. - * @param previewOutput Target camera preview output to add. + * Removes a camera input. + * @param cameraInput Target camera input to remove. * @param callback Callback used to return the result. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - addOutput(previewOutput: PreviewOutput, callback: AsyncCallback): void; + removeInput(cameraInput: CameraInput, callback: AsyncCallback): void; /** - * Adds a camera preview output. - * @param previewOutput Target camera preview output to add. - * @return Promise used to return the result. + * Removes a camera input. + * @param cameraInput Target camera input to remove. + * @returns Promise used to return the result. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - addOutput(previewOutput: PreviewOutput): Promise; + removeInput(cameraInput: CameraInput): Promise; /** - * Adds a camera photo output. - * @param photoOutput Target camera photo output to add. + * Adds a camera output. + * @param cameraOutput Target camera output to add. * @param callback Callback used to return the result. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - addOutput(photoOutput: PhotoOutput, callback: AsyncCallback): void; + addOutput(cameraOutput: CameraOutput, callback: AsyncCallback): void; /** - * Adds a camera photo output. - * @param photoOutput Target camera photo output to add. - * @return Promise used to return the result. + * Adds a camera output. + * @param cameraOutput Target camera output to add. + * @returns Promise used to return the result. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - addOutput(photoOutput: PhotoOutput): Promise; + addOutput(cameraOutput: CameraOutput): Promise; /** - * Adds a camera video output. - * @param videoOutput Target camera video output to add. + * Removes a camera output. + * @param previewOutput Target camera output to remove. * @param callback Callback used to return the result. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - addOutput(videoOutput: VideoOutput, callback: AsyncCallback): void; + removeOutput(cameraOutput: CameraOutput, callback: AsyncCallback): void; /** - * Adds a camera video output. - * @param videoOutput Target camera video output to add. - * @return Promise used to return the result. + * Removes a camera output. + * @param previewOutput Target camera output to remove. + * @returns Promise used to return the result. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - addOutput(videoOutput: VideoOutput): Promise; + removeOutput(cameraOutput: CameraOutput): Promise; /** - * Removes a camera input. - * @param cameraInput Target camera input to remove. + * Starts capture session. * @param callback Callback used to return the result. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - removeInput(cameraInput: CameraInput, callback: AsyncCallback): void; + start(callback: AsyncCallback): void; /** - * Removes a camera input. - * @param cameraInput Target camera input to remove. - * @return Promise used to return the result. + * Starts capture session. + * @returns Promise used to return the result. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - removeInput(cameraInput: CameraInput): Promise; + start(): Promise; /** - * Removes a camera preview output. - * @param previewOutput Target camera preview output to remove. + * Stops capture session. * @param callback Callback used to return the result. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - removeOutput(previewOutput: PreviewOutput, callback: AsyncCallback): void; + stop(callback: AsyncCallback): void; /** - * Removes a camera preview output. - * @param previewOutput Target camera preview output to remove. - * @return Promise used to return the result. + * Stops capture session. + * @returns Promise used to return the result. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - removeOutput(previewOutput: PreviewOutput): Promise; + stop(): Promise; /** - * Removes a camera photo output. - * @param photoOutput Target camera photo output to remove. + * Release capture session instance. * @param callback Callback used to return the result. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - removeOutput(photoOutput: PhotoOutput, callback: AsyncCallback): void; + release(callback: AsyncCallback): void; + + /** + * Release capture session instance. + * @returns Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + release(): Promise; + + /** + * Check if device has flash light. + * @param callback Callback used to return the flash light support status. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + hasFlash(callback: AsyncCallback): void; /** - * Removes a camera photo output. - * @param photoOutput Target camera photo output to remove. - * @return Promise used to return the result. + * Check if device has flash light. + * @returns Promise used to return the flash light support status. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - removeOutput(photoOutput: PhotoOutput): Promise; + hasFlash(): Promise; /** - * Removes a camera video output. - * @param videoOutput Target camera video output to remove. + * Checks whether a specified flash mode is supported. + * @param flashMode Flash mode. + * @param callback Callback used to return the flash light support status. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + isFlashModeSupported(flashMode: FlashMode, callback: AsyncCallback): void; + + /** + * Checks whether a specified flash mode is supported. + * @param flashMode Flash mode + * @returns Promise used to return flash mode support status. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + isFlashModeSupported(flashMode: FlashMode): Promise; + + /** + * Gets current flash mode. + * @param callback Callback used to return the current flash mode. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + getFlashMode(callback: AsyncCallback): void; + + /** + * Gets current flash mode. + * @returns Promise used to return the flash mode. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + getFlashMode(): Promise; + + /** + * Sets flash mode. + * @param flashMode Target flash mode. * @param callback Callback used to return the result. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - removeOutput(videoOutput: VideoOutput, callback: AsyncCallback): void; + setFlashMode(flashMode: FlashMode, callback: AsyncCallback): void; /** - * Removes a camera video output. - * @param videoOutput Target camera video output to remove. - * @return Promise used to return the result. + * Sets flash mode. + * @param flashMode Target flash mode. + * @returns Promise used to return the result. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - removeOutput(videoOutput: VideoOutput): Promise; + setFlashMode(flashMode: FlashMode): Promise; /** - * Starts capture session. + * Checks whether a specified exposure mode is supported. + * @param aeMode Exposure mode. + * @param callback Callback used to return the exposure mode support status. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + isExposureModeSupported(aeMode: ExposureMode, callback: AsyncCallback): void; + + /** + * Checks whether a specified exposure mode is supported. + * @param aeMode Exposure mode + * @returns Promise used to return exposure mode support status. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + isExposureModeSupported(aeMode: ExposureMode): Promise; + + /** + * Gets current exposure mode. + * @param callback Callback used to return the current exposure mode. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + getExposureMode(callback: AsyncCallback): void; + + /** + * Gets current exposure mode. + * @returns Promise used to return the current exposure mode. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + getExposureMode(): Promise; + + /** + * Sets exposure mode. + * @param aeMode Exposure mode * @param callback Callback used to return the result. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - start(callback: AsyncCallback): void; + setExposureMode(aeMode: ExposureMode, callback: AsyncCallback): void; + + /** + * Sets Exposure mode. + * @param aeMode Exposure mode + * @returns Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + setExposureMode(aeMode: ExposureMode): Promise; /** - * Starts capture session. - * @return Promise used to return the result. + * Gets current metering point. + * @param callback Callback used to return the current metering point. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - start(): Promise; + getMeteringPoint(callback: AsyncCallback): void; /** - * Stops capture session. + * Gets current metering point. + * @returns Promise used to return the current metering point. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + getMeteringPoint(): Promise; + + /** + * Set the center point of the metering area. + * @param point Metering point * @param callback Callback used to return the result. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - stop(callback: AsyncCallback): void; + setMeteringPoint(point: Point, callback: AsyncCallback): void; + + /** + * Set the center point of the metering area. + * @param point metering point + * @returns Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + setMeteringPoint(point: Point): Promise; /** - * Stops capture session. - * @return Promise used to return the result. + * Query the exposure compensation range. + * @param callback Callback used to return the array of compensation range. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - stop(): Promise; + getExposureBiasRange(callback: AsyncCallback>): void; /** - * Release capture session instance. + * Query the exposure compensation range. + * @returns Promise used to return the array of compensation range. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + getExposureBiasRange(): Promise>; + + /** + * Set exposure compensation. + * @param exposureBias Exposure compensation * @param callback Callback used to return the result. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - release(callback: AsyncCallback): void; + setExposureBias(exposureBias: number, callback: AsyncCallback): void; /** - * Release capture session instance. - * @return Promise used to return the result. + * Set exposure compensation. + * @param exposureBias Exposure compensation + * @returns Promise used to return the result. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - release(): Promise; + setExposureBias(exposureBias: number): Promise; + + /** + * Query the exposure value. + * @param callback Callback used to return the exposure value. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + getExposureValue(callback: AsyncCallback): void; + + /** + * Query the exposure value. + * @returns Promise used to return the exposure value. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + getExposureValue(): Promise; + + /** + * Checks whether a specified focus mode is supported. + * @param afMode Focus mode. + * @param callback Callback used to return the device focus support status. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + isFocusModeSupported(afMode: FocusMode, callback: AsyncCallback): void; + + /** + * Checks whether a specified focus mode is supported. + * @param afMode Focus mode. + * @returns Promise used to return the focus mode support status. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + isFocusModeSupported(afMode: FocusMode): Promise; + + /** + * Gets current focus mode. + * @param callback Callback used to return the current focus mode. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + getFocusMode(callback: AsyncCallback): void; + + /** + * Gets current focus mode. + * @returns Promise used to return the focus mode. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + getFocusMode(): Promise; + + /** + * Sets focus mode. + * @param afMode Target focus mode. + * @param callback Callback used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + setFocusMode(afMode: FocusMode, callback: AsyncCallback): void; + + /** + * Sets focus mode. + * @param afMode Target focus mode. + * @returns Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + setFocusMode(afMode: FocusMode): Promise; + + /** + * Sets focus point. + * @param point Target focus point. + * @param callback Callback used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + setFocusPoint(point: Point, callback: AsyncCallback): void; + + /** + * Sets focus point. + * @param afMode Target focus point. + * @returns Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + setFocusPoint(point: Point): Promise; + + /** + * Gets current focus point. + * @param callback Callback used to return the current focus point. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + getFocusPoint(callback: AsyncCallback): void; + + /** + * Gets current focus point. + * @returns Promise used to return the current focus point. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + getFocusPoint(): Promise; + + /** + * Gets current focal length. + * @param callback Callback used to return the current focal point. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + getFocalLength(callback: AsyncCallback): void; + + /** + * Gets current focal length. + * @returns Promise used to return the current focal point. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + getFocalLength(): Promise; + + /** + * Gets all supported zoom ratio range. + * @param callback Callback used to return the zoom ratio range. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + getZoomRatioRange(callback: AsyncCallback>): void; + + /** + * Gets all supported zoom ratio range. + * @returns Promise used to return the zoom ratio range. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + getZoomRatioRange(): Promise>; + + /** + * Gets zoom ratio. + * @param callback Callback used to return the current zoom ratio value. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + getZoomRatio(callback: AsyncCallback): void; + + /** + * Gets zoom ratio. + * @returns Promise used to return the zoom ratio value. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + getZoomRatio(): Promise; + + /** + * Sets zoom ratio. + * @param zoomRatio Target zoom ratio. + * @param callback Callback used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + setZoomRatio(zoomRatio: number, callback: AsyncCallback): void; + + /** + * Sets zoom ratio. + * @param zoomRatio Target zoom ratio. + * @returns Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + setZoomRatio(zoomRatio: number): Promise; + + /** + * Check whether the specified video stabilization mode is supported. + * @param vsMode Video Stabilization mode. + * @param callback Callback used to return if video stablization mode is supported. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode, callback: AsyncCallback): void; + + /** + * Check whether the specified video stabilization mode is supported. + * @param callback Callback used to return if video stablization mode is supported. + * @returns Promise used to return flash mode support status. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): Promise; + + /** + * Query the video stabilization mode currently in use. + * @param callback Callback used to return the current video stabilization mode. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + getActiveVideoStabilizationMode(callback: AsyncCallback): void; + + /** + * Query the video stabilization mode currently in use. + * @returns Promise used to return the current video stabilization mode. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + getActiveVideoStabilizationMode(): Promise; + + /** + * Set video stabilization mode. + * @param mode video stabilization mode to set. + * @param callback Callback used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + setVideoStabilizationMode(mode: VideoStabilizationMode, callback: AsyncCallback): void; + + /** + * Set video stabilization mode. + * @param mode video stabilization mode to set. + * @returns Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + setVideoStabilizationMode(mode: VideoStabilizationMode): Promise; + + /** + * Subscribes focus status change event callback. + * @param type Event type. + * @param callback Callback used to get the focus state change. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + on(type: 'focusStateChange', callback: AsyncCallback): void; /** * Subscribes error event callback. @@ -919,7 +1450,21 @@ declare namespace camera { * @syscap SystemCapability.Multimedia.Camera.Core */ enum CaptureSessionErrorCode { - ERROR_UNKNOWN = -1 + /** + * Unknown error. + * @since 9 + */ + ERROR_UNKNOWN = -1, + /** + * Insufficient resources. + * @since 9 + */ + ERROR_INSUFFICIENT_RESOURCES = 0, + /** + * Timeout error. + * @since 9 + */ + ERROR_TIMEOUT = 1, } /** @@ -932,44 +1477,65 @@ declare namespace camera { } /** - * Creates a PreviewOutput instance. - * @param surfaceId Surface object id used in camera preview output. - * @param callback Callback used to return the PreviewOutput instance. + * Camera output object. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + interface CameraOutput { + /** + * Release output instance. + * @param callback Callback used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + release(callback: AsyncCallback): void; + + /** + * Release output instance. + * @returns Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + release(): Promise; + } + + /** + * Preview output object. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - function createPreviewOutput(surfaceId: string, callback: AsyncCallback): void; + interface PreviewOutput extends CameraOutput { + /** + * Start output instance. + * @param callback Callback used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + start(callback: AsyncCallback): void; - /** - * Creates a PreviewOutput instance. - * @param surfaceId Surface object id used in camera preview output. - * @return Promise used to return the PreviewOutput instance. - * @since 9 - * @syscap SystemCapability.Multimedia.Camera.Core - */ - function createPreviewOutput(surfaceId: string): Promise; + /** + * Start output instance. + * @returns Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + start(): Promise; - /** - * Preview output object. - * @since 9 - * @syscap SystemCapability.Multimedia.Camera.Core - */ - interface PreviewOutput { /** - * Release output instance. + * Stop output instance. * @param callback Callback used to return the result. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - release(callback: AsyncCallback): void; + stop(callback: AsyncCallback): void; /** - * Release output instance. - * @return Promise used to return the result. + * Stop output instance. + * @returns Promise used to return the result. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - release(): Promise; + stop(): Promise; /** * Subscribes frame start event callback. @@ -1005,7 +1571,11 @@ declare namespace camera { * @syscap SystemCapability.Multimedia.Camera.Core */ enum PreviewOutputErrorCode { - ERROR_UNKNOWN = -1 + /** + * Unknown error. + * @since 9 + */ + ERROR_UNKNOWN = -1, } /** @@ -1017,24 +1587,6 @@ declare namespace camera { code: PreviewOutputErrorCode; } - /** - * Creates a PhotoOutput instance. - * @param surfaceId Surface object id used in camera photo output. - * @param callback Callback used to return the PhotoOutput instance. - * @since 9 - * @syscap SystemCapability.Multimedia.Camera.Core - */ - function createPhotoOutput(surfaceId: string, callback: AsyncCallback): void; - - /** - * Creates a PhotoOutput instance. - * @param surfaceId Surface object id used in camera photo output. - * @return Promise used to return the PhotoOutput instance. - * @since 9 - * @syscap SystemCapability.Multimedia.Camera.Core - */ - function createPhotoOutput(surfaceId: string): Promise; - /** * Enumerates the image rotation angles. * @since 9 @@ -1070,6 +1622,26 @@ declare namespace camera { ROTATION_270 = 270 } + interface Location { + /** + * Latitude. + * @since 9 + */ + latitude: number; + + /** + * Longitude. + * @since 9 + */ + longitude: number; + + /** + * Altitude. + * @since 9 + */ + altitude: number; + } + /** * Enumerates the image quality levels. * @since 9 @@ -1088,14 +1660,14 @@ declare namespace camera { * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - QUALITY_LEVEL_MEDIUM, + QUALITY_LEVEL_MEDIUM = 1, /** * Low image quality. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - QUALITY_LEVEL_LOW + QUALITY_LEVEL_LOW = 2 } /** @@ -1109,12 +1681,27 @@ declare namespace camera { * @syscap SystemCapability.Multimedia.Camera.Core */ quality?: QualityLevel; + /** * Photo rotation. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ rotation?: ImageRotation; + + /** + * Photo location. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + location?: Location; + + /** + * Set the mirror photo function switch, default to false. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + mirror?: boolean; } /** @@ -1122,7 +1709,7 @@ declare namespace camera { * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - interface PhotoOutput { + interface PhotoOutput extends CameraOutput { /** * Start capture output. * @param callback Callback used to return the result. @@ -1143,27 +1730,27 @@ declare namespace camera { /** * Start capture output. * @param setting Photo capture settings. - * @return Promise used to return the result. + * @returns Promise used to return the result. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ capture(setting?: PhotoCaptureSetting): Promise; /** - * Release output instance. - * @param callback Callback used to return the result. + * Check whether to support mirror photo. + * @param callback Callback used to return the mirror support status. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - release(callback: AsyncCallback): void; + isMirrorSupported(callback: AsyncCallback): void; /** - * Release output instance. - * @return Promise used to return the result. + * Check whether to support mirror photo. + * @returns Promise used to return the mirror support status. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - release(): Promise; + isMirrorSupported(): Promise; /** * Subscribes capture start event callback. @@ -1248,7 +1835,26 @@ declare namespace camera { * @syscap SystemCapability.Multimedia.Camera.Core */ enum PhotoOutputErrorCode { - ERROR_UNKNOWN = -1 + /** + * Unknown error. + * @since 9 + */ + ERROR_UNKNOWN = -1, + /** + * Driver error. + * @since 9 + */ + ERROR_DRIVER_ERROR = 0, + /** + * Insufficient resources. + * @since 9 + */ + ERROR_INSUFFICIENT_RESOURCES = 1, + /** + * Timeout error. + * @since 9 + */ + ERROR_TIMEOUT = 2 } /** @@ -1260,30 +1866,12 @@ declare namespace camera { code: PhotoOutputErrorCode; } - /** - * Creates a VideoOutput instance. - * @param surfaceId Surface object id used in camera video output. - * @param callback Callback used to return the VideoOutput instance. - * @since 9 - * @syscap SystemCapability.Multimedia.Camera.Core - */ - function createVideoOutput(surfaceId: string, callback: AsyncCallback): void; - - /** - * Creates a VideoOutput instance. - * @param surfaceId Surface object id used in camera video output. - * @return Promise used to return the VideoOutput instance. - * @since 9 - * @syscap SystemCapability.Multimedia.Camera.Core - */ - function createVideoOutput(surfaceId: string): Promise; - /** * Video output object. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ - interface VideoOutput { + interface VideoOutput extends CameraOutput { /** * Start video output. * @param callback Callback used to return the result. @@ -1292,9 +1880,9 @@ declare namespace camera { */ start(callback: AsyncCallback): void; - /** + /** * Start video output. - * @return Promise used to return the result. + * @returns Promise used to return the result. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ @@ -1310,28 +1898,12 @@ declare namespace camera { /** * Stop video output. - * @return Promise used to return the result. + * @returns Promise used to return the result. * @since 9 * @syscap SystemCapability.Multimedia.Camera.Core */ stop(): Promise; - /** - * Release output instance. - * @param callback Callback used to return the result. - * @since 9 - * @syscap SystemCapability.Multimedia.Camera.Core - */ - release(callback: AsyncCallback): void; - - /** - * Release output instance. - * @return Promise used to return the result. - * @since 9 - * @syscap SystemCapability.Multimedia.Camera.Core - */ - release(): Promise; - /** * Subscribes frame start event callback. * @param type Event type. @@ -1366,7 +1938,16 @@ declare namespace camera { * @syscap SystemCapability.Multimedia.Camera.Core */ enum VideoOutputErrorCode { - ERROR_UNKNOWN = -1 + /** + * Unknown error. + * @since 9 + */ + ERROR_UNKNOWN = -1, + /** + * Driver error. + * @since 9 + */ + ERROR_DRIVER_ERROR = 0 } /** @@ -1377,6 +1958,196 @@ declare namespace camera { interface VideoOutputError extends Error { code: VideoOutputErrorCode; } + + /** + * Metadata object type. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + enum MetadataObjectType { + FACE_DETECTION = 0 + } + + /** + * Rectangle definition. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + interface Rect { + /** + * X coordinator of top left point. + * @param Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + topLeftX: number; + /** + * Y coordinator of top left point. + * @param Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + topLeftY: number; + /** + * Width of this rectangle. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + width: number; + /** + * Height of this rectangle. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + height: number; + } + + /** + * Metadata object basis. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + interface MetadataObject { + /** + * Get current metadata object type. + * @param callback Callback used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + getType(callback: AsyncCallback): void; + + /** + * Get current metadata object type. + * @param Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + getType(): Promise; + + /** + * Get current metadata object timestamp in milliseconds. + * @param callback Callback used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + getTimestamp(callback: AsyncCallback): void; + + /** + * Get current metadata object timestamp in milliseconds. + * @param Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + getTimestamp(): Promise; + + /** + * Get the axis-aligned bounding box of detected metadata object. + * @param callback Callback used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + getBoundingBox(callback: AsyncCallback): void; + + /** + * Get the axis-aligned bounding box of detected metadata object. + * @param Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + getBoundingBox(): Promise; + } + + /** + * Metadata face object. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + interface MetadataFaceObject extends MetadataObject { + } + + /** + * Metadata Output object + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + interface MetadataOutput extends CameraOutput { + /** + * Start output metadata + * @param callback Callback used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + start(callback: AsyncCallback): void; + + /** + * Start output metadata + * @returns Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + start(): Promise; + + /** + * Stop output metadata + * @param callback Callback used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + stop(callback: AsyncCallback): void; + + /** + * Stop output metadata + * @returns Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + stop(): Promise; + + /** + * Subscribes to metadata objects available event callback. + * @param type Event type. + * @param callback Callback used to get the available metadata objects. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + on(type: 'metadataObjectsAvailable', callback: AsyncCallback>): void; + + /** + * Subscribes error event callback. + * @param type Event type. + * @param callback Callback used to get the video output errors. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + on(type: 'error', callback: ErrorCallback): void; + } + + /** + * Enum for metadata output error code. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + enum MetadataOutputErrorCode { + /** + * Unknown errors. + * @since 9 + */ + ERROR_UNKNOWN = -1, + /** + * Insufficient resources. + * @since 9 + */ + ERROR_INSUFFICIENT_RESOURCES = 0 + } + + /** + * Metadata output error object. + * @since 9 + * @syscap SystemCapability.Multimedia.Camera.Core + */ + interface MetadataOutputError extends Error { + code: MetadataOutputErrorCode; + } } export default camera; diff --git a/api/@ohos.multimedia.media.d.ts b/api/@ohos.multimedia.media.d.ts index 9d9547f1801a8494716303b86f4e5f98e9f59299..00c4ce706e5f67882310667f09cb3c993bdc896b 100644 --- a/api/@ohos.multimedia.media.d.ts +++ b/api/@ohos.multimedia.media.d.ts @@ -19,15 +19,13 @@ import audio from "./@ohos.multimedia.audio"; /** * @name media * @since 6 - * @import import media from '@ohos.multimedia.media' */ declare namespace media { /** * Creates an AudioPlayer instance. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioPlayer - * @import import media from '@ohos.multimedia.media' - * @return Returns an AudioPlayer instance if the operation is successful; returns null otherwise. + * @returns Returns an AudioPlayer instance if the operation is successful; returns null otherwise. */ function createAudioPlayer(): AudioPlayer; @@ -35,8 +33,7 @@ declare namespace media { * Creates an AudioRecorder instance. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioRecorder - * @import import media from '@ohos.multimedia.media' - * @return Returns an AudioRecorder instance if the operation is successful; returns null otherwise. + * @returns Returns an AudioRecorder instance if the operation is successful; returns null otherwise. */ function createAudioRecorder(): AudioRecorder; @@ -44,7 +41,6 @@ declare namespace media { * Creates an VideoPlayer instance. * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer - * @import import media from '@ohos.multimedia.media' * @param callback Callback used to return AudioPlayer instance if the operation is successful; returns null otherwise. */ function createVideoPlayer(callback: AsyncCallback): void; @@ -52,8 +48,7 @@ declare namespace media { * Creates an VideoPlayer instance. * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer - * @import import media from '@ohos.multimedia.media' - * @return A Promise instance used to return VideoPlayer instance if the operation is successful; returns null otherwise. + * @returns A Promise instance used to return VideoPlayer instance if the operation is successful; returns null otherwise. */ function createVideoPlayer() : Promise; @@ -61,16 +56,18 @@ declare namespace media { * Creates an VideoRecorder instance. * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @import import media from '@ohos.multimedia.media' * @param callback Callback used to return AudioPlayer instance if the operation is successful; returns null otherwise. + * @throws { BusinessError } 5400101 - No memory. Return by callback. + * @systemapi */ function createVideoRecorder(callback: AsyncCallback): void; /** * Creates an VideoRecorder instance. * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @import import media from '@ohos.multimedia.media' - * @return A Promise instance used to return VideoRecorder instance if the operation is successful; returns null otherwise. + * @returns A Promise instance used to return VideoRecorder instance if the operation is successful; returns null otherwise. + * @throws { BusinessError } 5400101 - No memory. Return by promise. + * @systemapi */ function createVideoRecorder(): Promise; @@ -78,7 +75,6 @@ declare namespace media { * Enumerates ErrorCode types, return in BusinessError::code * @since 8 * @syscap SystemCapability.Multimedia.Media.Core - * @import import media from '@ohos.multimedia.media' */ enum MediaErrorCode { /** @@ -156,7 +152,6 @@ declare namespace media { * Enumerates buffering info type, for network playback. * @since 8 * @syscap SystemCapability.Multimedia.Media.Core - * @import import media from '@ohos.multimedia.media' */ enum BufferingInfoType { /** @@ -198,7 +193,7 @@ declare namespace media { fd: number /** - * The offset into the file where the data to be readed, in bytes. Defaultly, + * The offset into the file where the data to be read, in bytes. By default, * the offset is zero. * @since 9 * @syscap SystemCapability.Multimedia.Media.Core @@ -206,7 +201,7 @@ declare namespace media { offset?: number /** - * The length in bytes of the data to be readed. Defaultly, the length is the + * The length in bytes of the data to be read. By default, the length is the * rest of bytes in the file from the offset. * @since 9 * @syscap SystemCapability.Multimedia.Media.Core @@ -218,7 +213,6 @@ declare namespace media { * Describes audio playback states. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioPlayer - * @import import media from '@ohos.multimedia.media' */ type AudioState = 'idle' | 'playing' | 'paused' | 'stopped' | 'error'; @@ -291,7 +285,7 @@ declare namespace media { * get all track infos in MediaDescription, should be called after data loaded callback.. * @since 8 * @syscap SystemCapability.Multimedia.Media.AudioPlayer - * @return A Promise instance used to return the track info in MediaDescription. + * @returns A Promise instance used to return the track info in MediaDescription. */ getTrackDescription() : Promise>; @@ -398,8 +392,8 @@ declare namespace media { * Enumerates audio encoding formats, it will be deprecated after API8, use @CodecMimeType to replace. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioRecorder - * @import import media from '@ohos.multimedia.media' * @deprecated since 8 + * @useinstead ohos.multimedia.media/media.CodecMimeType */ enum AudioEncoder { /** @@ -442,8 +436,8 @@ declare namespace media { * Enumerates audio output formats, it will be deprecated after API8, use @ContainerFormatType to replace. * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioRecorder - * @import import media from '@ohos.multimedia.media' * @deprecated since 8 + * @useinstead ohos.multimedia.media/media.ContainerFormatType */ enum AudioOutputFormat { /** @@ -515,6 +509,7 @@ declare namespace media { * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioRecorder * @deprecated since 8 + * @useinstead ohos.multimedia.media/media.AudioRecorderConfig.audioEncoderMime */ audioEncoder?: AudioEncoder; @@ -545,6 +540,7 @@ declare namespace media { * @since 6 * @syscap SystemCapability.Multimedia.Media.AudioRecorder * @deprecated since 8 + * @useinstead ohos.multimedia.media/media.AudioRecorderConfig.fileFormat */ format?: AudioOutputFormat; @@ -662,6 +658,7 @@ declare namespace media { * Describes video recorder states. * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi */ type VideoRecordState = 'idle' | 'prepared' | 'playing' | 'paused' | 'stopped' | 'error'; @@ -670,6 +667,7 @@ declare namespace media { * to create an VideoRecorder instance. * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi */ interface VideoRecorder { /** @@ -679,6 +677,11 @@ declare namespace media { * @param config Recording parameters. * @param callback A callback instance used to return when prepare completed. * @permission ohos.permission.MICROPHONE + * @throws { BusinessError } 201 - Permission denied. Return by callback. + * @throws { BusinessError } 401 - Parameter error. Return by callback. + * @throws { BusinessError } 5400102 - Operate not permit. Return by callback. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @systemapi */ prepare(config: VideoRecorderConfig, callback: AsyncCallback): void; /** @@ -686,8 +689,13 @@ declare namespace media { * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @param config Recording parameters. - * @return A Promise instance used to return when prepare completed. + * @returns A Promise instance used to return when prepare completed. * @permission ohos.permission.MICROPHONE + * @throws { BusinessError } 201 - Permission denied. Return by promise. + * @throws { BusinessError } 401 - Parameter error. Return by promise. + * @throws { BusinessError } 5400102 - Operate not permit. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @systemapi */ prepare(config: VideoRecorderConfig): Promise; /** @@ -695,13 +703,21 @@ declare namespace media { * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @param callback Callback used to return the input surface id in string. + * @throws { BusinessError } 5400102 - Operate not permit. Return by callback. + * @throws { BusinessError } 5400103 - IO error. Return by callback. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @systemapi */ getInputSurface(callback: AsyncCallback): void; /** * get input surface. it must be called between prepare completed and start. * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @return A Promise instance used to return the input surface id in string. + * @returns A Promise instance used to return the input surface id in string. + * @throws { BusinessError } 5400102 - Operate not permit. Return by promise. + * @throws { BusinessError } 5400103 - IO error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @systemapi */ getInputSurface(): Promise; /** @@ -709,13 +725,21 @@ declare namespace media { * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @param callback A callback instance used to return when start completed. + * @throws { BusinessError } 5400102 - Operate not permit. Return by callback. + * @throws { BusinessError } 5400103 - IO error. Return by callback. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @systemapi */ start(callback: AsyncCallback): void; /** * Starts video recording. * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @return A Promise instance used to return when start completed. + * @returns A Promise instance used to return when start completed. + * @throws { BusinessError } 5400102 - Operate not permit. Return by promise. + * @throws { BusinessError } 5400103 - IO error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @systemapi */ start(): Promise; /** @@ -723,13 +747,21 @@ declare namespace media { * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @param callback A callback instance used to return when pause completed. + * @throws { BusinessError } 5400102 - Operate not permit. Return by callback. + * @throws { BusinessError } 5400103 - IO error. Return by callback. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @systemapi */ pause(callback: AsyncCallback): void; /** * Pauses video recording. * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @return A Promise instance used to return when pause completed. + * @returns A Promise instance used to return when pause completed. + * @throws { BusinessError } 5400102 - Operate not permit. Return by promise. + * @throws { BusinessError } 5400103 - IO error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @systemapi */ pause(): Promise; /** @@ -737,13 +769,21 @@ declare namespace media { * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @param callback A callback instance used to return when resume completed. + * @throws { BusinessError } 5400102 - Operate not permit. Return by callback. + * @throws { BusinessError } 5400103 - IO error. Return by callback. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @systemapi */ resume(callback: AsyncCallback): void; /** * Resumes video recording. * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @return A Promise instance used to return when resume completed. + * @returns A Promise instance used to return when resume completed. + * @throws { BusinessError } 5400102 - Operate not permit. Return by promise. + * @throws { BusinessError } 5400103 - IO error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @systemapi */ resume(): Promise; /** @@ -751,13 +791,21 @@ declare namespace media { * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @param callback A callback instance used to return when stop completed. + * @throws { BusinessError } 5400102 - Operate not permit. Return by callback. + * @throws { BusinessError } 5400103 - IO error. Return by callback. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @systemapi */ stop(callback: AsyncCallback): void; /** * Stops video recording. * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @return A Promise instance used to return when stop completed. + * @returns A Promise instance used to return when stop completed. + * @throws { BusinessError } 5400102 - Operate not permit. Return by promise. + * @throws { BusinessError } 5400103 - IO error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @systemapi */ stop(): Promise; /** @@ -765,13 +813,17 @@ declare namespace media { * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @param callback A callback instance used to return when release completed. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @systemapi */ release(callback: AsyncCallback): void; /** * Releases resources used for video recording. * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @return A Promise instance used to return when release completed. + * @returns A Promise instance used to return when release completed. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @systemapi */ release(): Promise; /** @@ -781,6 +833,9 @@ declare namespace media { * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @param callback A callback instance used to return when reset completed. + * @throws { BusinessError } 5400103 - IO error. Return by callback. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @systemapi */ reset(callback: AsyncCallback): void; /** @@ -789,7 +844,10 @@ declare namespace media { * you must call prepare() to set the recording configurations for another recording. * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @return A Promise instance used to return when reset completed. + * @returns A Promise instance used to return when reset completed. + * @throws { BusinessError } 5400103 - IO error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @systemapi */ reset(): Promise; /** @@ -798,6 +856,9 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @param type Type of the video recording error event to listen for. * @param callback Callback used to listen for the video recording error event. + * @throws { BusinessError } 5400103 - IO error. Return by callback. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @systemapi */ on(type: 'error', callback: ErrorCallback): void; @@ -805,6 +866,7 @@ declare namespace media { * video recorder state. * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi */ readonly state: VideoRecordState; } @@ -859,7 +921,6 @@ declare namespace media { * instance. * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer - * @import import media from '@ohos.multimedia.media' */ interface VideoPlayer { /** @@ -867,7 +928,7 @@ declare namespace media { * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param surfaceId surface id, video player will use this id get a surface instance. - * @return A Promise instance used to return when release output buffer completed. + * @returns A Promise instance used to return when release output buffer completed. */ setDisplaySurface(surfaceId: string, callback: AsyncCallback): void; /** @@ -875,7 +936,7 @@ declare namespace media { * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param surfaceId surface id, video player will use this id get a surface instance. - * @return A Promise instance used to return when release output buffer completed. + * @returns A Promise instance used to return when release output buffer completed. */ setDisplaySurface(surfaceId: string): Promise; /** @@ -889,7 +950,7 @@ declare namespace media { * prepare video playback, it will request resource for playing. * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer - * @return A Promise instance used to return when prepare completed. + * @returns A Promise instance used to return when prepare completed. */ prepare(): Promise; /** @@ -903,7 +964,7 @@ declare namespace media { * Starts video playback. * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer - * @return A Promise instance used to return when start completed. + * @returns A Promise instance used to return when start completed. */ play(): Promise; /** @@ -917,7 +978,7 @@ declare namespace media { * Pauses video playback. * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer - * @return A Promise instance used to return when pause completed. + * @returns A Promise instance used to return when pause completed. */ pause(): Promise; /** @@ -931,7 +992,7 @@ declare namespace media { * Stops video playback. * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer - * @return A Promise instance used to return when stop completed. + * @returns A Promise instance used to return when stop completed. */ stop(): Promise; /** @@ -945,7 +1006,7 @@ declare namespace media { * Resets video playback, it will release the resource. * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer - * @return A Promise instance used to return when reset completed. + * @returns A Promise instance used to return when reset completed. */ reset(): Promise; /** @@ -974,7 +1035,7 @@ declare namespace media { * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param timeMs Playback position to jump * @param mode seek mode, see @SeekMode . - * @return A Promise instance used to return when seek completed + * @returns A Promise instance used to return when seek completed * and return the seeking position result. */ seek(timeMs: number, mode?:SeekMode): Promise; @@ -991,7 +1052,7 @@ declare namespace media { * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param vol Relative volume. The value ranges from 0.00 to 1.00. The value 1 indicates the maximum volume (100%). - * @return A Promise instance used to return when set volume completed. + * @returns A Promise instance used to return when set volume completed. */ setVolume(vol: number): Promise; /** @@ -1005,7 +1066,7 @@ declare namespace media { * Releases resources used for video playback. * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer - * @return A Promise instance used to return when release completed. + * @returns A Promise instance used to return when release completed. */ release(): Promise; /** @@ -1020,7 +1081,7 @@ declare namespace media { * get all track infos in MediaDescription, should be called after data loaded callback.. * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer - * @return A Promise instance used to return the track info in MediaDescription. + * @returns A Promise instance used to return the track info in MediaDescription. */ getTrackDescription() : Promise>; @@ -1091,7 +1152,7 @@ declare namespace media { audioInterruptMode ?: audio.InterruptMode; /** - * video scale type. Defaultly, the {@link #VIDEO_SCALE_TYPE_FIT} will be used, for more + * video scale type. By default, the {@link #VIDEO_SCALE_TYPE_FIT} will be used, for more * information, refer to {@link #VideoScaleType} * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoPlayer @@ -1111,36 +1172,10 @@ declare namespace media { * @since 8 * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @param speed playback speed, see @PlaybackSpeed . - * @return A Promise instance used to return actually speed. + * @returns A Promise instance used to return actually speed. */ setSpeed(speed:number): Promise; - /** - * select a specified bitrate to playback, only valid for HLS protocal network stream. Defaulty, the - * player will select the appropriate bitrate according to the network connection speed. The - * available bitrates list reported by {@link #on('availableBitratesCollect')}. Set it to select - * a specified bitrate. If the specified bitrate is not in the list of available bitrates, the player - * will select the minimal and closest one from the available bitrates list. - * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoPlayer - * @param bitrate the playback bitrate must be expressed in bits per second. - * @return A Promise instance used to return actually selected bitrate. - */ - selectBitrate(bitrate: number): Promise; - - /** - * select a specified bitrate to playback, only valid for HLS protocal network stream. Defaulty, the - * player will select the appropriate bitrate according to the network connection speed. The - * available bitrates list reported by {@link #on('availableBitratesCollect')}. Set it to select - * a specified bitrate. If the specified bitrate is not in the list of available bitrates, the player - * will select the minimal and closest one from the available bitrates list. - * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoPlayer - * @param bitrate the playback bitrate must be expressed in bits per second. - * @param callback Callback used to return actually selected bitrate. - */ - selectBitrate(bitrate: number, callback: AsyncCallback): void; - /** * Listens for video playback completed events. * @since 8 @@ -1186,16 +1221,6 @@ declare namespace media { */ on(type: 'audioInterrupt', callback: (info: audio.InterruptEvent) => void): void; - /** - * Listens for available bitrates collect completed events for HLS protocal stream playback. - * This event will be reported after the {@link #prepare} called. - * @since 9 - * @syscap SystemCapability.Multimedia.Media.VideoPlayer - * @param type Type of the playback event to listen for. - * @param callback Callback used to listen for the playback event return available bitrates. - */ - on(type: 'availableBitratesCollect', callback: (bitrates: Array) => void): void; - /** * Listens for playback error events. * @since 8 @@ -1210,7 +1235,6 @@ declare namespace media { * Enumerates video scale type. * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoPlayer - * @import import media from '@ohos.multimedia.media' */ enum VideoScaleType { /** @@ -1236,7 +1260,6 @@ declare namespace media { * Enumerates container format type(The abbreviation for 'container format type' is CFT). * @since 8 * @syscap SystemCapability.Multimedia.Media.Core - * @import import media from '@ohos.multimedia.media' */ enum ContainerFormatType { /** @@ -1258,7 +1281,6 @@ declare namespace media { * Enumerates media data type. * @since 8 * @syscap SystemCapability.Multimedia.Media.Core - * @import import media from '@ohos.multimedia.media' */ enum MediaType { /** @@ -1279,7 +1301,6 @@ declare namespace media { * Enumerates media description key. * @since 8 * @syscap SystemCapability.Multimedia.Media.Core - * @import import media from '@ohos.multimedia.media' */ enum MediaDescriptionKey { /** @@ -1357,12 +1378,14 @@ declare namespace media { * Provides the video recorder profile definitions. * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi */ interface VideoRecorderProfile { /** * Indicates the audio bit rate. * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi */ readonly audioBitrate: number; @@ -1370,6 +1393,7 @@ declare namespace media { * Indicates the number of audio channels. * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi */ readonly audioChannels: number; @@ -1377,6 +1401,7 @@ declare namespace media { * Indicates the audio encoding format. * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi */ readonly audioCodec: CodecMimeType; @@ -1384,6 +1409,7 @@ declare namespace media { * Indicates the audio sampling rate. * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi */ readonly audioSampleRate: number; @@ -1391,6 +1417,7 @@ declare namespace media { * Indicates the output file format. * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi */ readonly fileFormat: ContainerFormatType; @@ -1398,6 +1425,7 @@ declare namespace media { * Indicates the video bit rate. * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi */ readonly videoBitrate: number; @@ -1405,6 +1433,7 @@ declare namespace media { * Indicates the video encoding format. * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi */ readonly videoCodec: CodecMimeType; @@ -1412,6 +1441,7 @@ declare namespace media { * Indicates the video width. * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi */ readonly videoFrameWidth: number; @@ -1419,6 +1449,7 @@ declare namespace media { * Indicates the video height. * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi */ readonly videoFrameHeight: number; @@ -1426,6 +1457,7 @@ declare namespace media { * Indicates the video frame rate. * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi */ readonly videoFrameRate: number; } @@ -1434,20 +1466,22 @@ declare namespace media { * Enumerates audio source type for recorder. * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @import import media from '@ohos.multimedia.media' + * @systemapi */ enum AudioSourceType { /** * default audio source type. * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder - */ + * @systemapi + */ AUDIO_SOURCE_TYPE_DEFAULT = 0, /** * source type mic. * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder - */ + * @systemapi + */ AUDIO_SOURCE_TYPE_MIC = 1, } @@ -1455,20 +1489,22 @@ declare namespace media { * Enumerates video source type for recorder. * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @import import media from '@ohos.multimedia.media' + * @systemapi */ enum VideoSourceType { /** * surface raw data. * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi */ VIDEO_SOURCE_TYPE_SURFACE_YUV = 0, /** * surface ES data. * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder - */ + * @systemapi + */ VIDEO_SOURCE_TYPE_SURFACE_ES = 1, } @@ -1476,33 +1512,37 @@ declare namespace media { * Provides the video recorder configuration definitions. * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi */ interface VideoRecorderConfig { /** * audio source type, details see @AudioSourceType . * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi */ - audioSourceType: AudioSourceType; + audioSourceType?: AudioSourceType; /** * video source type, details see @VideoSourceType . * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi */ videoSourceType: VideoSourceType; /** * video recorder profile, can get by "getVideoRecorderProfile", details see @VideoRecorderProfile . * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi */ profile: VideoRecorderProfile; /** * video output uri.support two kind of uri now. * format like: scheme + "://" + "context". - * file: file://path * fd: fd://fd * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi */ url: string; /** @@ -1510,12 +1550,14 @@ declare namespace media { * the range of rotation angle should be {0, 90, 180, 270}, default is 0. * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi */ rotation?: number; /** * geographical location information. * @since 9 * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi */ location?: Location; } @@ -1538,7 +1580,6 @@ declare namespace media { * Enumerates seek mode. * @since 8 * @syscap SystemCapability.Multimedia.Media.Core - * @import import media from '@ohos.multimedia.media' */ enum SeekMode { /** @@ -1559,7 +1600,6 @@ declare namespace media { * Enumerates Codec MIME types. * @since 8 * @syscap SystemCapability.Multimedia.Media.Core - * @import import media from '@ohos.multimedia.media' */ enum CodecMimeType { /** diff --git a/api/@ohos.multimedia.mediaLibrary.d.ts b/api/@ohos.multimedia.mediaLibrary.d.ts index bc5b5a6102a1226ab800b57d4ff8b91620c181d6..935f502c28328ca957162e464d205ece09b5781f 100644 --- a/api/@ohos.multimedia.mediaLibrary.d.ts +++ b/api/@ohos.multimedia.mediaLibrary.d.ts @@ -21,20 +21,14 @@ import image from './@ohos.multimedia.image'; * @name mediaLibrary * @since 6 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @import import media from '@ohos.multimedia.mediaLibrary' - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager */ declare namespace mediaLibrary { /** * Obtains a MediaLibrary instance. * @since 6 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @import import mediaLibrary from '@ohos.multimedia.mediaLibrary' * @FAModelOnly - * @return Returns a MediaLibrary instance if the operation is successful; returns null otherwise. - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.getUserFileMgr + * @returns Returns a MediaLibrary instance if the operation is successful; returns null otherwise. */ function getMediaLibrary(): MediaLibrary; /** @@ -43,9 +37,7 @@ declare namespace mediaLibrary { * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @StageModelOnly * @param context hap context information - * @return Instance of MediaLibrary - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.getUserFileMgr + * @returns Instance of MediaLibrary */ function getMediaLibrary(context: Context): MediaLibrary; @@ -53,40 +45,30 @@ declare namespace mediaLibrary { * Enumeration types for different kind of Media Files * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.MediaType */ enum MediaType { /** * File media type * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.MediaType.FILE */ FILE = 0, /** * Image media type * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.MediaType.IMAGE */ IMAGE, /** * Video media type * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.MediaType.VIDEO */ VIDEO, /** * Audio media type * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.MediaType.AUDIO */ AUDIO } @@ -95,7 +77,6 @@ declare namespace mediaLibrary { * Describes media resource options. * @since 6 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @import import mediaLibrary from '@ohos.multimedia.mediaLibrary' * @deprecated since 9 */ interface MediaAssetOption { @@ -126,7 +107,6 @@ declare namespace mediaLibrary { * Describes media selection options. * @since 6 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @import import mediaLibrary from '@ohos.multimedia.mediaLibrary' * @deprecated since 9 */ interface MediaSelectOption { @@ -150,124 +130,102 @@ declare namespace mediaLibrary { * Provides methods to encapsulate file attributes. * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @import import mediaLibrary from '@ohos.multimedia.mediaLibrary' - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FileAsset */ interface FileAsset { /** * File ID. * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ readonly id: number; /** * URI of the file. * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FileAsset.uri */ readonly uri: string; /** * MIME type, for example, video/mp4, audio/mp4, or audio/amr-wb. * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FileAsset.mimeType */ readonly mimeType: string; /** - * Media type, for example, IMAGE, VIDEO, FILE, AUDIO + * Media type, for example, IMAGE, VIDEO, FILE, AUDIO * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ readonly mediaType: MediaType; /** * Display name (with a file name extension) of the file. * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FileAsset.displayName */ displayName: string; /** * File name title (without the file name extension). * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ title: string; /** * Relative Path of the file. * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ relativePath: string; /** * Parent folder's file_id of the file. * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ readonly parent: number; /** * Data size of the file. * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ readonly size: number; /** * Date (timestamp) when the file was added. * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ readonly dateAdded: number; /** * Date (timestamp) when the file was modified. * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ readonly dateModified: number; /** * Date (timestamp) when the file was taken. * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ readonly dateTaken: number; /** * Artist of the audio file. * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ readonly artist: string; /** * audioAlbum of the audio file. * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ readonly audioAlbum: string; /** * Display width of the file. This is valid only for videos and images. * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ readonly width: number; /** * Display height of the file. This is valid only for videos and images. * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ readonly height: number; /** @@ -275,35 +233,30 @@ declare namespace mediaLibrary { * The rotation angle can be 0, 90, 180, or 270 degrees. This is valid only for videos. * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ orientation: number; /** * duration of the audio and video file. * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ readonly duration: number; /** * ID of the album where the file is located. * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ readonly albumId: number; /** * URI of the album where the file is located. * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ readonly albumUri: string; /** * Name of the album where the file is located. * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ readonly albumName: string; @@ -312,9 +265,7 @@ declare namespace mediaLibrary { * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @permission ohos.permission.READ_MEDIA - * @param callback Callback return the result of isDerectory. - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FileAsset.isDirectory + * @param callback Callback return the result of isDirectory. */ isDirectory(callback: AsyncCallback): void; /** @@ -322,8 +273,6 @@ declare namespace mediaLibrary { * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @permission ohos.permission.READ_MEDIA - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FileAsset.isDirectory */ isDirectory():Promise; /** @@ -332,8 +281,6 @@ declare namespace mediaLibrary { * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @permission ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA * @param callback no value will be returned. - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FileAsset.commitModify */ commitModify(callback: AsyncCallback): void; /** @@ -341,8 +288,6 @@ declare namespace mediaLibrary { * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @permission ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FileAsset.commitModify */ commitModify(): Promise; /** @@ -352,8 +297,6 @@ declare namespace mediaLibrary { * @permission ohos.permission.READ_MEDIA or ohos.permission.WRITE_MEDIA * @param mode mode for open, for example: rw, r, w. * @param callback Callback return the fd of the file. - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FileAsset.open */ open(mode: string, callback: AsyncCallback): void; /** @@ -362,8 +305,6 @@ declare namespace mediaLibrary { * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @permission ohos.permission.READ_MEDIA or ohos.permission.WRITE_MEDIA * @param mode mode for open, for example: rw, r, w. - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FileAsset.open */ open(mode: string): Promise; /** @@ -373,8 +314,6 @@ declare namespace mediaLibrary { * @permission ohos.permission.READ_MEDIA or ohos.permission.WRITE_MEDIA * @param fd fd of the file which had been opened * @param callback no value will be returned. - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FileAsset.close */ close(fd: number, callback: AsyncCallback): void; /** @@ -383,8 +322,6 @@ declare namespace mediaLibrary { * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @permission ohos.permission.READ_MEDIA or ohos.permission.WRITE_MEDIA * @param fd fd of the file which had been opened - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FileAsset.close */ close(fd: number): Promise; /** @@ -393,8 +330,6 @@ declare namespace mediaLibrary { * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @permission ohos.permission.READ_MEDIA * @param callback Callback used to return the thumbnail's pixelmap. - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FileAsset.getThumbnail */ getThumbnail(callback: AsyncCallback): void; /** @@ -404,8 +339,6 @@ declare namespace mediaLibrary { * @permission ohos.permission.READ_MEDIA * @param size thumbnail's size * @param callback Callback used to return the thumbnail's pixelmap. - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FileAsset.getThumbnail */ getThumbnail(size: Size, callback: AsyncCallback): void; /** @@ -414,8 +347,6 @@ declare namespace mediaLibrary { * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @permission ohos.permission.READ_MEDIA * @param size thumbnail's size - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FileAsset.getThumbnail */ getThumbnail(size?: Size): Promise; /** @@ -423,10 +354,8 @@ declare namespace mediaLibrary { * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @permission ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA - * @param isFavorite ture is favorite file, false is not favorite file + * @param isFavorite true is favorite file, false is not favorite file * @param callback Callback used to return, No value is returned. - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FileAsset.favorite */ favorite(isFavorite: boolean, callback: AsyncCallback): void; /** @@ -434,9 +363,7 @@ declare namespace mediaLibrary { * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @permission ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA - * @param isFavorite ture is favorite file, false is not favorite file - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FileAsset.favorite + * @param isFavorite true is favorite file, false is not favorite file */ favorite(isFavorite: boolean): Promise; /** @@ -445,8 +372,6 @@ declare namespace mediaLibrary { * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @permission ohos.permission.READ_MEDIA * @param callback Callback used to return true or false. - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FileAsset.isFavorite */ isFavorite(callback: AsyncCallback): void; /** @@ -454,8 +379,6 @@ declare namespace mediaLibrary { * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @permission ohos.permission.READ_MEDIA - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FileAsset.isFavorite */ isFavorite():Promise; /** @@ -465,8 +388,6 @@ declare namespace mediaLibrary { * @permission ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA * @param isTrash true is trashed file, false is not trashed file * @param callback Callback used to return, No value is returned. - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FileAsset.trash */ trash(isTrash: boolean, callback: AsyncCallback): void; /** @@ -475,8 +396,6 @@ declare namespace mediaLibrary { * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @permission ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA * @param isTrash true is trashed file, false is not trashed file - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FileAsset.trash */ trash(isTrash: boolean): Promise; /** @@ -485,8 +404,6 @@ declare namespace mediaLibrary { * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @permission ohos.permission.READ_MEDIA * @param callback Callback used to return true or false. - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FileAsset.isTrash */ isTrash(callback: AsyncCallback): void; /** @@ -494,8 +411,6 @@ declare namespace mediaLibrary { * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @permission ohos.permission.READ_MEDIA - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FileAsset.isTrash */ isTrash():Promise; } @@ -504,146 +419,120 @@ declare namespace mediaLibrary { * Describes MediaFetchOptions's selection * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FileKey */ enum FileKey { /** * File ID * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ ID = "file_id", /** * Relative Path * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FileKey.RELATIVE_PATH */ RELATIVE_PATH = "relative_path", /** * File name * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FileKey.DISPLAY_NAME */ DISPLAY_NAME = "display_name", /** * Parent folder file id * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ PARENT = "parent", /** * Mime type of the file * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ MIME_TYPE = "mime_type", /** * Media type of the file * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ MEDIA_TYPE = "media_type", /** * Size of the file * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ SIZE = "size", /** * Date of the file creation * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FileKey.DATE_ADDED */ DATE_ADDED = "date_added", /** * Modify date of the file * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FileKey.DATE_MODIFIED */ DATE_MODIFIED = "date_modified", /** * Date taken of the file * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ DATE_TAKEN = "date_taken", /** * Title of the file * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FileKey.TITLE */ TITLE = "title", /** * Artist of the audio file * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ ARTIST = "artist", /** * Audio album of the audio file * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ AUDIOALBUM = "audio_album", /** * Duration of the audio and video file * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ DURATION = "duration", /** * Width of the image file * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ WIDTH = "width", /** * Height of the image file * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ HEIGHT = "height", /** * Orientation of the image file * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ ORIENTATION = "orientation", /** * Album id of the file * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ ALBUM_ID = "bucket_id", /** * Album name of the file * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ ALBUM_NAME = "bucket_display_name", } @@ -652,52 +541,42 @@ declare namespace mediaLibrary { * Fetch parameters applicable on images, videos, audios, albums and other media * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.MediaFetchOptions */ interface MediaFetchOptions { /** * Fields to retrieve, for example, selections: "media_type =? OR media_type =?". * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.MediaFetchOptions.selections */ selections: string; /** * Conditions for retrieval, for example, selectionArgs: [IMAGE, VIDEO]. * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.MediaFetchOptions.selectionArgs */ selectionArgs: Array; /** - * Sorting criterion of the retrieval results, for example, order: "datetaken DESC,display_name DESC, file_id DESC". + * Sorting criterion of the retrieval results, for example, order: "dateTaken DESC,display_name DESC, file_id DESC". * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ order?: string; /** * uri for retrieval * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ uri?: string; /** * networkId for retrieval * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ networkId?: string; /** * extendArgs for retrieval * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ extendArgs?: string; } @@ -706,37 +585,28 @@ declare namespace mediaLibrary { * Implements file retrieval. * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @import import mediaLibrary from '@ohos.multimedia.mediaLibrary' - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FetchFileResult */ interface FetchFileResult { /** * Obtains the total number of files in the file retrieval result. * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @return Total number of files. - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FetchFileResult.getCount + * @returns Total number of files. */ getCount(): number; /** * Checks whether the result set points to the last row. * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @return Whether the file is the last one. - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FetchFileResult.isAfterLast + * @returns Whether the file is the last one. * You need to check whether the file is the last one before calling getNextObject, - * which returns the next file only when True is returned for this method. + * which returns the next file only when False is returned for this method. */ isAfterLast(): boolean; /** * Releases the FetchFileResult instance and invalidates it. Other methods cannot be called. * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FetchFileResult.close */ close(): void; /** @@ -744,41 +614,33 @@ declare namespace mediaLibrary { * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @param callback Callback used to return the file in the format of a FileAsset instance. - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FetchFileResult.getFirstObject */ getFirstObject(callback: AsyncCallback): void; /** * Obtains the first FileAsset in the file retrieval result. This method uses a promise to return the file. * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @return A Promise instance used to return the file in the format of a FileAsset instance. - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FetchFileResult.getFirstObject + * @returns A Promise instance used to return the file in the format of a FileAsset instance. */ getFirstObject(): Promise; /** * Obtains the next FileAsset in the file retrieval result. * This method uses a callback to return the file. * Before calling this method, you must use isAfterLast() to check whether the result set points to the last row. - * This method returns the next file only when True is returned for isAfterLast(). + * This method returns the next file only when False is returned for isAfterLast(). * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @param callback Callback used to return the file in the format of a FileAsset instance. - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FetchFileResult.getNextObject */ getNextObject(callback: AsyncCallback): void; /** * Obtains the next FileAsset in the file retrieval result. * This method uses a promise to return the file. * Before calling this method, you must use isAfterLast() to check whether the result set points to the last row. - * This method returns the next file only when True is returned for isAfterLast(). + * This method returns the next file only when False is returned for isAfterLast(). * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @return A Promise instance used to return the file in the format of a FileAsset instance. - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FetchFileResult.getNextObject + * @returns A Promise instance used to return the file in the format of a FileAsset instance. */ getNextObject(): Promise; /** @@ -786,17 +648,13 @@ declare namespace mediaLibrary { * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @param callback Callback used to return the file in the format of a FileAsset instance. - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FetchFileResult.getLastObject */ getLastObject(callback: AsyncCallback): void; /** * Obtains the last FileAsset in the file retrieval result. This method uses a promise to return the file. * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @return A Promise instance used to return the file in the format of a FileAsset instance. - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FetchFileResult.getLastObject + * @returns A Promise instance used to return the file in the format of a FileAsset instance. */ getLastObject(): Promise; /** @@ -806,8 +664,6 @@ declare namespace mediaLibrary { * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @param index Index of the file to obtain. * @param callback Callback used to return the file in the format of a FileAsset instance. - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FetchFileResult.getPositionObject */ getPositionObject(index: number, callback: AsyncCallback): void; /** @@ -816,20 +672,17 @@ declare namespace mediaLibrary { * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @param index Index of the file to obtain. - * @return A Promise instance used to return the file in the format of a FileAsset instance. - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.FetchFileResult.getPositionObject + * @returns A Promise instance used to return the file in the format of a FileAsset instance. */ getPositionObject(index: number): Promise; /** * Obtains all FileAssets in the file retrieval result. - * This method uses a callback to return the result. After this method is called, + * This method uses a callback to return the result. After this method is called, * close() is automatically called to release the FetchFileResult instance and invalidate it. * In this case, other methods cannot be called. * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @param callback Callback used to return a FileAsset array. - * @deprecated since 9 */ getAllObject(callback: AsyncCallback>): void; /** @@ -839,8 +692,7 @@ declare namespace mediaLibrary { * In this case, other methods cannot be called. * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @return A Promise instance used to return a FileAsset array. - * @deprecated since 9 + * @returns A Promise instance used to return a FileAsset array. */ getAllObject(): Promise>; } @@ -850,63 +702,48 @@ declare namespace mediaLibrary { * * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @since 7 - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.Album */ interface Album { /** * Album ID. * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 */ readonly albumId: number; /** * Album name. * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.Album.albumName */ albumName: string; /** * Album uri. * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.Album.albumUri */ readonly albumUri: string; /** * Date (timestamp) when the album was last modified. * @since 7 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.Album.dateModified */ readonly dateModified: number; /** * File count for the album * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.Album.count */ readonly count: number; /** * Relative path for the album * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.Album.relativePath */ readonly relativePath: string; /** * coverUri for the album * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.Album.coverUri */ readonly coverUri: string; @@ -916,8 +753,6 @@ declare namespace mediaLibrary { * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @permission ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA * @param callback, no value will be returned. - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.Album.commitModify */ commitModify(callback: AsyncCallback): void; /** @@ -925,8 +760,6 @@ declare namespace mediaLibrary { * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @permission ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.Album.commitModify */ commitModify(): Promise; /** @@ -935,8 +768,6 @@ declare namespace mediaLibrary { * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @permission ohos.permission.READ_MEDIA * @param callback Callback used to return the files in the format of a FetchFileResult instance. - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.Album.getFileAssets */ getFileAssets(callback: AsyncCallback): void; /** @@ -946,8 +777,6 @@ declare namespace mediaLibrary { * @permission ohos.permission.READ_MEDIA * @param option Media retrieval options. * @param callback Callback used to return the files in the format of a FetchFileResult instance. - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.Album.getFileAssets */ getFileAssets(options: MediaFetchOptions, callback: AsyncCallback): void; /** @@ -956,9 +785,7 @@ declare namespace mediaLibrary { * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @permission ohos.permission.READ_MEDIA * @param option Media retrieval options. - * @return A Promise instance used to return the files in the format of a FetchFileResult instance. - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.Album.getFileAssets + * @returns A Promise instance used to return the files in the format of a FetchFileResult instance. */ getFileAssets(options?: MediaFetchOptions): Promise; } @@ -967,56 +794,42 @@ declare namespace mediaLibrary { * Enumeration public directory that predefined * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.DirectoryType */ enum DirectoryType { /** * predefined public directory for files token by Camera. * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.DirectoryType.DIR_CAMERA */ DIR_CAMERA = 0, /** * predefined public directory for VIDEO files. * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.DirectoryType.DIR_VIDEO */ DIR_VIDEO, /** * predefined public directory for IMAGE files. * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.DirectoryType.DIR_IMAGE */ DIR_IMAGE, /** * predefined public directory for AUDIO files. * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.DirectoryType.DIR_AUDIO */ DIR_AUDIO, /** * predefined public directory for DOCUMENTS files. * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.DirectoryType.DIR_DOCUMENTS */ DIR_DOCUMENTS, /** * predefined public directory for DOWNLOAD files. * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.DirectoryType.DIR_DOWNLOAD */ DIR_DOWNLOAD } @@ -1026,8 +839,6 @@ declare namespace mediaLibrary { * * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @since 6 - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.UserFileManager */ interface MediaLibrary { /** @@ -1036,8 +847,6 @@ declare namespace mediaLibrary { * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @param type, public directory predefined in DirectoryType. * @param callback Callback return the FetchFileResult. - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.UserFileManager.getPublicDirectory */ getPublicDirectory(type: DirectoryType, callback: AsyncCallback): void; /** @@ -1045,9 +854,7 @@ declare namespace mediaLibrary { * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @param type public directory predefined in DirectoryType. - * @return A promise instance used to return the public directory in the format of string - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.UserFileManager.getPublicDirectory + * @returns A promise instance used to return the public directory in the format of string */ getPublicDirectory(type: DirectoryType): Promise; /** @@ -1058,8 +865,6 @@ declare namespace mediaLibrary { * @permission ohos.permission.READ_MEDIA * @param options, Media retrieval options. * @param callback, Callback return the FetchFileResult. - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.UserFileManager.getFileAssets */ getFileAssets(options: MediaFetchOptions, callback: AsyncCallback): void; /** @@ -1069,29 +874,23 @@ declare namespace mediaLibrary { * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @permission ohos.permission.READ_MEDIA * @param options Media retrieval options. - * @return A promise instance used to return the files in the format of a FetchFileResult instance - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.UserFileManager.getFileAssets + * @returns A promise instance used to return the files in the format of a FetchFileResult instance */ getFileAssets(options: MediaFetchOptions): Promise; /** - * Turn on mornitor the data changes by media type + * Turn on monitor the data changes by media type * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @param type one of 'deviceChange','albumChange','imageChange','audioChange','videoChange','fileChange','remoteFileChange' * @param callback no value returned - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.UserFileManager.on */ on(type: 'deviceChange'|'albumChange'|'imageChange'|'audioChange'|'videoChange'|'fileChange'|'remoteFileChange', callback: Callback): void; /** - * Turn off mornitor the data changes by media type + * Turn off monitor the data changes by media type * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @param type one of 'deviceChange','albumChange','imageChange','audioChange','videoChange','fileChange','remoteFileChange' * @param callback no value returned - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.UserFileManager.off */ off(type: 'deviceChange'|'albumChange'|'imageChange'|'audioChange'|'videoChange'|'fileChange'|'remoteFileChange', callback?: Callback): void; /** @@ -1103,8 +902,6 @@ declare namespace mediaLibrary { * @param displayName file name * @param relativePath relative path * @param callback Callback used to return the FileAsset - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.UserFileManager.createAsset */ createAsset(mediaType: MediaType, displayName: string, relativePath: string, callback: AsyncCallback): void; /** @@ -1115,9 +912,7 @@ declare namespace mediaLibrary { * @param mediaType mediaType for example:IMAGE, VIDEO, AUDIO, FILE * @param displayName file name * @param relativePath relative path - * @return A Promise instance used to return the FileAsset - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.UserFileManager.createAsset + * @returns A Promise instance used to return the FileAsset */ createAsset(mediaType: MediaType, displayName: string, relativePath: string): Promise; /** @@ -1128,8 +923,6 @@ declare namespace mediaLibrary { * @param uri FileAsset's URI * @param callback no value returned * @systemapi - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.UserFileManager.deleteAsset */ deleteAsset(uri: string, callback: AsyncCallback): void; /** @@ -1138,10 +931,8 @@ declare namespace mediaLibrary { * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @permission ohos.permission.READ_MEDIA and ohos.permission.WRITE_MEDIA * @param uri, FileAsset's URI - * @return A Promise instance, no value returned + * @returns A Promise instance, no value returned * @systemapi - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.UserFileManager.deleteAsset */ deleteAsset(uri: string): Promise; /** @@ -1151,8 +942,6 @@ declare namespace mediaLibrary { * @permission ohos.permission.READ_MEDIA * @param option Media retrieval options. * @param callback Callback used to return an album array. - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.UserFileManager.getAlbums */ getAlbums(options: MediaFetchOptions, callback: AsyncCallback>): void; /** @@ -1161,9 +950,7 @@ declare namespace mediaLibrary { * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @permission ohos.permission.READ_MEDIA * @param option Media retrieval options. - * @return A Promise instance used to return an album array. - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.UserFileManager.getAlbums + * @returns A Promise instance used to return an album array. */ getAlbums(options: MediaFetchOptions): Promise>; /** @@ -1181,7 +968,7 @@ declare namespace mediaLibrary { * @since 6 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @param option Media resource option. - * @return Promise used to return the URI that stores the media resources. + * @returns Promise used to return the URI that stores the media resources. * @deprecated since 9 */ storeMediaAsset(option: MediaAssetOption): Promise; @@ -1212,7 +999,7 @@ declare namespace mediaLibrary { * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @param images List of images to preview. * @param index Sequence number of the first image to preview. - * @return Promise used to return whether the operation is successful. + * @returns Promise used to return whether the operation is successful. * @deprecated since 9 */ startImagePreview(images: Array, index?: number): Promise; @@ -1232,7 +1019,7 @@ declare namespace mediaLibrary { * @since 6 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @param option Media selection option. - * @return Promise used to return the list of URIs that store the selected media resources. + * @returns Promise used to return the list of URIs that store the selected media resources. * @deprecated since 9 */ startMediaSelect(option: MediaSelectOption): Promise>; @@ -1243,8 +1030,6 @@ declare namespace mediaLibrary { * @permission ohos.permission.READ_MEDIA * @systemapi * @param callback, Callback return the list of the active peer devices' information - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.UserFileManager.getActivePeers */ getActivePeers(callback: AsyncCallback>): void; /** @@ -1253,9 +1038,7 @@ declare namespace mediaLibrary { * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore * @permission ohos.permission.READ_MEDIA * @systemapi - * @return Promise used to return the list of the active peer devices' information - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.UserFileManager.getActivePeers + * @returns Promise used to return the list of the active peer devices' information */ getActivePeers(): Promise>; /** @@ -1265,8 +1048,6 @@ declare namespace mediaLibrary { * @permission ohos.permission.READ_MEDIA * @systemapi * @param callback Callback return the list of the all the peer devices' information - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.UserFileManager.getAllPeers */ getAllPeers(callback: AsyncCallback>): void; /** @@ -1275,9 +1056,7 @@ declare namespace mediaLibrary { * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore * @permission ohos.permission.READ_MEDIA * @systemapi - * @return Promise used to return the list of the all the peer devices' information - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.UserFileManager.getAllPeers + * @returns Promise used to return the list of the all the peer devices' information */ getAllPeers(): Promise>; /** @@ -1285,61 +1064,47 @@ declare namespace mediaLibrary { * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @param callback no value returned - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.UserFileManager.release */ release(callback: AsyncCallback): void; /** * Release MediaLibrary instance * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.UserFileManager.release */ release(): Promise; } /** - * thumbnail's size which have width and heigh + * thumbnail's size which have width and height * @syscap SystemCapability.Multimedia.MediaLibrary.Core * @since 8 - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.Size */ interface Size { /** * Width of image file * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.Size.width */ width: number; /** * Height of image file * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.Core - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.Size.height */ height: number; } - + /** * peer devices' information * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore * @systemapi * @since 8 - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.PeerInfo */ interface PeerInfo { /** * Peer device name * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.PeerInfo.deviceName * @systemapi */ readonly deviceName: string; @@ -1347,8 +1112,6 @@ declare namespace mediaLibrary { * Peer device network id * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.PeerInfo.networkId * @systemapi */ readonly networkId: string; @@ -1356,7 +1119,6 @@ declare namespace mediaLibrary { * Peer device type * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore - * @deprecated since 9 * @systemapi */ readonly deviceType: DeviceType; @@ -1365,8 +1127,6 @@ declare namespace mediaLibrary { * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore * @systemapi - * @deprecated since 9 - * @useinstead ohos.filemanagement.UserFileManager.PeerInfo.isOnline */ readonly isOnline: boolean; } @@ -1376,15 +1136,13 @@ declare namespace mediaLibrary { * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore * @systemapi * @since 8 - * @deprecated since 9 */ enum DeviceType { /** - * Unknow device type + * Unknown device type * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore * @systemapi - * @deprecated since 9 */ TYPE_UNKNOWN = 0, /** @@ -1392,7 +1150,6 @@ declare namespace mediaLibrary { * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore * @systemapi - * @deprecated since 9 */ TYPE_LAPTOP, /** @@ -1400,7 +1157,6 @@ declare namespace mediaLibrary { * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore * @systemapi - * @deprecated since 9 */ TYPE_PHONE, /** @@ -1408,7 +1164,6 @@ declare namespace mediaLibrary { * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore * @systemapi - * @deprecated since 9 */ TYPE_TABLET, /** @@ -1416,7 +1171,6 @@ declare namespace mediaLibrary { * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore * @systemapi - * @deprecated since 9 */ TYPE_WATCH, /** @@ -1424,7 +1178,6 @@ declare namespace mediaLibrary { * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore * @systemapi - * @deprecated since 9 */ TYPE_CAR, /** @@ -1432,10 +1185,9 @@ declare namespace mediaLibrary { * @since 8 * @syscap SystemCapability.Multimedia.MediaLibrary.DistributedCore * @systemapi - * @deprecated since 9 */ TYPE_TV } } -export default mediaLibrary; +export default mediaLibrary; \ No newline at end of file diff --git a/api/@ohos.multimodalInput.inputConsumer.d.ts b/api/@ohos.multimodalInput.inputConsumer.d.ts index b7e0d8f3c92b80bca3891291a1b74b142a76cd25..bd0666174c642d70d6c2636b8b83ad7b68e1b9e1 100644 --- a/api/@ohos.multimodalInput.inputConsumer.d.ts +++ b/api/@ohos.multimodalInput.inputConsumer.d.ts @@ -20,7 +20,6 @@ import { Callback } from './basic'; * * @since 8 * @syscap SystemCapability.MultimodalInput.Input.InputConsumer - * @import import inputConsumer from '@ohos.multimodalInput.inputConsumer'; * @systemapi hide for inner use */ diff --git a/api/@ohos.multimodalInput.inputDevice.d.ts b/api/@ohos.multimodalInput.inputDevice.d.ts index 2d3cc320917d95964c54880f9856073c5797dea4..01b85fda5a8a6d4d70235fba4a66fa4efa7641fc 100755 --- a/api/@ohos.multimodalInput.inputDevice.d.ts +++ b/api/@ohos.multimodalInput.inputDevice.d.ts @@ -21,7 +21,6 @@ import { KeyCode } from "./@ohos.multimodalInput.keyCode" * * @since 8 * @syscap SystemCapability.MultimodalInput.Input.InputDevice - * @import import inputDevice from '@ohos.multimodalInput.inputDevice'; */ declare namespace inputDevice { /** @@ -93,7 +92,7 @@ declare namespace inputDevice { * @since 9 * @syscap SystemCapability.MultimodalInput.Input.InputDevice * @param type Type of the input device event, which is **change**. - * @return Callback for the input device event. + * @returns Callback for the input device event. * @throws {BusinessError} 401 - Parameter error. */ function on(type: "change", listener: Callback): void; @@ -104,7 +103,7 @@ declare namespace inputDevice { * @since 9 * @syscap SystemCapability.MultimodalInput.Input.InputDevice * @param type Type of the input device event, which is **change**. - * @return Callback for the input device event. + * @returns Callback for the input device event. * @throws {BusinessError} 401 - Parameter error. */ function off(type: "change", listener?: Callback): void; @@ -318,10 +317,10 @@ declare namespace inputDevice { * @syscap SystemCapability.MultimodalInput.Input.InputDevice * @param deviceId ID of the input device. * @param keys Key codes of the input device, You can query a maximum of five key codes at a time. - * @return Returns a result indicating whether the specified key codes are supported. + * @returns Returns a result indicating whether the specified key codes are supported. * @throws {BusinessError} 401 - Parameter error. */ - function supportKeys(deviceId: number, keys: Array, callback: Callback>): void; + function supportKeys(deviceId: number, keys: Array, callback: AsyncCallback>): void; /** * Checks whether the specified key codes of an input device are supported. @@ -330,7 +329,7 @@ declare namespace inputDevice { * @syscap SystemCapability.MultimodalInput.Input.InputDevice * @param deviceId ID of the input device. * @param keys Key codes of the input device, You can query a maximum of five key codes at a time. - * @return Returns a result indicating whether the specified key codes are supported. + * @returns Returns a result indicating whether the specified key codes are supported. * @throws {BusinessError} 401 - Parameter error. */ function supportKeys(deviceId: number, keys: Array): Promise>; @@ -341,7 +340,7 @@ declare namespace inputDevice { * @since 9 * @syscap SystemCapability.MultimodalInput.Input.InputDevice * @param deviceId ID of the specified input device. - * @return Returns the keyboard type. + * @returns Returns the keyboard type. * @throws {BusinessError} 401 - Parameter error. */ function getKeyboardType(deviceId: number, callback: AsyncCallback): void; @@ -352,7 +351,7 @@ declare namespace inputDevice { * @since 9 * @syscap SystemCapability.MultimodalInput.Input.InputDevice * @param deviceId ID of the specified input device. - * @return Returns the keyboard type. + * @returns Returns the keyboard type. * @throws {BusinessError} 401 - Parameter error. */ function getKeyboardType(deviceId: number): Promise; diff --git a/api/@ohos.multimodalInput.inputEvent.d.ts b/api/@ohos.multimodalInput.inputEvent.d.ts index a335447db29e23e0e60934143082320bcdfd249d..79de5c419398158fb7f2eae3c7eb7ad8a6b8a141 100755 --- a/api/@ohos.multimodalInput.inputEvent.d.ts +++ b/api/@ohos.multimodalInput.inputEvent.d.ts @@ -18,7 +18,6 @@ * * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Core - * @import import InputEvent from '@ohos.multimodalInput.inputEvent'; */ export declare interface InputEvent { /** diff --git a/api/@ohos.multimodalInput.inputEventClient.d.ts b/api/@ohos.multimodalInput.inputEventClient.d.ts index 589bb0c18c1763dc7f7431f43b9253bd81a8a9e4..b898d63b38c550bbf2f9eab6a0571b028522ee9d 100644 --- a/api/@ohos.multimodalInput.inputEventClient.d.ts +++ b/api/@ohos.multimodalInput.inputEventClient.d.ts @@ -18,7 +18,6 @@ * * @since 8 * @syscap SystemCapability.MultimodalInput.Input.InputSimulator - * @import import inputEventClient from '@ohos.multimodalInput.inputEventClient'; * @systemapi hide for inner use */ @@ -35,7 +34,7 @@ declare namespace inputEventClient { * @param isIntercepted Whether the key is blocked. */ interface KeyEvent { - isPressed: boolean, + isPressed: boolean; keyCode: number; keyDownDuration: number; isIntercepted: boolean; diff --git a/api/@ohos.multimodalInput.inputMonitor.d.ts b/api/@ohos.multimodalInput.inputMonitor.d.ts index f61123da732df33d02b6c81062f7a9321ac74d9f..3d16252a7195ccd152a1311e51acc39673bb7e5c 100644 --- a/api/@ohos.multimodalInput.inputMonitor.d.ts +++ b/api/@ohos.multimodalInput.inputMonitor.d.ts @@ -21,7 +21,6 @@ import { MouseEvent } from './@ohos.multimodalInput.mouseEvent'; * System API, available only to system processes * @since 7 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor - * @import import inputMonitor from '@ohos.multimodalInput.inputMonitor'; * @permission ohos.permission.INPUT_MONITORING * @systemapi hide for inner use */ @@ -63,7 +62,7 @@ declare namespace inputMonitor { function on(type:"mouse", receiver:Callback):void; /** - * Cancels listening for touch input events. + * Cancel listening for touch input events. * @since 7 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor * @systemapi hide for inner use @@ -76,7 +75,7 @@ declare namespace inputMonitor { function off(type:"touch", receiver?:TouchEventReceiver):void; /** - * Cancels listening for mouse input events. + * Cancel listening for mouse input events. * @since 9 * @syscap SystemCapability.MultimodalInput.Input.InputMonitor * @systemapi hide for inner use diff --git a/api/@ohos.multimodalInput.keyCode.d.ts b/api/@ohos.multimodalInput.keyCode.d.ts index 7da279b403296627084bee2500c29478cabc7f5e..f25638ee7dbad56c203ac9c5055b30743a44cc0f 100644 --- a/api/@ohos.multimodalInput.keyCode.d.ts +++ b/api/@ohos.multimodalInput.keyCode.d.ts @@ -18,7 +18,6 @@ * * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Core -* @import import {KeyCode} from '@ohos.multimodalInput.keyCode', */ export declare enum KeyCode { diff --git a/api/@ohos.multimodalInput.keyEvent.d.ts b/api/@ohos.multimodalInput.keyEvent.d.ts index af0acb4ad4d6963d148e76cbddaa762aa6cd605a..d51cf1af5844da24df8581808ca999be6ea32910 100755 --- a/api/@ohos.multimodalInput.keyEvent.d.ts +++ b/api/@ohos.multimodalInput.keyEvent.d.ts @@ -19,7 +19,6 @@ import { KeyCode } from "./@ohos.multimodalInput.keyCode" * * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Core -* @import import {Action} from '@ohos.multimodalInput.keyEvent'; */ export declare enum Action { /** @@ -43,7 +42,6 @@ export declare enum Action { * * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Core -* @import import {Key} from '@ohos.multimodalInput.keyEvent'; */ export declare interface Key { /** @@ -67,7 +65,6 @@ export declare interface Key { * * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Core -* @import import {KeyEvent} from '@ohos.multimodalInput.keyEvent'; */ export declare interface KeyEvent extends InputEvent { /** diff --git a/api/@ohos.multimodalInput.mouseEvent.d.ts b/api/@ohos.multimodalInput.mouseEvent.d.ts index 8598db12bfaa6d4656a9f26699b8117173b60f4e..7828872e9c85c356649a6b6206f93a674d4df978 100755 --- a/api/@ohos.multimodalInput.mouseEvent.d.ts +++ b/api/@ohos.multimodalInput.mouseEvent.d.ts @@ -20,7 +20,6 @@ import { KeyCode } from "./@ohos.multimodalInput.keyCode" * * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Core - * @import import {Action} from '@ohos.multimodalInput.mouseEvent'; */ export declare enum Action { /** @@ -64,7 +63,6 @@ export declare enum Action { * * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Core - * @import import {Button} from '@ohos.multimodalInput.mouseEvent'; */ export declare enum Button { /** @@ -113,7 +111,6 @@ export declare enum Button { * * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Core - * @import import {Axis} from '@ohos.multimodalInput.mouseEvent'; */ export declare enum Axis { /** @@ -137,7 +134,6 @@ export declare enum Axis { * * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Core - * @import import {AxisValue} from '@ohos.multimodalInput.mouseEvent'; */ export declare interface AxisValue { /** @@ -156,7 +152,6 @@ export declare interface AxisValue { * * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Core - * @import import {MouseEvent} from '@ohos.multimodalInput.mouseEvent'; */ export declare interface MouseEvent extends InputEvent { /** diff --git a/api/@ohos.multimodalInput.pointer.d.ts b/api/@ohos.multimodalInput.pointer.d.ts index 55fa1863b6d8688f50713e6f5fa12fcb75460dfc..195b6d098f006a2e0065e0e0eb66004ad532a6c9 100644 --- a/api/@ohos.multimodalInput.pointer.d.ts +++ b/api/@ohos.multimodalInput.pointer.d.ts @@ -20,7 +20,6 @@ import { AsyncCallback } from "./basic"; * * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Pointer - * @import import pointer from '@ohos.multimodalInput.pointer'; */ declare namespace pointer { /** @@ -242,7 +241,7 @@ declare namespace pointer { * @syscap SystemCapability.MultimodalInput.Input.Pointer * @systemapi hide for inner use * @param speed Pointer moving speed. - * @return Returns the result through a promise. + * @returns Returns the result through a promise. * @throws {BusinessError} 401 - Parameter error. */ function setPointerSpeed(speed: number): Promise; @@ -262,7 +261,7 @@ declare namespace pointer { * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Pointer * @systemapi hide for inner use - * @return Returns the result through a promise. + * @returns Returns the result through a promise. */ function getPointerSpeed(): Promise; @@ -283,7 +282,7 @@ declare namespace pointer { * @syscap SystemCapability.MultimodalInput.Input.Pointer * @param windowId Window ID. * @param pointerStyle Pointer style. - * @return Returns the result through a promise. + * @returns Returns the result through a promise. * @throws {BusinessError} 401 - Parameter error. */ function setPointerStyle(windowId: number, pointerStyle: PointerStyle): Promise; @@ -303,7 +302,7 @@ declare namespace pointer { * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Pointer * @param windowId Window ID. - * @return Returns the result through a promise. + * @returns Returns the result through a promise. * @throws {BusinessError} 401 - Parameter error. */ function getPointerStyle(windowId: number): Promise; @@ -335,7 +334,7 @@ declare namespace pointer { * * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Pointer - * @return Returns true if the pointer icon is visible; returns false otherwise. + * @returns Returns true if the pointer icon is visible; returns false otherwise. * @throws {BusinessError} 401 - Parameter error. */ function isPointerVisible(callback: AsyncCallback): void; @@ -345,7 +344,7 @@ declare namespace pointer { * * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Pointer - * @return Returns true if the pointer icon is visible; returns false otherwise. + * @returns Returns true if the pointer icon is visible; returns false otherwise. */ function isPointerVisible(): Promise; } diff --git a/api/@ohos.multimodalInput.touchEvent.d.ts b/api/@ohos.multimodalInput.touchEvent.d.ts index bf637da06e2ba73c754b62249f8d1a6d907d3e5d..5748890333f8aa26d0e0bdc91c9adb6c52c8494c 100755 --- a/api/@ohos.multimodalInput.touchEvent.d.ts +++ b/api/@ohos.multimodalInput.touchEvent.d.ts @@ -19,7 +19,6 @@ import { InputEvent } from './@ohos.multimodalInput.inputEvent' * * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Core - * @import import {Action} from '@ohos.multimodalInput.touchEvent'; */ export declare enum Action { /** @@ -48,7 +47,6 @@ export declare enum Action { * * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Core - * @import import {ToolType} from '@ohos.multimodalInput.touchEvent'; */ export declare enum ToolType { /** @@ -94,7 +92,6 @@ export declare enum ToolType { * * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Core - * @import import {SourceType} from '@ohos.multimodalInput.touchEvent'; */ export declare enum SourceType { /** @@ -118,7 +115,6 @@ export declare enum SourceType { * * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Core - * @import import {Touch} from '@ohos.multimodalInput.touchEvent'; */ export declare interface Touch { /** @@ -217,7 +213,6 @@ export declare interface Touch { * * @since 9 * @syscap SystemCapability.MultimodalInput.Input.Core - * @import import {TouchEvent} from '@ohos.multimodalInput.touchEvent'; */ export declare interface TouchEvent extends InputEvent { /** diff --git a/api/@ohos.net.connection.d.ts b/api/@ohos.net.connection.d.ts index 84576eeee742051a4a1807706e0eb3e49fe14f02..ea1121b4d85a7db374383f31e5721178f524d564 100644 --- a/api/@ohos.net.connection.d.ts +++ b/api/@ohos.net.connection.d.ts @@ -29,7 +29,7 @@ declare namespace connection { type UDPSocket = socket.UDPSocket; /** - * Create a network connection with optional netSpefifier and timeout. + * Create a network connection with optional netSpecifier and timeout. * * @param netSpecifier Indicates the network specifier. See {@link NetSpecifier}. * @param timeout The time in milliseconds to attempt looking for a suitable network before @@ -52,10 +52,11 @@ declare namespace connection { * *

          To call this method, you must have the {@code ohos.permission.GET_NETWORK_INFO} permission. * - * @return Returns the {@link NetHandle} object; + * @returns Returns the {@link NetHandle} object; * returns {@code null} if the default network is not activated. * @permission ohos.permission.GET_NETWORK_INFO * @since 9 + * @throws {BusinessError} 201 - Permission denied. */ function getDefaultNetSync(): NetHandle; @@ -88,6 +89,18 @@ declare namespace connection { function getNetCapabilities(netHandle: NetHandle, callback: AsyncCallback): void; function getNetCapabilities(netHandle: NetHandle): Promise; + /** + * Checks whether data traffic usage on the current network is metered. + * + * @param callback Returns {@code true} if data traffic usage on the current network is metered; + * returns {@code false} otherwise. + * @permission ohos.permission.GET_NETWORK_INFO + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + */ + function isDefaultNetMetered(callback: AsyncCallback): void; + function isDefaultNetMetered(): Promise; + /** * Checks whether the default data network is activated. * @@ -199,7 +212,7 @@ declare namespace connection { * Resolves a host name to obtain the first IP address based on the specified NetHandle. * * @param host Indicates the host name or the domain. - * @return Returns the first NetAddress. + * @param callback Returns the first NetAddress. * @permission ohos.permission.GET_NETWORK_INFO */ getAddressByName(host: string, callback: AsyncCallback): void; diff --git a/api/@ohos.net.http.d.ts b/api/@ohos.net.http.d.ts index ce56e5554957fe12ba729defb9f8c3e8ae6abfaa..88537cab5304ecb8074a99c6f651fd2cbc7cfac8 100644 --- a/api/@ohos.net.http.d.ts +++ b/api/@ohos.net.http.d.ts @@ -98,14 +98,16 @@ declare namespace http { /** * Registers an observer for HTTP Response Header events. * - * @deprecated use on_headersReceive instead since 8. + * @deprecated since 8 + * @useinstead on_headersReceive */ on(type: "headerReceive", callback: AsyncCallback): void; /** * Unregisters the observer for HTTP Response Header events. * - * @deprecated use off_headersReceive instead since 8. + * @deprecated since 8 + * @useinstead off_headersReceive */ off(type: "headerReceive", callback?: AsyncCallback): void; diff --git a/api/@ohos.net.socket.d.ts b/api/@ohos.net.socket.d.ts index 3fcdd5c8f99714b285935773210c22b68e1fa585..aceaa13962cea1cc3cbabc0fbcdea02013f93340 100644 --- a/api/@ohos.net.socket.d.ts +++ b/api/@ohos.net.socket.d.ts @@ -341,10 +341,100 @@ declare namespace socket { /** * @since 9 */ - export interface TLSSocket extends TCPSocket { + export interface TLSSocket { + + /** + * Binds the IP address and port number. The port number can be specified or randomly allocated by the system. + * + * @param address Destination address. {@link NetAddress} + * @permission ohos.permission.INTERNET + * @throws {BusinessError} 401 - Parameter error. + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 2303198 - Address already in use. + * @throws {BusinessError} 2300002 - System internal error. + */ + bind(address: NetAddress, callback: AsyncCallback): void; + bind(address: NetAddress): Promise; + + /** + * Obtains the peer address of a TLSSocket connection. + * + * @param callback Callback used to return the result. {@link NetAddress} + * @throws {BusinessError} 2303188 - Socket operation on non-socket. + * @throws {BusinessError} 2300002 - System internal error. + */ + getRemoteAddress(callback: AsyncCallback): void; + getRemoteAddress(): Promise; + + /** + * Obtains the status of the TLSSocket connection. + * + * @param callback Callback used to return the result. {@link SocketStateBase} + * @throws {BusinessError} 2303188 - Socket operation on non-socket. + * @throws {BusinessError} 2300002 - System internal error. + */ + getState(callback: AsyncCallback): void; + getState(): Promise; + + /** + * Sets other attributes of the TLSSocket connection. + * + * @param options Optional parameters {@link TCPExtraOptions}. + * @throws {BusinessError} 401 - Parameter error. + * @throws {BusinessError} 2303188 - Socket operation on non-socket. + * @throws {BusinessError} 2300002 - System internal error. + */ + setExtraOptions(options: TCPExtraOptions, callback: AsyncCallback): void; + setExtraOptions(options: TCPExtraOptions): Promise; + + /** + * Listens for message receiving events of the TLSSocket connection. + * + * @throws {BusinessError} 401 - Parameter error. + */ + on(type: 'message', callback: Callback<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}>): void; + + /** + * Cancels listening for message receiving events of the TLSSocket connection. + * + * @throws {BusinessError} 401 - Parameter error. + */ + off(type: 'message', callback?: Callback<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}>): void; + + /** + * Listens for connection or close events of the TLSSocket connection. + * + * @throws {BusinessError} 401 - Parameter error. + */ + on(type: 'connect' | 'close', callback: Callback): void; + + /** + * Cancels listening for connection or close events of the TLSSocket connection. + * + * @throws {BusinessError} 401 - Parameter error. + */ + off(type: 'connect' | 'close', callback?: Callback): void; + + /** + * Listens for error events of the TLSSocket connection. + * + * @throws {BusinessError} 401 - Parameter error. + */ + on(type: 'error', callback: ErrorCallback): void; + + /** + * Cancels listening for error events of the TLSSocket connection. + * + * @throws {BusinessError} 401 - Parameter error. + */ + off(type: 'error', callback?: ErrorCallback): void; /** * Returns an object representing a local certificate. + * + * @throws {BusinessError} 2303501 - SSL is null. + * @throws {BusinessError} 2303504 - Error looking up x509 + * @throws {BusinessError} 2300002 - System internal error. */ getCertificate(callback: AsyncCallback): void; getCertificate(): Promise; @@ -352,8 +442,10 @@ declare namespace socket { /** * Returns an object representing the peer certificate. If the peer does not provide a certificate, * an empty object will be returned. If the socket is destroyed, null is returned. - * If needChain is true, it contains the complete certificate chain. Otherwise, - * it only contains the peer's certificate. + * It only contains the peer's certificate. + * + * @throws {BusinessError} 2303501 - SSL is null. + * @throws {BusinessError} 2300002 - System internal error. */ getRemoteCertificate(callback: AsyncCallback): void; getRemoteCertificate(): Promise; @@ -362,13 +454,22 @@ declare namespace socket { * Returns a string containing the negotiated SSL/TLS protocol version of the current connection. * For connected sockets that have not completed the handshake process, the value 'unknown' will be returned. * Server sockets or disconnected client sockets will return a value of null. + * + * @throws {BusinessError} 2303501 - SSL is null. + * @throws {BusinessError} 2303505 - Error occurred in the tls system call. + * @throws {BusinessError} 2300002 - System internal error. */ getProtocol(callback: AsyncCallback): void; getProtocol(): Promise; /** - * Returns an object containing the negotiated cipher suite information. - * For example:{"name": "AES128-SHA256", "standardName": "TLS_RSA_WITH_AES_128_CBC_SHA256", "version": "TLSv1.2"} + * Returns a list containing the negotiated cipher suite information. + * For example:{"TLS_RSA_WITH_AES_128_CBC_SHA256", "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256"} + * + * @throws {BusinessError} 2303501 - SSL is null. + * @throws {BusinessError} 2303502 - Error in tls reading. + * @throws {BusinessError} 2303505 - Error occurred in the tls system call. + * @throws {BusinessError} 2300002 - System internal error. */ getCipherSuite(callback: AsyncCallback>): void; getCipherSuite(): Promise>; @@ -376,12 +477,30 @@ declare namespace socket { /** * The list of signature algorithms shared between the server and the client, in descending order of priority. * @see https://www.openssl.org/docs/man1.1.1/man3/SSL_get_shared_sigalgs.html + * + * @throws {BusinessError} 2303501 - SSL is null. + * @throws {BusinessError} 2300002 - System internal error. */ getSignatureAlgorithms(callback: AsyncCallback>): void; getSignatureAlgorithms(): Promise>; /** - * @permission ohos.permission.INTERNET + * @throws {BusinessError} 401 - Parameter error. + * @throws {BusinessError} 2303104 - Interrupted system call. + * @throws {BusinessError} 2303109 - Bad file number. + * @throws {BusinessError} 2303111 - Resource temporarily unavailable try again. + * @throws {BusinessError} 2303113 - System permission denied. + * @throws {BusinessError} 2303188 - Socket operation on non-socket. + * @throws {BusinessError} 2303191 - Protocol wrong type for socket. + * @throws {BusinessError} 2303198 - Address already in use. + * @throws {BusinessError} 2303199 - Cannot assign requested address. + * @throws {BusinessError} 2303210 - Connection timed out. + * @throws {BusinessError} 2303501 - SSL is null. + * @throws {BusinessError} 2303502 - Error in tls reading. + * @throws {BusinessError} 2303503 - Error in tls writing + * @throws {BusinessError} 2303505 - Error occurred in the tls system call. + * @throws {BusinessError} 2303506 - Error clearing tls connection. + * @throws {BusinessError} 2300002 - System internal error. */ connect(options: TLSConnectOptions, callback: AsyncCallback): void; connect(options: TLSConnectOptions): Promise; @@ -390,10 +509,27 @@ declare namespace socket { * Sends data over a TLSSocket connection. * * @param data Optional parameters {@link string}. - * @permission ohos.permission.INTERNET + * @throws {BusinessError} 401 - Parameter error. + * @throws {BusinessError} 2303501 - SSL is null. + * @throws {BusinessError} 2303503 - Error in tls writing. + * @throws {BusinessError} 2303505 - Error occurred in the tls system call. + * @throws {BusinessError} 2303506 - Error clearing tls connection. + * @throws {BusinessError} 2300002 - System internal error. */ send(data: string, callback: AsyncCallback): void; send(data: string): Promise; + + /** + * Closes a TLSSocket connection + * + * @throws {BusinessError} 401 - Parameter error. + * @throws {BusinessError} 2303501 - SSL is null. + * @throws {BusinessError} 2303505 - Error occurred in the tls system call. + * @throws {BusinessError} 2303506 - Error clearing tls connection. + * @throws {BusinessError} 2300002 - System internal error. + */ + close(callback: AsyncCallback): void; + close(): Promise; } /** @@ -408,12 +544,12 @@ declare namespace socket { /** * Certificate proving the identity of the client */ - cert: string; + cert?: string; /** * Private key of client certificate */ - key: string; + key?: string; /** * Password of the private key @@ -431,7 +567,7 @@ declare namespace socket { useRemoteCipherPrefer?: boolean; /** - * Supported signature algorithms. This list can contain summary algorithms(SHA256、MD5、etc)、 + * Supported signature algorithms. This string can contain summary algorithms(SHA256、MD5、etc)、 * Public key algorithm(RSA-PSS、ECDSA、etc)、Combination of the two(For example 'RSA+SHA384') * or TLS v1.3 Scheme name(For example rsa_pss_pss_sha512) */ diff --git a/api/@ohos.nfc.tag.d.ts b/api/@ohos.nfc.tag.d.ts index 1543c240c68a18bd16c405eceecb04212a9d185a..20ac89240b326b0e8ddc0e072d06fd10a65241e4 100644 --- a/api/@ohos.nfc.tag.d.ts +++ b/api/@ohos.nfc.tag.d.ts @@ -56,18 +56,18 @@ declare namespace tag { /** Indicates an NDEF tag. */ const NDEF = 6; - /** Indicates a MifareClassic tag. */ - const MIFARE_CLASSIC = 8; - - /** Indicates a MifareUltralight tag. */ - const MIFARE_ULTRALIGHT = 9; - /** - * Indicates an NdefFormatable tag. + * Indicates an NDEF Formatable tag. * * @since 9 */ - const NDEF_FORMATABLE = 10; + const NDEF_FORMATABLE = 7; + + /** Indicates a MIFARE Classic tag. */ + const MIFARE_CLASSIC = 8; + + /** Indicates a MIFARE Ultralight tag. */ + const MIFARE_ULTRALIGHT = 9; /** * TNF types definitions, see NFCForum-TS-NDEF_1.0. @@ -99,7 +99,7 @@ declare namespace tag { } /** - * NfcForum Type definition. The Ndef tag may use one of them. + * NfcForum Type definition. The NDEF tag may use one of them. * * @since 9 * @syscap SystemCapability.Communication.NFC.Core @@ -247,75 +247,85 @@ declare namespace tag { /** * Obtains an {@link IsoDepTag} object based on the tag information. * - *

          During tag reading, if the tag supports the IsoDep technology, an {@link IsoDepTag} object + * During tag reading, if the tag supports the IsoDep technology, an {@link IsoDepTag} object * will be created based on the tag information. * - * @param tagInfo Indicates the tag information. - * @permission ohos.permission.NFC_TAG - * + * @param { TagInfo } tagInfo - Indicates the diapatched tag information. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @syscap SystemCapability.Communication.NFC.Core * @since 9 */ - function getIsoDepTag(tagInfo: TagInfo): IsoDepTag + function getIsoDep(tagInfo: TagInfo): IsoDepTag /** * Obtains an {@link NdefTag} object based on the tag information. * - *

          During tag reading, if the tag supports the NDEF technology, an {@link NdefTag} object + * During tag reading, if the tag supports the NDEF technology, an {@link NdefTag} object * will be created based on the tag information. * - * @param tagInfo Indicates the tag information. - * @permission ohos.permission.NFC_TAG - * + * @param { TagInfo } tagInfo - Indicates the diapatched tag information. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @syscap SystemCapability.Communication.NFC.Core * @since 9 */ - function getNdefTag(tagInfo: TagInfo): NdefTag + function getNdef(tagInfo: TagInfo): NdefTag /** * Obtains an {@link MifareClassicTag} object based on the tag information. * - *

          During tag reading, if the tag supports the MifareClassic technology, + * During tag reading, if the tag supports the MIFARE Classic technology, * an {@link MifareClassicTag} object will be created based on the tag information. * - * @param tagInfo Indicates the tag information. - * @permission ohos.permission.NFC_TAG - * + * @param { TagInfo } tagInfo - Indicates the diapatched tag information. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @syscap SystemCapability.Communication.NFC.Core * @since 9 */ - function getMifareClassicTag(tagInfo: TagInfo): MifareClassicTag + function getMifareClassic(tagInfo: TagInfo): MifareClassicTag /** * Obtains an {@link MifareUltralightTag} object based on the tag information. * - *

          During tag reading, if the tag supports the MifareUltralight technology, + * During tag reading, if the tag supports the MIFARE Ultralight technology, * an {@link MifareUltralightTag} object will be created based on the tag information. * - * @param tagInfo Indicates the tag information. - * @permission ohos.permission.NFC_TAG - * + * @param { TagInfo } tagInfo - Indicates the diapatched tag information. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @syscap SystemCapability.Communication.NFC.Core * @since 9 */ - function getMifareUltralightTag(tagInfo: TagInfo): MifareUltralightTag + function getMifareUltralight(tagInfo: TagInfo): MifareUltralightTag /** * Obtains an {@link NdefFormatableTag} object based on the tag information. * - *

          During tag reading, if the tag supports the NdefFormatable technology, + * During tag reading, if the tag supports the NDEF Formatable technology, * an {@link NdefFormatableTag} object will be created based on the tag information. * - * @param tagInfo Indicates the tag information. - * @permission ohos.permission.NFC_TAG - * + * @param { TagInfo } tagInfo - Indicates the diapatched tag information. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @syscap SystemCapability.Communication.NFC.Core * @since 9 */ - function getNdefFormatableTag(tagInfo: TagInfo): NdefFormatableTag + function getNdefFormatable(tagInfo: TagInfo): NdefFormatableTag /** * Parse a {@link TagInfo} object from Want. * - * @param want The want object that contains the values of TagInfo. - * @return The TagInfo object that's parsed. + * @param { Want } want - The want object that contains the values of TagInfo. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 801 - Capability not supported. * @syscap SystemCapability.Communication.NFC.Core - * @permission ohos.permission.NFC_TAG * @since 9 */ function getTagInfo(want: Want): TagInfo @@ -398,6 +408,88 @@ declare namespace tag { payload: number[]; } + namespace ndef { + /** + * Creates an NDEF record with uri data. + * + * @param { string } uri - Uri data for new NDEF record. + * @return { NdefRecord } The instance of NdefRecord. + * @throws { BusinessError } 401 - The parameter check failed. + * @syscap SystemCapability.Communication.NFC.Core + * @since 9 + */ + function makeUriRecord(uri: string): NdefRecord; + + /** + * Creates an NDEF record with text data. + * + * @param { string } text - Text data for new an NDEF record. + * @param { string } locale - Language code for the NDEF record. if locale is null, use default locale. + * @return { NdefRecord } The instance of NdefRecord. + * @throws { BusinessError } 401 - The parameter check failed. + * @syscap SystemCapability.Communication.NFC.Core + * @since 9 + */ + function makeTextRecord(text: string, locale: string): NdefRecord; + + /** + * Creates an NDEF record with mime data. + * + * @param { string } mimeType type of mime data for new an NDEF record. + * @param { string } mimeData mime data for new an NDEF record. + * @return { NdefRecord } The instance of NdefRecord. + * @throws { BusinessError } 401 - The parameter check failed. + * @syscap SystemCapability.Communication.NFC.Core + * @since 9 + */ + function makeMimeRecord(mimeType: string, mimeData: number[]): NdefRecord; + + /** + * Creates an NDEF record with external data. + * + * @param { string } domainName - Domain name of issuing organization for the external data. + * @param { string } type - Domain specific type of data for the external data. + * @param { number[] } externalData - Data payload of an NDEF record. + * @return { NdefRecord } The instance of NdefRecord. + * @throws { BusinessError } 401 - The parameter check failed. + * @syscap SystemCapability.Communication.NFC.Core + * @since 9 + */ + function makeExternalRecord(domainName: string, type: string, externalData: number[]): NdefRecord; + /** + * Creates an NDEF message with raw bytes. + * + * @param { number[] } data - The raw bytes to parse NDEF message. + * @return { NdefMessage } The instance of NdefMessage. + * @throws { BusinessError } 401 - The parameter check failed. + * @syscap SystemCapability.Communication.NFC.Core + * @since 9 + */ + function createNdefMessage(data: number[]): NdefMessage; + + /** + * Creates an NDEF message with record list. + * + * @param { NdefRecord[] } ndefRecords - The NDEF records to parse NDEF message. + * @return { NdefMessage } The instance of NdefMessage. + * @throws { BusinessError } 401 - The parameter check failed. + * @syscap SystemCapability.Communication.NFC.Core + * @since 9 + */ + function createNdefMessage(ndefRecords: NdefRecord[]): NdefMessage; + + /** + * Parses an NDEF message into raw bytes. + * + * @param { NdefMessage } ndefMessage - An NDEF message to parse. + * @return { number[] } Returns the raw bytes of an NDEF message. + * @throws { BusinessError } 401 - The parameter check failed. + * @syscap SystemCapability.Communication.NFC.Core + * @since 9 + */ + function messageToBytes(ndefMessage: NdefMessage): number[]; + } + export type NfcATag = _NfcATag export type NfcBTag = _NfcBTag export type NfcFTag = _NfcFTag diff --git a/api/@ohos.notification.d.ts b/api/@ohos.notification.d.ts index 9f9beac74a1abd7b35c879012be22866541fac3f..5f59a2d89819af9eb548500f6b6fc5334739e89c 100644 --- a/api/@ohos.notification.d.ts +++ b/api/@ohos.notification.d.ts @@ -36,7 +36,7 @@ import { NotificationUserInput as _NotificationUserInput } from './notification/ /** * Manages notifications. * - *

          Generally, only system applications have permissions on notification subscription and unsubscription. + *

          Generally, only system applications have permissions on notification subscription and unsubscribe. * You can specify the content of a notification to be published and the content is carried by * {@link NotificationRequest}. A notification ID is unique in an application and must be specified * when using {@link NotificationRequest} to carry the notification content. If a notification @@ -47,7 +47,6 @@ import { NotificationUserInput as _NotificationUserInput } from './notification/ * @name notification * @since 7 * @syscap SystemCapability.Notification.Notification - * @import import notification from '@ohos.notification'; * @permission N/A * @deprecated since 9 * @useinstead ohos.notificationManager and ohos.notificationSubscribe @@ -99,7 +98,7 @@ declare namespace notification { function publishAsBundle(request: NotificationRequest, representativeBundle: string, userId: number): Promise; /** - * Cancels a notification with the specified ID. + * Cancel a notification with the specified ID. * * @param id of the notification to cancel, which must be unique in the application. * @param callback callback function @@ -109,7 +108,7 @@ declare namespace notification { function cancel(id: number, callback: AsyncCallback): void; /** - * Cancels a notification with the specified label and ID. + * Cancel a notification with the specified label and ID. * * @param id ID of the notification to cancel, which must be unique in the application. * @param label Label of the notification to cancel. @@ -121,7 +120,7 @@ declare namespace notification { function cancel(id: number, label?: string): Promise; /** - * Cancels a representative notification. + * Cancel a representative notification. * * @since 9 * @param id ID of the notification to cancel, which must be unique in the application. @@ -991,7 +990,7 @@ declare namespace notification { } /** - * The remind type of the nofication. + * The remind type of the notification. * * @since 8 * @systemapi Hide this for inner system use. @@ -1135,7 +1134,7 @@ declare namespace notification { * Describes a NotificationFlags instance. * * @since 9 - * @permission N/A + * @systemapi Hide this for inner system use. * @syscap SystemCapability.Notification.Notification * @deprecated since 9 * @useinstead ohos.notificationManager.NotificationFlags diff --git a/api/@ohos.notificationManager.d.ts b/api/@ohos.notificationManager.d.ts index b7f53c64819767892695dcb13e13221271cb7d37..ee86d311984aca94bf0d065cdeeb4e0e49789ecd 100644 --- a/api/@ohos.notificationManager.d.ts +++ b/api/@ohos.notificationManager.d.ts @@ -31,7 +31,7 @@ import { NotificationUserInput as _NotificationUserInput } from './notification/ /** * Manages notifications. - *

          Generally, only system applications have permissions on notification subscription and unsubscription. + *

          Generally, only system applications have permissions on notification subscription and unsubscribe. * You can specify the content of a notification to be published and the content is carried by * {@link NotificationRequest}. A notification ID is unique in an application and must be specified * when using {@link NotificationRequest} to carry the notification content. If a notification @@ -122,7 +122,7 @@ declare namespace notificationManager { function publishAsBundle(request: NotificationRequest, representativeBundle: string, userId: number): Promise; /** - * Cancels a notification with the specified ID. + * Cancel a notification with the specified ID. * @param { number } id - ID of the notification to cancel, which must be unique in the application. * @param { AsyncCallback } callback - The callback of cancel. * @throws { BusinessError } 401 - If the input parameter is not valid parameter. @@ -132,7 +132,7 @@ declare namespace notificationManager { function cancel(id: number, callback: AsyncCallback): void; /** - * Cancels a notification with the specified label and ID. + * Cancel a notification with the specified label and ID. * @param { number } id - ID of the notification to cancel, which must be unique in the application. * @param { string }label - Label of the notification to cancel. * @param { AsyncCallback } callback - The callback of cancel. @@ -143,7 +143,7 @@ declare namespace notificationManager { function cancel(id: number, label: string, callback: AsyncCallback): void; /** - * Cancels a notification with the specified label and ID. + * Cancel a notification with the specified label and ID. * @param { number } id - ID of the notification to cancel, which must be unique in the application. * @param { string }label - Label of the notification to cancel. * @returns { Promise } The promise returned by the function. @@ -154,7 +154,7 @@ declare namespace notificationManager { function cancel(id: number, label?: string): Promise; /** - * Cancels a representative notification. + * Cancel a representative notification. * @permission ohos.permission.NOTIFICATION_CONTROLLER and ohos.permission.NOTIFICATION_AGENT_CONTROLLER * @param { number } id - ID of the notification to cancel, which must be unique in the application. * @param { string } representativeBundle - bundle name of the representative. @@ -168,7 +168,7 @@ declare namespace notificationManager { function cancelAsBundle(id: number, representativeBundle: string, userId: number, callback: AsyncCallback): void; /** - * Cancels a representative notification. + * Cancel a representative notification. * @permission ohos.permission.NOTIFICATION_CONTROLLER and ohos.permission.NOTIFICATION_AGENT_CONTROLLER * @param { number } id - ID of the notification to cancel, which must be unique in the application. * @param { string } representativeBundle - bundle name of the representative. @@ -182,7 +182,7 @@ declare namespace notificationManager { function cancelAsBundle(id: number, representativeBundle: string, userId: number): Promise; /** - * Cancels all notifications of the current application. + * Cancel all notifications of the current application. * @param { AsyncCallback } callback - The callback of cancelAll. * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Notification.Notification @@ -191,7 +191,7 @@ declare namespace notificationManager { function cancelAll(callback: AsyncCallback): void; /** - * Cancels all notifications of the current application. + * Cancel all notifications of the current application. * @returns { Promise } The promise returned by the function. * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Notification.Notification @@ -1157,17 +1157,6 @@ declare namespace notificationManager { uid?: number; } - /** - * Describes a NotificationKey, which can be used to identify a notification. - * @typedef NotificationKey - * @syscap SystemCapability.Notification.Notification - * @since 9 - */ - export interface NotificationKey { - id: number; - label?: string; - } - /** * The type of the Do Not Disturb. * @enum { number } @@ -1225,7 +1214,7 @@ declare namespace notificationManager { } /** - * The remind type of the nofication. + * The remind type of the notification. * @enum { number } * @syscap SystemCapability.Notification.Notification * @systemapi @@ -1277,25 +1266,6 @@ declare namespace notificationManager { TYPE_TIMER = 2, } - /** - * Reason for remove a notification - * @enum { number } - * @syscap SystemCapability.Notification.Notification - * @systemapi - * @since 9 - */ - export enum RemoveReason { - /** - * Notification clicked notification on the status bar - */ - CLICK_REASON_REMOVE = 1, - - /** - * User dismissal notification on the status bar - */ - CANCEL_REASON_REMOVE = 2, - } - /** * Describes an action button displayed in a notification. * @syscap SystemCapability.Notification.Notification @@ -1341,6 +1311,7 @@ declare namespace notificationManager { /** * Describes a NotificationFlags instance. * @syscap SystemCapability.Notification.Notification + * @systemapi * @since 9 */ export type NotificationFlags = _NotificationFlags diff --git a/api/@ohos.notificationSubscribe.d.ts b/api/@ohos.notificationSubscribe.d.ts index a97f53a9b4bac07786e2093505b6cd002b897a96..0d530853c1c806b290eab8548996534cf3475644 100644 --- a/api/@ohos.notificationSubscribe.d.ts +++ b/api/@ohos.notificationSubscribe.d.ts @@ -22,11 +22,55 @@ import { EnabledNotificationCallbackData as _EnabledNotificationCallbackData } f /** * @name notificationSubscribe * @since 9 + * @systemapi * @syscap SystemCapability.Notification.Notification * @import import notificationSubscribe from '@ohos.notification.subscribe'; * @permission N/A */ declare namespace notificationSubscribe { + /** + * Describes a BundleOption. + * @typedef BundleOption + * @syscap SystemCapability.Notification.Notification + * @systemapi + * @since 9 + */ + export interface BundleOption { + bundle: string; + uid?: number; + } + + /** + * Describes a NotificationKey, which can be used to identify a notification. + * @typedef NotificationKey + * @syscap SystemCapability.Notification.Notification + * @systemapi + * @since 9 + */ + export interface NotificationKey { + id: number; + label?: string; + } + + /** + * Reason for remove a notification + * @enum { number } + * @syscap SystemCapability.Notification.Notification + * @systemapi + * @since 9 + */ + export enum RemoveReason { + /** + * Notification clicked notification on the status bar + */ + CLICK_REASON_REMOVE = 1, + + /** + * User dismissal notification on the status bar + */ + CANCEL_REASON_REMOVE = 2, + } + /** * Subscribe to notifications. * @permission ohos.permission.NOTIFICATION_CONTROLLER diff --git a/api/@ohos.pasteboard.d.ts b/api/@ohos.pasteboard.d.ts index 722c99abcf045939f18650e63524099b818ff971..7de65d4acc613af284c3770ef6b71b6f742ba6bc 100644 --- a/api/@ohos.pasteboard.d.ts +++ b/api/@ohos.pasteboard.d.ts @@ -19,7 +19,6 @@ import image from './@ohos.multimedia.image'; /** * systemPasteboard * @syscap SystemCapability.MiscServices.Pasteboard - * @import import pasteboard from '@ohos.pasteboard'; */ declare namespace pasteboard { /** @@ -184,7 +183,7 @@ declare namespace pasteboard { LocalDevice, /** * CrossDevice indicates that paste in any app across devices is allowed. - * @since9 + * @since 9 */ CrossDevice } diff --git a/api/@ohos.power.d.ts b/api/@ohos.power.d.ts index 40a4bf29995884d3e4844916ca18b93028275c0f..8dc4551a1b85feaf00939d389839648085ddeab4 100644 --- a/api/@ohos.power.d.ts +++ b/api/@ohos.power.d.ts @@ -13,7 +13,7 @@ * limitations under the License. */ -import {AsyncCallback} from './basic'; +import {AsyncCallback, BusinessError} from './basic'; /** * Provides interfaces to manage power. @@ -22,103 +22,156 @@ import {AsyncCallback} from './basic'; * @since 7 */ declare namespace power { - /** - * Shuts down the system. - * - *

          This method requires the ohos.permission.REBOOT permission. - * - * @param reason Indicates the shutdown reason. - * @permission ohos.permission.REBOOT - * @systemapi - * @since 7 - */ - function shutdownDevice(reason: string): void; + /** + * Shuts down the system. + * + *

          This method requires the ohos.permission.REBOOT permission. + * + * @permission ohos.permission.REBOOT + * @param {string} reason Indicates the shutdown reason. + * @throws {BusinessError} 201 - If the permission is denied. + * @throws {BusinessError} 401 - If the reason is not valid. + * @throws {BusinessError} 4900101 - If connecting to the service failed. + * @systemapi + * @since 7 + */ + function shutdown(reason: string): void; - /** - * Restarts the system. - * - *

          This method requires the ohos.permission.REBOOT permission. - * - * @param reason Indicates the restart reason. For example, "updater" means to enter the updater mode - * after the restart. If the parameter is not specified, the system enters the normal mode after the restart. - * @permission ohos.permission.REBOOT - * @since 7 - */ - function rebootDevice(reason: string): void; + /** + * Restarts the system. + * + *

          This method requires the ohos.permission.REBOOT permission. + * + * @param reason Indicates the restart reason. For example, "updater" indicates entering the updater mode + * after the restart. If the parameter is not specified, the system enters the normal mode after the restart. + * @permission ohos.permission.REBOOT + * @since 7 + * @deprecated since 9 + * @useinstead {@link power#reboot} + */ + function rebootDevice(reason: string): void; - /** - * Checks whether the screen of a device is on or off. - * - * @return Returns true if the screen is on; returns false otherwise. - * @since 7 - */ - function isScreenOn(callback: AsyncCallback): void; - function isScreenOn(): Promise; + /** + * Restarts the system. + * + *

          This method requires the ohos.permission.REBOOT permission. + * + * @permission ohos.permission.REBOOT + * @param {string} reason Indicates the restart reason. For example, "updater" indicates entering the updater mode + * after the restart. If the parameter is not specified, the system enters the normal mode after the restart. + * @throws {BusinessError} 201 - If the permission is denied. + * @throws {BusinessError} 401 - If the reason is not valid. + * @throws {BusinessError} 4900101 - If connecting to the service failed. + * @systemapi + * @since 9 + */ + function reboot(reason: string): void; - /** - * Wakes up the device to turn on the screen. - * - * @param detail Indicates the detailed wakeup information. - * @systemapi - * @since 9 - */ - function wakeupDevice(detail: string): void; + /** + * Checks whether the screen of a device is on or off. + * + * @returns Returns true if the screen is on; returns false otherwise. + * @since 7 + * @deprecated since 9 + * @useinstead {@link power#isActive} + */ + function isScreenOn(callback: AsyncCallback): void; + function isScreenOn(): Promise; - /** - * Suspends the device to turn off the screen. - * - * @systemapi - * @since 9 - */ - function suspendDevice(): void; + /** + * Checks whether the device is active. + *

          + * The screen will be on if device is active, screen will be off otherwise. + * + * @returns Returns true if the device is active; returns false otherwise. + * @throws {BusinessError} 4900101 - If connecting to the service failed. + * @since 9 + */ + function isActive(): boolean; - /** - * Obtains the power mode of the current device. For details, see {@link DevicePowerMode}. - * - * @return Returns the power mode of current device . - * @permission ohos.permission.POWER_OPTIMIZATION - * @since 9 - */ - function getPowerMode(callback: AsyncCallback): void; - function getPowerMode(): Promise; + /** + * Wakes up the device to turn on the screen. + * + * @param {string} detail Indicates the detail information who request wakeup. + * @throws {BusinessError} 401 - If the detail is not valid. + * @throws {BusinessError} 4900101 - If connecting to the service failed. + * @systemapi + * @since 9 + */ + function wakeup(detail: string): void; - /** - * Sets the power mode of current device. For details, see {@link DevicePowerMode}. - * - * @param mode Indicates the power mode to set. - * @permission ohos.permission.POWER_OPTIMIZATION - * @systemapi - * @since 9 - */ - function setPowerMode(mode: DevicePowerMode, callback: AsyncCallback): void; - function setPowerMode(mode: DevicePowerMode): Promise; + /** + * Suspends the device to turn off the screen. + * + * @throws {BusinessError} 4900101 - If connecting to the service failed. + * @systemapi + * @since 9 + */ + function suspend(): void; - /** - * Power mode of a device. - * @syscap SystemCapability.PowerManager.PowerManager.Core - * @since 9 - */ - export enum DevicePowerMode { - /** - * Normal power mode - * @since 9 - */ - MODE_NORMAL = 600, - /** - * Power save mode - * @since 9 - */ - MODE_POWER_SAVE, - /** - * Performance power mode - * @since 9 - */ - MODE_PERFORMANCE, - /** - * Extreme power save mode - * @since 9 - */ - MODE_EXTREME_POWER_SAVE - } + /** + * Obtains the power mode of the current device. For details, see {@link DevicePowerMode}. + * + * @permission ohos.permission.POWER_OPTIMIZATION + * @returns The power mode {@link DevicePowerMode} of current device . + * @throws {BusinessError} 201 – If the permission is denied. + * @throws {BusinessError} 4900101 - If connecting to the service failed. + * @since 9 + */ + function getPowerMode(): DevicePowerMode; + + /** + * Obtains the power mode of the current device. For details, see {@link DevicePowerMode}. + * + * @permission ohos.permission.POWER_OPTIMIZATION + * @param {DevicePowerMode} mode Indicates power mode {@link DevicePowerMode} to set. + * @param {AsyncCallback} callback Indicates the callback of setting the power mode. + * @throws {BusinessError} 201 – If the permission is denied. + * @throws {BusinessError} 401 - If mode or callback is not valid. + * @systemapi + * @since 9 + */ + function setPowerMode(mode: DevicePowerMode, callback: AsyncCallback): void; + + /** + * Sets the power mode of current device. For details, see {@link DevicePowerMode}. + * + * @permission ohos.permission.POWER_OPTIMIZATION + * @param {DevicePowerMode} mode Indicates power mode {@link DevicePowerMode} to set. + * @throws {BusinessError} 201 – If the permission is denied. + * @throws {BusinessError} 401 - If mode or callback is not valid. + * @systemapi + * @since 9 + */ + function setPowerMode(mode: DevicePowerMode): Promise; + + /** + * Power mode of a device. + * + * @syscap SystemCapability.PowerManager.PowerManager.Core + * @since 9 + */ + export enum DevicePowerMode { + /** + * Normal power mode + * @since 9 + */ + MODE_NORMAL = 600, + /** + * Power save mode + * @since 9 + */ + MODE_POWER_SAVE, + /** + * Performance power mode + * @since 9 + */ + MODE_PERFORMANCE, + /** + * Extreme power save mode + * @since 9 + */ + MODE_EXTREME_POWER_SAVE + } } export default power; diff --git a/api/@ohos.process.d.ts b/api/@ohos.process.d.ts index 39f8897d6efd4d83745c85797449aee2bcea95b2..7da4212ef49da09e61e0ceaf8dec6daebc2896ad 100644 --- a/api/@ohos.process.d.ts +++ b/api/@ohos.process.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 @@ -30,69 +30,70 @@ declare namespace process { */ export interface ChildProcess { /** - * return pid is the pid of the current process + * Return pid is the pid of the current process * @since 7 * @syscap SystemCapability.Utils.Lang * @systemapi Hide this for inner system use - * @return return the pid of the current process. + * @returns Return the pid of the current process. */ readonly pid: number; + /** - * return ppid is the pid of the current child process + * Return ppid is the pid of the current child process * @since 7 * @syscap SystemCapability.Utils.Lang * @systemapi Hide this for inner system use - * @return return the pid of the current child process. + * @returns Return the pid of the current child process. */ readonly ppid: number; /** - * return exitCode is the exit code of the current child process + * Return exitCode is the exit code of the current child process * @since 7 * @syscap SystemCapability.Utils.Lang * @systemapi Hide this for inner system use - * @return return the exit code of the current child process. + * @returns Return the exit code of the current child process. */ readonly exitCode: number; /** - * return boolean is whether the current process signal is sent successfully + * Return boolean is whether the current process signal is sent successfully * @since 7 * @syscap SystemCapability.Utils.Lang * @systemapi Hide this for inner system use - * @return return whether the current process signal is sent successfully. + * @returns Return whether the current process signal is sent successfully. */ readonly killed: boolean; /** - * return 'number' is the target process exit code + * Return 'number' is the target process exit code * @since 7 * @syscap SystemCapability.Utils.Lang * @systemapi Hide this for inner system use - * @return return the target process exit code. + * @returns Return the target process exit code. */ wait(): Promise; /** - * return it as 'Uint8Array' of the stdout until EOF + * Return it as 'Uint8Array' of the stdout until EOF * @since 7 * @syscap SystemCapability.Utils.Lang * @systemapi Hide this for inner system use - * @return return subprocess standard outpute. + * @returns Return subprocess standard output. */ getOutput(): Promise; /** - * return it as 'Uint8Array of the stderr until EOF + * Return it as 'Uint8Array of the stderr until EOF * @since 7 * @syscap SystemCapability.Utils.Lang * @systemapi Hide this for inner system use - * @return return subprocess standard error output. + * @returns Return subprocess standard error output. */ getErrorOutput(): Promise; /** - * close the target process + * Close the target process * @since 7 * @syscap SystemCapability.Utils.Lang * @systemapi Hide this for inner system use @@ -100,73 +101,152 @@ declare namespace process { close(): void; /** - * send a signal to process + * Send a signal to process * @since 7 * @syscap SystemCapability.Utils.Lang * @systemapi Hide this for inner system use - * @param signal number or string represents the signal sent. + * @param signal Number or string represents the signal sent. */ kill(signal: number | string): void; } /** - * returns the numeric valid group ID of the process + * Process is mainly used to obtain the relevant ID of the process, obtain and modify the + * working directory of the process, exit and close the process. + * @name ProcessManager + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + export class ProcessManager { + /** + * Returns a boolean whether the specified uid belongs to a particular application. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param v An id. + * @returns Return a boolean whether the specified uid belongs to a particular application. + * @throws {BusinessError} 401 - The type of v must be number. + */ + isAppUid(v: number): boolean; + + /** + * Returns the uid based on the specified user name. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param v Process name. + * @returns Return the uid based on the specified user name. + * @throws {BusinessError} 401 - The type of v must be string. + */ + getUidForName(v: string): number; + + /** + * Returns the thread priority based on the specified tid. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param v The tid of the process. + * @returns Return the thread priority based on the specified tid. + * @throws {BusinessError} 401 - The type of v must be number. + */ + getThreadPriority(v: number): number; + + /** + * Returns the system configuration at runtime. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param name Parameters defined by the system configuration. + * @returns Return the system configuration at runtime. + * @throws {BusinessError} 401 - The type of name must be number. + */ + getSystemConfig(name: number): number; + + /** + * Returns the system value for environment variables. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param name Parameters defined by the system environment variables. + * @returns Return the system value for environment variables. + * @throws {BusinessError} 401 - The type of name must be string. + */ + getEnvironmentVar(name: string): string; + + /** + * Process exit + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param code Process exit code. + * @throws {BusinessError} 401 - The type of code must be number. + */ + exit(code: number): void; + + /** + * Return whether the signal was sent successfully + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param signal Signal sent. + * @param pid Send signal to target pid. + * @returns Return the result of the signal. + * @throws {BusinessError} 401 - if the input parameters are invalid. + */ + kill(signal: number, pid: number): boolean; + } + + /** + * Returns the numeric valid group ID of the process * @since 7 * @syscap SystemCapability.Utils.Lang * @systemapi Hide this for inner system use - * @return return the numeric valid group ID of the process. + * @returns Return the numeric valid group ID of the process. */ const egid: number; /** - * return the numeric valid user identity of the process + * Return the numeric valid user identity of the process * @since 7 * @syscap SystemCapability.Utils.Lang * @systemapi Hide this for inner system use - * @return return the numeric valid user identity of the process. + * @returns Return the numeric valid user identity of the process. */ const euid: number; /** - * returns the numeric group id of the process + * Returns the numeric group id of the process * @since 7 * @syscap SystemCapability.Utils.Lang * @systemapi Hide this for inner system use - * @return return the numeric group if of the process. + * @returns Return the numeric group if of the process. */ const gid: number /** - * returns the digital user id of the process + * Returns the digital user id of the process * @since 7 * @syscap SystemCapability.Utils.Lang - * @return return the digital user id of the process. + * @returns Return the digital user id of the process. */ const uid: number; /** - * return an array with supplementary group id + * Return an array with supplementary group id * @since 7 * @syscap SystemCapability.Utils.Lang * @systemapi Hide this for inner system use - * @return return an array with supplementary group id. + * @returns Return an array with supplementary group id. */ const groups: number[]; /** - * return pid is The pid of the current process + * Return pid is The pid of the current process * @since 7 * @syscap SystemCapability.Utils.Lang - * @return return The pid of the current process. + * @returns Return The pid of the current process. */ const pid: number; /** - * return ppid is The pid of the current child process + * Return ppid is The pid of the current child process * @since 7 * @syscap SystemCapability.Utils.Lang * @systemapi Hide this for inner system use - * @return return The pid of the current child process. + * @returns Return The pid of the current child process. */ const ppid: number; @@ -174,7 +254,7 @@ declare namespace process { * Returns the tid of the current thread. * @since 8 * @syscap SystemCapability.Utils.Lang - * @return return the tid of the current thread. + * @returns Return the tid of the current thread. */ const tid: number; @@ -182,16 +262,18 @@ declare namespace process { * Returns a boolean whether the process is isolated. * @since 8 * @syscap SystemCapability.Utils.Lang - * @return return boolean whether the process is isolated. + * @returns Return boolean whether the process is isolated. */ function isIsolatedProcess(): boolean; /** * Returns a boolean whether the specified uid belongs to a particular application. * @since 8 + * @deprecated since 9 + * @useinstead ohos.process.ProcessManager.isAppUid * @syscap SystemCapability.Utils.Lang * @param v An id. - * @return return a boolean whether the specified uid belongs to a particular application. + * @returns Return a boolean whether the specified uid belongs to a particular application. */ function isAppUid(v: number): boolean; @@ -199,25 +281,29 @@ declare namespace process { * Returns a boolean whether the process is running in a 64-bit environment. * @since 8 * @syscap SystemCapability.Utils.Lang - * @return return a boolean whether the process is running in a 64-bit environment. + * @returns Return a boolean whether the process is running in a 64-bit environment. */ function is64Bit(): boolean; /** * Returns the uid based on the specified user name. * @since 8 + * @deprecated since 9 + * @useinstead ohos.process.ProcessManager.getUidForName * @syscap SystemCapability.Utils.Lang * @param v Process name. - * @return return the uid based on the specified user name. + * @returns Return the uid based on the specified user name. */ function getUidForName(v: string): number; /** * Returns the thread priority based on the specified tid. * @since 8 + * @deprecated since 9 + * @useinstead ohos.process.ProcessManager.getThreadPriority * @syscap SystemCapability.Utils.Lang * @param v The tid of the process. - * @return Return the thread priority based on the specified tid. + * @returns Return the thread priority based on the specified tid. */ function getThreadPriority(v: number): number; @@ -225,7 +311,7 @@ declare namespace process { * Returns the elapsed real time (in milliseconds) taken from the start of the system to the start of the process. * @since 8 * @syscap SystemCapability.Utils.Lang - * @return Return the start of the system to the start of the process. + * @returns Return the start of the system to the start of the process. */ function getStartRealtime(): number; @@ -233,39 +319,43 @@ declare namespace process { * Returns the cpu time (in milliseconds) from the time when the process starts to the current time. * @since 8 * @syscap SystemCapability.Utils.Lang - * @return Return the cpu time (in milliseconds) from the time when the process starts to the current time. + * @returns Return the cpu time (in milliseconds) from the time when the process starts to the current time. */ function getPastCpuTime(): number; /** * Returns the system configuration at runtime. * @since 8 + * @deprecated since 9 + * @useinstead ohos.process.ProcessManager.getSystemConfig * @syscap SystemCapability.Utils.Lang * @param name Parameters defined by the system configuration. - * @return Return the system configuration at runtime. + * @returns Return the system configuration at runtime. */ function getSystemConfig(name: number): number; /** * Returns the system value for environment variables. * @since 8 + * @deprecated since 9 + * @useinstead ohos.process.ProcessManager.getEnvironmentVar * @syscap SystemCapability.Utils.Lang * @param name Parameters defined by the system environment variables. - * @Returns the system value for environment variables. + * @returns Return the system value for environment variables. */ function getEnvironmentVar(name: string): string; type EventListener = (evt: Object) => void; /** - * Return a child process object and spawns a new ChildProcess to run the command + * Return a child process object and spawns a new ChildProcess to run the command. * @since 7 * @syscap SystemCapability.Utils.Lang - * @param command string of the shell commands executed by the child process. + * @param command String of the shell commands executed by the child process. * @param options This is an object. The object contains three parameters. Timeout is the running time of the child * process, killSignal is the signal sent when the child process reaches timeout, and maxBuffer is the size of the * maximum buffer area for standard input and output. * @systemapi Hide this for inner system use - * @return Return a child process object. + * @returns Return a child process object. */ function runCmd(command: string, options?: { timeout?: number, killSignal?: number | string, maxBuffer?: number }): ChildProcess; @@ -293,13 +383,15 @@ declare namespace process { * @syscap SystemCapability.Utils.Lang * @param type Remove the type of registered event. * @systemapi Hide this for inner system use - * @return Return removed result. + * @returns Return removed result. */ function off(type: string): boolean; /** * Process exit * @since 7 + * @deprecated since 9 + * @useinstead ohos.process.ProcessManager.exit * @syscap SystemCapability.Utils.Lang * @param code Process exit code. */ @@ -310,12 +402,12 @@ declare namespace process { * @since 7 * @syscap SystemCapability.Utils.Lang * @systemapi Hide this for inner system use - * @return Return the current work directory. + * @returns Return the current work directory. */ function cwd(): string; /** - * Change current directory + * Change current directory * @since 7 * @syscap SystemCapability.Utils.Lang * @systemapi Hide this for inner system use @@ -327,17 +419,19 @@ declare namespace process { * Returns the running time of the system * @since 7 * @syscap SystemCapability.Utils.Lang - * @return Return the running time of the system. + * @returns Return the running time of the system. */ function uptime(): number; /** * Return whether the signal was sent successfully * @since 7 + * @deprecated since 9 + * @useinstead ohos.process.ProcessManager.kill * @syscap SystemCapability.Utils.Lang * @param signal Signal sent. * @param pid Send signal to target pid. - * @return Return the result of the signal. + * @returns Return the result of the signal. */ function kill(signal: number, pid: number): boolean; } diff --git a/api/@ohos.promptAction.d.ts b/api/@ohos.promptAction.d.ts index 478755f04b2caa6eec89a4a15f91b8f6702286b0..468512dbbb55a44d08cff1307a9d763a74af7f5a 100644 --- a/api/@ohos.promptAction.d.ts +++ b/api/@ohos.promptAction.d.ts @@ -214,4 +214,4 @@ declare namespace promptAction { function showActionMenu(options: ActionMenuOptions): Promise; } -export default prompt; +export default promptAction; diff --git a/api/@ohos.reminderAgent.d.ts b/api/@ohos.reminderAgent.d.ts index d6d9878513bb9dd74dc8891d01ce90da89a1254e..15d5ce7c67b971e84969d3c6f54c9c0cb0c470aa 100644 --- a/api/@ohos.reminderAgent.d.ts +++ b/api/@ohos.reminderAgent.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 @@ -23,7 +23,8 @@ import { NotificationSlot } from './notification/notificationSlot'; * * @since 7 * @syscap SystemCapability.Notification.ReminderAgent - * @import reminderAgent from '@ohos.reminderAgent'; + * @deprecated since 9 + * @useinstead reminderAgentManager */ declare namespace reminderAgent { /** @@ -35,6 +36,8 @@ declare namespace reminderAgent { * @param reminderReq Indicates the reminder instance to publish. * @param callback Indicates the callback function. * @returns reminder id. + * @deprecated since 9 + * @useinstead reminderAgentManager.publishReminder */ function publishReminder(reminderReq: ReminderRequest, callback: AsyncCallback): void; function publishReminder(reminderReq: ReminderRequest): Promise; @@ -46,6 +49,8 @@ declare namespace reminderAgent { * @syscap SystemCapability.Notification.ReminderAgent * @param reminderId Indicates the reminder id. * @param callback Indicates the callback function. + * @deprecated since 9 + * @useinstead reminderAgentManager.cancelReminder */ function cancelReminder(reminderId: number, callback: AsyncCallback): void; function cancelReminder(reminderId: number): Promise; @@ -56,6 +61,8 @@ declare namespace reminderAgent { * @since 7 * @syscap SystemCapability.Notification.ReminderAgent * @param callback Indicates the callback function. + * @deprecated since 9 + * @useinstead reminderAgentManager.getValidReminders */ function getValidReminders(callback: AsyncCallback>): void; function getValidReminders(): Promise>; @@ -66,6 +73,8 @@ declare namespace reminderAgent { * @since 7 * @syscap SystemCapability.Notification.ReminderAgent * @param callback Indicates the callback function. + * @deprecated since 9 + * @useinstead reminderAgentManager.cancelAllReminders */ function cancelAllReminders(callback: AsyncCallback): void; function cancelAllReminders(): Promise; @@ -77,6 +86,8 @@ declare namespace reminderAgent { * @syscap SystemCapability.Notification.ReminderAgent * @param slot Indicates the slot. * @param callback Indicates the callback function. + * @deprecated since 9 + * @useinstead reminderAgentManager.addNotificationSlot */ function addNotificationSlot(slot: NotificationSlot, callback: AsyncCallback): void; function addNotificationSlot(slot: NotificationSlot): Promise; @@ -88,6 +99,8 @@ declare namespace reminderAgent { * @syscap SystemCapability.Notification.ReminderAgent * @param slotType Indicates the type of the slot. * @param callback Indicates the callback function. + * @deprecated since 9 + * @useinstead reminderAgentManager.removeNotificationSlot */ function removeNotificationSlot(slotType: notification.SlotType, callback: AsyncCallback): void; function removeNotificationSlot(slotType: notification.SlotType): Promise; @@ -97,12 +110,16 @@ declare namespace reminderAgent { * * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ActionButtonType */ export enum ActionButtonType { /** * Button for closing the reminder. * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ActionButtonType.ACTION_BUTTON_TYPE_CLOSE */ ACTION_BUTTON_TYPE_CLOSE = 0, @@ -110,6 +127,8 @@ declare namespace reminderAgent { * Button for snoozing the reminder. * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ActionButtonType.ACTION_BUTTON_TYPE_SNOOZE */ ACTION_BUTTON_TYPE_SNOOZE = 1 } @@ -119,12 +138,16 @@ declare namespace reminderAgent { * * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ReminderType */ export enum ReminderType { /** * Countdown reminder. * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ReminderType.REMINDER_TYPE_TIMER */ REMINDER_TYPE_TIMER = 0, @@ -132,6 +155,8 @@ declare namespace reminderAgent { * Calendar reminder. * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ReminderType.REMINDER_TYPE_CALENDAR */ REMINDER_TYPE_CALENDAR = 1, @@ -139,6 +164,8 @@ declare namespace reminderAgent { * Alarm reminder. * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ReminderType.REMINDER_TYPE_ALARM */ REMINDER_TYPE_ALARM = 2 } @@ -148,12 +175,16 @@ declare namespace reminderAgent { * * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ActionButton */ interface ActionButton { /** * Text on the button. * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ActionButton.title */ title: string; @@ -161,6 +192,8 @@ declare namespace reminderAgent { * Button type. * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ActionButton.type */ type: ActionButtonType; } @@ -171,12 +204,16 @@ declare namespace reminderAgent { * * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.WantAgent */ interface WantAgent { /** * Name of the package redirected to when the reminder notification is clicked. * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.WantAgent.pkgName */ pkgName: string; @@ -184,6 +221,8 @@ declare namespace reminderAgent { * Name of the ability that is redirected to when the reminder notification is clicked. * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.WantAgent.abilityName */ abilityName: string; } @@ -193,12 +232,16 @@ declare namespace reminderAgent { * * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.MaxScreenWantAgent */ interface MaxScreenWantAgent { /** * Name of the package that is automatically started when the reminder arrives and the device is not in use. * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.MaxScreenWantAgent.pkgName */ pkgName: string; @@ -206,6 +249,8 @@ declare namespace reminderAgent { * Name of the ability that is automatically started when the reminder arrives and the device is not in use. * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.MaxScreenWantAgent.abilityName */ abilityName: string; } @@ -215,12 +260,16 @@ declare namespace reminderAgent { * * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ReminderRequest */ interface ReminderRequest { /** * Type of the reminder. * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ReminderRequest.reminderType */ reminderType: ReminderType; @@ -229,6 +278,8 @@ declare namespace reminderAgent { * (The parameter is optional. Up to two buttons are supported). * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ReminderRequest.actionButton */ actionButton?: [ActionButton?, ActionButton?]; @@ -236,6 +287,8 @@ declare namespace reminderAgent { * Information about the ability that is redirected to when the notification is clicked. * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ReminderRequest.wantAgent */ wantAgent?: WantAgent; @@ -244,6 +297,8 @@ declare namespace reminderAgent { * If the device is in use, a notification will be displayed. * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ReminderRequest.maxScreenWantAgent */ maxScreenWantAgent?: MaxScreenWantAgent; @@ -251,6 +306,8 @@ declare namespace reminderAgent { * Ringing duration. * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ReminderRequest.ringDuration */ ringDuration?: number; @@ -258,6 +315,8 @@ declare namespace reminderAgent { * Number of reminder snooze times. * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ReminderRequest.snoozeTimes */ snoozeTimes?: number; @@ -265,6 +324,8 @@ declare namespace reminderAgent { * Reminder snooze interval. * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ReminderRequest.timeInterval */ timeInterval?: number; @@ -272,6 +333,8 @@ declare namespace reminderAgent { * Reminder title. * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ReminderRequest.title */ title?: string; @@ -279,6 +342,8 @@ declare namespace reminderAgent { * Reminder content. * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ReminderRequest.content */ content?: string; @@ -286,6 +351,8 @@ declare namespace reminderAgent { * Content to be displayed when the reminder is expired. * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ReminderRequest.expiredContent */ expiredContent?: string; @@ -293,6 +360,8 @@ declare namespace reminderAgent { * Content to be displayed when the reminder is snoozing. * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ReminderRequest.snoozeContent */ snoozeContent?: string; @@ -300,6 +369,8 @@ declare namespace reminderAgent { * notification id. If there are reminders with the same ID, the later one will overwrite the earlier one. * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ReminderRequest.notificationId */ notificationId?: number; @@ -307,15 +378,23 @@ declare namespace reminderAgent { * Type of the slot used by the reminder. * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ReminderRequest.slotType */ slotType?: notification.SlotType; } + /** + * @deprecated since 9 + * @useinstead reminderAgentManager.ReminderRequestCalendar + */ interface ReminderRequestCalendar extends ReminderRequest { /** * Reminder time. * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ReminderRequestCalendar.dateTime */ dateTime: LocalDateTime; @@ -323,6 +402,8 @@ declare namespace reminderAgent { * Month in which the reminder repeats. * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ReminderRequestCalendar.repeatMonths */ repeatMonths?: Array; @@ -330,6 +411,8 @@ declare namespace reminderAgent { * Date on which the reminder repeats. * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ReminderRequestCalendar.repeatDays */ repeatDays?: Array; } @@ -339,12 +422,16 @@ declare namespace reminderAgent { * * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ReminderRequestAlarm */ interface ReminderRequestAlarm extends ReminderRequest { /** * Hour portion of the reminder time. * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ReminderRequestAlarm.hour */ hour: number; @@ -352,6 +439,8 @@ declare namespace reminderAgent { * minute portion of the remidner time. * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ReminderRequestAlarm.minute */ minute: number; @@ -359,6 +448,8 @@ declare namespace reminderAgent { * Days of a week when the reminder repeates. * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ReminderRequestAlarm.daysOfWeek */ daysOfWeek?: Array; } @@ -368,6 +459,8 @@ declare namespace reminderAgent { * * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ReminderRequestTimer */ interface ReminderRequestTimer extends ReminderRequest { triggerTimeInSeconds: number; @@ -378,6 +471,8 @@ declare namespace reminderAgent { * value of year. * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ReminderRequestTimer.year */ year: number; @@ -385,6 +480,8 @@ declare namespace reminderAgent { * value of month. * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ReminderRequestTimer.month */ month: number; @@ -392,6 +489,8 @@ declare namespace reminderAgent { * value of day. * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ReminderRequestTimer.day */ day: number; @@ -399,6 +498,8 @@ declare namespace reminderAgent { * value of hour. * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ReminderRequestTimer.hour */ hour: number; @@ -406,6 +507,8 @@ declare namespace reminderAgent { * value of minute. * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ReminderRequestTimer.minute */ minute: number; @@ -413,6 +516,8 @@ declare namespace reminderAgent { * value of second. * @since 7 * @syscap SystemCapability.Notification.ReminderAgent + * @deprecated since 9 + * @useinstead reminderAgentManager.ReminderRequestTimer.second */ second?: number; } diff --git a/api/@ohos.reminderAgentManager.d.ts b/api/@ohos.reminderAgentManager.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5d91012d63f2b46a6e2701e4c112c9545fb6d3ba --- /dev/null +++ b/api/@ohos.reminderAgentManager.d.ts @@ -0,0 +1,483 @@ +/* + * 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 notification from './@ohos.notification'; +import { NotificationSlot } from './notification/notificationSlot'; + +/** + * Providers static methods for managing reminders, including publishing or canceling a reminder. + * Add or remove a notification slot, and obtain or cancel all reminders of the current application. + * + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ +declare namespace reminderAgentManager { + /** + * Publishes a scheduled reminder. + * + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + * @permission ohos.permission.PUBLISH_AGENT_REMINDER + * @param { ReminderRequest } reminderReq - Indicates the reminder instance to publish. + * @param { AsyncCallback } callback - Indicates the callback function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + */ + function publishReminder(reminderReq: ReminderRequest, callback: AsyncCallback): void; + + /** + * Publishes a scheduled reminder. + * + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + * @permission ohos.permission.PUBLISH_AGENT_REMINDER + * @param { ReminderRequest } reminderReq - Indicates the reminder instance to publish. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @returns { Promise } The reminder id. + */ + function publishReminder(reminderReq: ReminderRequest): Promise; + + /** + * Cancel a reminder. + * + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + * @param { number } reminderId - Indicates the reminder id. + * @param { AsyncCallback } callback - Indicates the callback function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + */ + function cancelReminder(reminderId: number, callback: AsyncCallback): void; + + /** + * Cancel a reminder. + * + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + * @param { number } reminderId - Indicates the reminder id. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @returns { Promise } The promise returned by the function. + */ + function cancelReminder(reminderId: number): Promise; + + /** + * Obtains all the valid reminders of current application. + * + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + * @param { AsyncCallback> } callback - Indicates the callback function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + */ + function getValidReminders(callback: AsyncCallback>): void; + + /** + * Obtains all the valid reminders of current application. + * + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @returns { Promise> } The promise returned by the function. + */ + function getValidReminders(): Promise>; + + /** + * Cancel all the reminders of current application. + * + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + * @param { AsyncCallback } callback - Indicates the callback function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + */ + function cancelAllReminders(callback: AsyncCallback): void; + + /** + * Cancel all the reminders of current application. + * + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @returns { Promise } The promise returned by the function. + */ + function cancelAllReminders(): Promise; + + /** + * Add notification slot. + * + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + * @param { NotificationSlot } slot - Indicates the slot. + * @param { AsyncCallback } callback - Indicates the callback function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + */ + function addNotificationSlot(slot: NotificationSlot, callback: AsyncCallback): void; + + /** + * Add notification slot. + * + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + * @param { NotificationSlot } slot - Indicates the slot. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @returns { Promise } The promise returned by the function. + */ + function addNotificationSlot(slot: NotificationSlot): Promise; + + /** + * Deletes a created notification slot based on the slot type. + * + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + * @param { notification.SlotType } slotType Indicates the type of the slot. + * @param { AsyncCallback } callback - Indicates the callback function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + */ + function removeNotificationSlot(slotType: notification.SlotType, callback: AsyncCallback): void; + + /** + * Deletes a created notification slot based on the slot type. + * + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + * @param { notification.SlotType } slotType Indicates the type of the slot. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @returns { Promise } The promise returned by the function. + */ + function removeNotificationSlot(slotType: notification.SlotType): Promise; + + /** + * Declares action button type. + * + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + export enum ActionButtonType { + /** + * Button for closing the reminder. + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + ACTION_BUTTON_TYPE_CLOSE = 0, + + /** + * Button for snoozing the reminder. + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + ACTION_BUTTON_TYPE_SNOOZE = 1 + } + + /** + * Declares reminder type. + * + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + export enum ReminderType { + /** + * Countdown reminder. + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + REMINDER_TYPE_TIMER = 0, + + /** + * Calendar reminder. + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + REMINDER_TYPE_CALENDAR = 1, + + /** + * Alarm reminder. + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + REMINDER_TYPE_ALARM = 2 + } + + /** + * Action button information. The button will show on displayed reminder. + * + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + interface ActionButton { + /** + * Text on the button. + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + title: string; + + /** + * Button type. + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + type: ActionButtonType; + } + + /** + * Want agent information. + * It will switch to target ability when you click the displayed reminder. + * + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + interface WantAgent { + /** + * Name of the package redirected to when the reminder notification is clicked. + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + pkgName: string; + + /** + * Name of the ability that is redirected to when the reminder notification is clicked. + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + abilityName: string; + } + + /** + * Max screen want agent information. + * + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + interface MaxScreenWantAgent { + /** + * Name of the package that is automatically started when the reminder arrives and the device is not in use. + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + pkgName: string; + + /** + * Name of the ability that is automatically started when the reminder arrives and the device is not in use. + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + abilityName: string; + } + + /** + * Reminder Common information. + * + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + interface ReminderRequest { + /** + * Type of the reminder. + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + reminderType: ReminderType; + + /** + * Action button displayed on the reminder notification. + * (The parameter is optional. Up to two buttons are supported). + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + actionButton?: [ActionButton?, ActionButton?]; + + /** + * Information about the ability that is redirected to when the notification is clicked. + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + wantAgent?: WantAgent; + + /** + * Information about the ability that is automatically started when the reminder arrives. + * If the device is in use, a notification will be displayed. + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + maxScreenWantAgent?: MaxScreenWantAgent; + + /** + * Ringing duration. + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + ringDuration?: number; + + /** + * Number of reminder snooze times. + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + snoozeTimes?: number; + + /** + * Reminder snooze interval. + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + timeInterval?: number; + + /** + * Reminder title. + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + title?: string; + + /** + * Reminder content. + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + content?: string; + + /** + * Content to be displayed when the reminder is expired. + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + expiredContent?: string; + + /** + * Content to be displayed when the reminder is snoozing. + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + snoozeContent?: string; + + /** + * Notification id. If there are reminders with the same ID, the later one will overwrite the earlier one. + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + notificationId?: number; + + /** + * Type of the slot used by the reminder. + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + slotType?: notification.SlotType; + } + + interface ReminderRequestCalendar extends ReminderRequest { + /** + * Reminder time. + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + dateTime: LocalDateTime; + + /** + * Month in which the reminder repeats. + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + repeatMonths?: Array; + + /** + * Date on which the reminder repeats. + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + repeatDays?: Array; + } + + /** + * Alarm reminder information. + * + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + interface ReminderRequestAlarm extends ReminderRequest { + /** + * Hour portion of the reminder time. + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + hour: number; + + /** + * Minute portion of the reminder time. + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + minute: number; + + /** + * Days of a week when the reminder repeats. + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + daysOfWeek?: Array; + } + + /** + * CountDown reminder information. + * + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + interface ReminderRequestTimer extends ReminderRequest { + triggerTimeInSeconds: number; + } + + interface LocalDateTime { + /** + * Value of year. + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + year: number; + + /** + * Value of month. + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + month: number; + + /** + * Value of day. + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + day: number; + + /** + * Value of hour. + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + hour: number; + + /** + * Value of minute. + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + minute: number; + + /** + * Value of second. + * @since 9 + * @syscap SystemCapability.Notification.ReminderAgent + */ + second?: number; + } +} +export default reminderAgentManager; diff --git a/api/@ohos.request.d.ts b/api/@ohos.request.d.ts index 445beb6b174d16f5a091196eb5c874d9164c6bff..2fba516780d407a5d6e5a70bd7a43b2e3e93d69a 100644 --- a/api/@ohos.request.d.ts +++ b/api/@ohos.request.d.ts @@ -251,7 +251,6 @@ declare namespace request { * @param config Download config * @param callback Indicate the callback function to receive DownloadTask. * @permission ohos.permission.INTERNET - * @return - * @FAModelOnly */ function download(config: DownloadConfig, callback: AsyncCallback): void; @@ -266,7 +265,6 @@ declare namespace request { * @param config Download config * @param callback Indicate the callback function to receive DownloadTask. * @permission ohos.permission.INTERNET - * @return - */ function download(context: BaseContext, config: DownloadConfig, callback: AsyncCallback): void; @@ -278,7 +276,6 @@ declare namespace request { * @param config Download config * @param callback Indicate the callback function to receive DownloadTask. * @permission ohos.permission.INTERNET - * @return - * @throws {BusinessError} 201 - the permissions check fails * @throws {BusinessError} 401 - the parameters check fails * @throws {BusinessError} 13400001 - file operation error @@ -295,7 +292,7 @@ declare namespace request { * @useinstead ohos.request.downloadFile * @param config Download config * @permission ohos.permission.INTERNET - * @return - + * @returns { Promise } the promise returned by the function. * @FAModelOnly */ function download(config: DownloadConfig): Promise; @@ -309,7 +306,7 @@ declare namespace request { * @param BaseContext Indicates the application BaseContext. * @param config Download config * @permission ohos.permission.INTERNET - * @return - + * @returns { Promise } the promise returned by the function. */ function download(context: BaseContext, config: DownloadConfig): Promise; @@ -320,7 +317,7 @@ declare namespace request { * @param BaseContext Indicates the application BaseContext. * @param config Download config * @permission ohos.permission.INTERNET - * @return - + * @returns { Promise } the promise returned by the function. * @throws {BusinessError} 201 - the permissions check fails * @throws {BusinessError} 401 - the parameters check fails * @throws {BusinessError} 13400001 - file operation error @@ -338,7 +335,6 @@ declare namespace request { * @param config Upload config * @param callback Indicate the callback function to receive UploadTask. * @permission ohos.permission.INTERNET - * @return - * @FAModelOnly */ function upload(config: UploadConfig, callback: AsyncCallback): void; @@ -353,7 +349,6 @@ declare namespace request { * @param config Upload config * @param callback Indicate the callback function to receive UploadTask. * @permission ohos.permission.INTERNET - * @return - */ function upload(context: BaseContext, config: UploadConfig, callback: AsyncCallback): void; @@ -364,7 +359,6 @@ declare namespace request { * @param BaseContext Indicates the application BaseContext. * @param config Upload config * @param callback Indicate the callback function to receive UploadTask. - * @return - * @throws {BusinessError} 201 - the permissions check fails * @throws {BusinessError} 401 - the parameters check fails * @throws {BusinessError} 13400002 - bad file path @@ -379,7 +373,7 @@ declare namespace request { * @useinstead ohos.request.uploadFile * @param config Upload config * @permission ohos.permission.INTERNET - * @return - + * @returns { Promise } the promise returned by the function. * @FAModelOnly */ function upload(config: UploadConfig): Promise; @@ -393,7 +387,7 @@ declare namespace request { * @param BaseContext Indicates the application BaseContext. * @param config Upload config * @permission ohos.permission.INTERNET - * @return - + * @returns { Promise } the promise returned by the function. */ function upload(context: BaseContext, config: UploadConfig): Promise; @@ -404,7 +398,7 @@ declare namespace request { * @param BaseContext Indicates the application BaseContext. * @param config Upload config * @permission ohos.permission.INTERNET - * @return - + * @returns { Promise } the promise returned by the function. * @throws {BusinessError} 201 - the permissions check fails * @throws {BusinessError} 401 - the parameters check fails * @throws {BusinessError} 13400002 - bad file path @@ -582,7 +576,6 @@ declare namespace request { * receivedSize the length of downloaded data, in bytes * totalSize he length of data expected to be downloaded, in bytes. * @permission ohos.permission.INTERNET - * @return - */ on(type: 'progress', callback: (receivedSize: number, totalSize: number) => void): void; @@ -595,35 +588,32 @@ declare namespace request { * receivedSize the length of downloaded data, in bytes * totalSize he length of data expected to be downloaded, in bytes. * @permission ohos.permission.INTERNET - * @return - */ off(type: 'progress', callback?: (receivedSize: number, totalSize: number) => void): void; /** - * Called when the current download session complete、pause or remove. + * Called when the current download session complete pause or remove. * @syscap SystemCapability.MiscServices.Download * @since 7 * @param type Indicates the download session event type * complete: download task completed, * pause: download task stopped, * remove: download task deleted. - * @param callback The callback function for the download complete、pause or remove change event. + * @param callback The callback function for the download complete pause or remove change event. * @permission ohos.permission.INTERNET - * @return - */ on(type: 'complete' | 'pause' | 'remove', callback: () => void): void; /** - * Called when the current download session complete、pause or remove. + * Called when the current download session complete pause or remove. * @syscap SystemCapability.MiscServices.Download * @since 7 * @param type Indicates the download session event type * complete: download task completed, * pause: download task stopped, * remove: download task deleted. - * @param callback The callback function for the download complete、pause or remove change event. + * @param callback The callback function for the download complete pause or remove change event. * @permission ohos.permission.INTERNET - * @return - */ off(type: 'complete' | 'pause' | 'remove', callback?: () => void): void; @@ -635,7 +625,6 @@ declare namespace request { * @param callback The callback function for the download fail change event * err The error code for download task. * @permission ohos.permission.INTERNET - * @return - */ on(type: 'fail', callback: (err: number) => void): void; @@ -647,7 +636,6 @@ declare namespace request { * @param callback Indicate the callback function to receive err. * err The error code for download task. * @permission ohos.permission.INTERNET - * @return - */ off(type: 'fail', callback?: (err: number) => void): void; @@ -659,7 +647,6 @@ declare namespace request { * @useinstead ohos.request.delete * @param callback Indicates asynchronous invoking Result. * @permission ohos.permission.INTERNET - * @return - */ remove(callback: AsyncCallback): void; @@ -670,7 +657,7 @@ declare namespace request { * @deprecated since 9 * @useinstead ohos.request.delete * @permission ohos.permission.INTERNET - * @return - + * @returns { Promise } the promise returned by the function. */ remove(): Promise; @@ -682,7 +669,6 @@ declare namespace request { * @useinstead ohos.request.suspend * @param callback Indicates asynchronous invoking Result. * @permission ohos.permission.INTERNET - * @return - */ pause(callback: AsyncCallback): void; @@ -693,7 +679,7 @@ declare namespace request { * @deprecated since 9 * @useinstead ohos.request.suspend * @permission ohos.permission.INTERNET - * @return - + * @returns { Promise } the promise returned by the function. */ pause(): Promise; @@ -705,7 +691,6 @@ declare namespace request { * @useinstead ohos.request.restore * @param callback Indicates asynchronous invoking Result. * @permission ohos.permission.INTERNET - * @return - */ resume(callback: AsyncCallback): void; @@ -716,7 +701,7 @@ declare namespace request { * @deprecated since 9 * @useinstead ohos.request.restore * @permission ohos.permission.INTERNET - * @return - + * @returns { Promise } the promise returned by the function. */ resume(): Promise; @@ -728,7 +713,6 @@ declare namespace request { * @useinstead ohos.request.getTaskInfo * @param callback Indicate the callback function to receive download info. * @permission ohos.permission.INTERNET - * @return - */ query(callback: AsyncCallback): void; @@ -739,7 +723,7 @@ declare namespace request { * @deprecated since 9 * @useinstead ohos.request.getTaskInfo * @permission ohos.permission.INTERNET - * @return - + * @returns { Promise } the promise returned by the function. */ query(): Promise; @@ -751,7 +735,6 @@ declare namespace request { * @useinstead ohos.request.getTaskMimeType * @param callback Indicate the callback function to receive download file MIME type. * @permission ohos.permission.INTERNET - * @return - */ queryMimeType(callback: AsyncCallback): void; @@ -762,7 +745,7 @@ declare namespace request { * @deprecated since 9 * @useinstead ohos.request.getTaskMimeType * @permission ohos.permission.INTERNET - * @return - + * @returns { Promise } the promise returned by the function. */ queryMimeType(): Promise; @@ -786,6 +769,16 @@ declare namespace request { * @syscap SystemCapability.MiscServices.Download */ suspend(callback: AsyncCallback): void; + + /** + * Suspend the download task + * @since 9 + * @permission ohos.permission.INTERNET + * @throws {BusinessError} 201 - the permissions check fails + * @throws {BusinessError} 401 - the parameters check fails + * @syscap SystemCapability.MiscServices.Download + * @returns { Promise } the promise returned by the function. + */ suspend(): Promise; /** @@ -797,6 +790,16 @@ declare namespace request { * @syscap SystemCapability.MiscServices.Download */ restore(callback: AsyncCallback): void; + + /** + * Restore the download task + * @since 9 + * @permission ohos.permission.INTERNET + * @throws {BusinessError} 201 - the permissions check fails + * @throws {BusinessError} 401 - the parameters check fails + * @syscap SystemCapability.MiscServices.Download + * @returns { Promise } the promise returned by the function. + */ restore(): Promise; /** @@ -808,6 +811,16 @@ declare namespace request { * @syscap SystemCapability.MiscServices.Download */ getTaskInfo(callback: AsyncCallback): void; + + /** + * Get the download task info + * @since 9 + * @permission ohos.permission.INTERNET + * @throws {BusinessError} 201 - the permissions check fails + * @throws {BusinessError} 401 - the parameters check fails + * @syscap SystemCapability.MiscServices.Download + * @returns { Promise } the promise returned by the function. + */ getTaskInfo(): Promise; /** @@ -819,6 +832,16 @@ declare namespace request { * @syscap SystemCapability.MiscServices.Download */ getTaskMimeType(callback: AsyncCallback): void; + + /** + * Get mimetype of the download task + * @since 9 + * @permission ohos.permission.INTERNET + * @throws {BusinessError} 201 - the permissions check fails + * @throws {BusinessError} 401 - the parameters check fails + * @syscap SystemCapability.MiscServices.Download + * @returns { Promise } the promise returned by the function. + */ getTaskMimeType(): Promise; } @@ -974,7 +997,6 @@ declare namespace request { * uploadedSize The length of uploaded data, in bytes * totalSize The length of data expected to be uploaded, in bytes. * @permission ohos.permission.INTERNET - * @return - */ on(type: 'progress', callback: (uploadedSize: number, totalSize: number) => void): void; @@ -987,7 +1009,6 @@ declare namespace request { * uploadedSize The length of uploaded data, in bytes * totalSize The length of data expected to be uploaded, in bytes. * @permission ohos.permission.INTERNET - * @return - */ off(type: 'progress', callback?: (uploadedSize: number, totalSize: number) => void): void; @@ -999,7 +1020,6 @@ declare namespace request { * @param callback The callback function for the HTTP Response Header event * header HTTP Response Header returned by the developer server. * @permission ohos.permission.INTERNET - * @return - */ on(type: 'headerReceive', callback: (header: object) => void): void; @@ -1011,7 +1031,6 @@ declare namespace request { * @param callback The callback function for the HTTP Response Header event * header HTTP Response Header returned by the developer server. * @permission ohos.permission.INTERNET - * @return - */ off(type: 'headerReceive', callback?: (header: object) => void): void; @@ -1024,7 +1043,6 @@ declare namespace request { * fail: upload task failed * @param callback The callback function for the upload complete or fail change event. * @permission ohos.permission.INTERNET - * @return - */ on(type:'complete' | 'fail', callback: Callback>): void; @@ -1036,7 +1054,6 @@ declare namespace request { * complete: upload task completed * fail: upload task failed * @permission ohos.permission.INTERNET - * @return - */ off(type:'complete' | 'fail', callback?: Callback>): void; @@ -1048,7 +1065,6 @@ declare namespace request { * @useinstead ohos.request.delete * @param callback Indicates asynchronous invoking Result. * @permission ohos.permission.INTERNET - * @return - */ remove(callback: AsyncCallback): void; @@ -1059,7 +1075,7 @@ declare namespace request { * @deprecated since 9 * @useinstead ohos.request.delete * @permission ohos.permission.INTERNET - * @return - + * @returns { Promise } the promise returned by the function. */ remove(): Promise; @@ -1080,6 +1096,7 @@ declare namespace request { * @throws {BusinessError} 201 - the permissions check fails * @throws {BusinessError} 401 - the parameters check fails * @syscap SystemCapability.MiscServices.Upload + * @returns { Promise } the promise returned by the function. */ delete(): Promise; } diff --git a/api/@ohos.resourceManager.d.ts b/api/@ohos.resourceManager.d.ts index b4f2afb22a0ad1165a791f9c389f0479d3d7cd4c..f135490472a3d2b3cfa5917caa243cfb2ad70026 100644 --- a/api/@ohos.resourceManager.d.ts +++ b/api/@ohos.resourceManager.d.ts @@ -15,7 +15,7 @@ import { RawFileDescriptor as _RawFileDescriptor } from './global/rawFileDescriptor'; import { Resource as _Resource } from './global/resource'; -import { AsyncCallback } from './basic'; +import { AsyncCallback as _AsyncCallback } from './basic'; /** * Provides resource related APIs. @@ -185,6 +185,15 @@ export class DeviceCapability { deviceType: DeviceType } +/** + * The ResourceManager callback. + * @since 6 + * @deprecated since 9 + */ + export interface AsyncCallback { + (err: Error, data: T): void; +} + /** * Obtains the ResourceManager object of the current application. * @@ -207,7 +216,7 @@ export function getResourceManager(bundleName: string, callback: AsyncCallback; * Obtains the ResourceManager object of the specified application. * * @param bundleName Indicates the bundle name of the specified application. - * @return Returns that the ResourceManager object is returned in Promise mode. + * @returns Returns that the ResourceManager object is returned in Promise mode. * @since 6 * @FAModelOnly */ @@ -244,7 +253,7 @@ export interface ResourceManager { * Obtains string resources associated with a specified resource ID in Promise mode. * * @param resId Indicates the resource ID. - * @return Returns the character string corresponding to the resource ID. + * @returns Returns the character string corresponding to the resource ID. * @since 6 * @deprecated since 9 * @useinstead ohos.resourceManager.getStringValue @@ -262,13 +271,13 @@ export interface ResourceManager { * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @since 9 */ - getStringValue(resource: Resource, callback: AsyncCallback): void; + getStringValue(resource: Resource, callback: _AsyncCallback): void; /** * Obtains string resources associated with a specified resource object in Promise mode. * * @param resource Indicates the resource object. - * @return Returns the character string corresponding to the resource object. + * @returns Returns the character string corresponding to the resource object. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. @@ -292,7 +301,7 @@ export interface ResourceManager { * Obtains the array of character strings corresponding to a specified resource ID in Promise mode. * * @param resId Indicates the resource ID. - * @return Returns the array of character strings corresponding to the specified resource ID. + * @returns Returns the array of character strings corresponding to the specified resource ID. * @since 6 * @deprecated since 9 * @useinstead ohos.resourceManager.getStringArrayValue @@ -310,13 +319,13 @@ export interface ResourceManager { * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @since 9 */ - getStringArrayValue(resource: Resource, callback: AsyncCallback>): void; + getStringArrayValue(resource: Resource, callback: _AsyncCallback>): void; /** * Obtains the array of character strings corresponding to a specified resource object in Promise mode. * * @param resource Indicates the resource object. - * @return Returns the array of character strings corresponding to the specified resource object. + * @returns Returns the array of character strings corresponding to the specified resource object. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. @@ -340,7 +349,7 @@ export interface ResourceManager { * Obtains the content of the media file corresponding to a specified resource ID in Promise mode. * * @param resId Indicates the resource ID. - * @return Returns the content of the media file corresponding to the specified resource ID. + * @returns Returns the content of the media file corresponding to the specified resource ID. * @since 6 * @deprecated since 9 * @useinstead ohos.resourceManager.getMediaContent @@ -357,13 +366,13 @@ export interface ResourceManager { * @throws { BusinessError } 9001002 - If the resource not found by module resId. * @since 9 */ - getMediaContent(resource: Resource, callback: AsyncCallback): void; + getMediaContent(resource: Resource, callback: _AsyncCallback): void; /** * Obtains the content of the media file corresponding to a specified resource object in Promise mode. * * @param resource Indicates the resource object. - * @return Returns the content of the media file corresponding to the specified resource object. + * @returns Returns the content of the media file corresponding to the specified resource object. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. @@ -387,7 +396,7 @@ export interface ResourceManager { * Obtains the Base64 code of the image resource corresponding to the specified resource ID in Promise mode. * * @param resId Indicates the resource ID. - * @return Returns the Base64 code of the image resource corresponding to the specified resource ID. + * @returns Returns the Base64 code of the image resource corresponding to the specified resource ID. * @since 6 * @deprecated since 9 * @useinstead ohos.resourceManager.getMediaContentBase64 @@ -405,13 +414,13 @@ export interface ResourceManager { * @throws { BusinessError } 9001002 - If the resource not found by module resId. * @since 9 */ - getMediaContentBase64(resource: Resource, callback: AsyncCallback): void; + getMediaContentBase64(resource: Resource, callback: _AsyncCallback): void; /** * Obtains the Base64 code of the image resource corresponding to the specified resource object in Promise mode. * * @param resource Indicates the resource object. - * @return Returns the Base64 code of the image resource corresponding to the specified resource object. + * @returns Returns the Base64 code of the image resource corresponding to the specified resource object. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. @@ -425,12 +434,12 @@ export interface ResourceManager { * @param callback Indicates the asynchronous callback used to return the obtained device capability. * @since 6 */ - getDeviceCapability(callback: AsyncCallback): void; + getDeviceCapability(callback: _AsyncCallback): void; /** * Obtains the device capability in Promise mode. * - * @return Returns the device capability. + * @returns Returns the device capability. * @since 6 */ getDeviceCapability(): Promise; @@ -442,12 +451,12 @@ export interface ResourceManager { * configuration. * @since 6 */ - getConfiguration(callback: AsyncCallback): void; + getConfiguration(callback: _AsyncCallback): void; /** * Obtains the device configuration in Promise mode. * - * @return Returns the device configuration. + * @returns Returns the device configuration. * @since 6 */ getConfiguration(): Promise; @@ -472,7 +481,7 @@ export interface ResourceManager { * * @param resId Indicates the resource ID. * @param num Indicates the number. - * @return Returns the singular-plural character string represented by the ID string + * @returns Returns the singular-plural character string represented by the ID string * corresponding to the specified number. * @since 6 * @deprecated since 9 @@ -494,7 +503,7 @@ export interface ResourceManager { * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @since 9 */ - getPluralStringValue(resource: Resource, num: number, callback: AsyncCallback): void; + getPluralStringValue(resource: Resource, num: number, callback: _AsyncCallback): void; /** * Obtains the singular-plural character string represented by the resource object string corresponding to @@ -502,7 +511,7 @@ export interface ResourceManager { * * @param resource Indicates the resource object. * @param num Indicates the number. - * @return Returns the singular-plural character string represented by the resource object string + * @returns Returns the singular-plural character string represented by the resource object string * corresponding to the specified number. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. @@ -527,7 +536,7 @@ export interface ResourceManager { * Obtains the raw file resource corresponding to the specified resource path in Promise mode. * * @param path Indicates the resource relative path. - * @return Returns the raw file resource corresponding to the specified resource path. + * @returns Returns the raw file resource corresponding to the specified resource path. * @since 8 * @deprecated since 9 * @useinstead ohos.resourceManager.getRawFileContent @@ -549,7 +558,7 @@ export interface ResourceManager { * Obtains the raw file resource descriptor corresponding to the specified resource path in Promise mode. * * @param path Indicates the resource relative path. - * @return Returns the raw file resource descriptor corresponding to the specified resource path. + * @returns Returns the raw file resource descriptor corresponding to the specified resource path. * @since 8 * @deprecated since 9 * @useinstead ohos.resourceManager.getRawFd @@ -571,7 +580,7 @@ export interface ResourceManager { * Obtains close raw file resource descriptor corresponding to the specified resource path in Promise mode. * * @param path Indicates the resource relative path. - * @return Returns result close raw file resource descriptor corresponding to the specified resource path. + * @returns Returns result close raw file resource descriptor corresponding to the specified resource path. * @since 8 * @deprecated since 9 * @useinstead ohos.resourceManager.closeRawFd @@ -589,13 +598,13 @@ export interface ResourceManager { * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @since 9 */ - getStringByName(resName: string, callback: AsyncCallback): void; + getStringByName(resName: string, callback: _AsyncCallback): void; /** * Obtains string resources associated with a specified resource name in Promise mode. * * @param resName Indicates the resource name. - * @return Returns the character string corresponding to the resource name. + * @returns Returns the character string corresponding to the resource name. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. @@ -615,13 +624,13 @@ export interface ResourceManager { * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @since 9 */ - getStringArrayByName(resName: string, callback: AsyncCallback>): void; + getStringArrayByName(resName: string, callback: _AsyncCallback>): void; /** * Obtains the array of character strings corresponding to a specified resource name in Promise mode. * * @param resName Indicates the resource name. - * @return Returns the array of character strings corresponding to the specified resource name. + * @returns Returns the array of character strings corresponding to the specified resource name. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. @@ -640,13 +649,13 @@ export interface ResourceManager { * @throws { BusinessError } 9001004 - If the resource not found by resName. * @since 9 */ - getMediaByName(resName: string, callback: AsyncCallback): void; + getMediaByName(resName: string, callback: _AsyncCallback): void; /** * Obtains the content of the media file corresponding to a specified resource name in Promise mode. * * @param resName Indicates the resource name. - * @return Returns the content of the media file corresponding to the specified resource name. + * @returns Returns the content of the media file corresponding to the specified resource name. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. @@ -665,13 +674,13 @@ export interface ResourceManager { * @throws { BusinessError } 9001004 - If the resource not found by resName. * @since 9 */ - getMediaBase64ByName(resName: string, callback: AsyncCallback): void; + getMediaBase64ByName(resName: string, callback: _AsyncCallback): void; /** * Obtains the Base64 code of the image resource corresponding to the specified resource name in Promise mode. * * @param resName Indicates the resource name. - * @return Returns the Base64 code of the image resource corresponding to the specified resource name. + * @returns Returns the Base64 code of the image resource corresponding to the specified resource name. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. @@ -693,7 +702,7 @@ export interface ResourceManager { * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @since 9 */ - getPluralStringByName(resName: string, num: number, callback: AsyncCallback): void; + getPluralStringByName(resName: string, num: number, callback: _AsyncCallback): void; /** * Obtains the singular-plural character string represented by the name string corresponding to @@ -701,7 +710,7 @@ export interface ResourceManager { * * @param resName Indicates the resource name. * @param num Indicates the number. - * @return Returns the singular-plural character string represented by the name string + * @returns Returns the singular-plural character string represented by the name string * corresponding to the specified number. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. @@ -715,7 +724,7 @@ export interface ResourceManager { * Obtains string resources associated with a specified resource ID. * * @param resId Indicates the resource ID. - * @return Returns the character string corresponding to the resource ID. + * @returns Returns the character string corresponding to the resource ID. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. @@ -728,7 +737,7 @@ export interface ResourceManager { * Obtains string resources associated with a specified resource object. * * @param resource Indicates the resource object. - * @return Returns the character string corresponding to the resource object. + * @returns Returns the character string corresponding to the resource object. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. @@ -741,7 +750,7 @@ export interface ResourceManager { * Obtains string resources associated with a specified resource name. * * @param resName Indicates the resource name. - * @return Returns the character string corresponding to the resource name. + * @returns Returns the character string corresponding to the resource name. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. @@ -754,7 +763,7 @@ export interface ResourceManager { * Obtains the boolean result with a specified resource ID. * * @param resId Indicates the resource ID. - * @return Returns the boolean resource corresponding to the resource ID. + * @returns Returns the boolean resource corresponding to the resource ID. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. @@ -767,7 +776,7 @@ export interface ResourceManager { * Obtains the boolean result with a specified resource object. * * @param resource Indicates the resource object. - * @return Returns the boolean resource corresponding to the resource object. + * @returns Returns the boolean resource corresponding to the resource object. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. @@ -780,7 +789,7 @@ export interface ResourceManager { * Obtains the boolean result with a specified resource name. * * @param resName Indicates the resource name. - * @return Returns the boolean resource corresponding to the resource name. + * @returns Returns the boolean resource corresponding to the resource name. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. @@ -793,7 +802,7 @@ export interface ResourceManager { * Obtains the number result with a specified resource ID. * * @param resId Indicates the resource ID. - * @return Returns the number resource corresponding to the resource ID. + * @returns Returns the number resource corresponding to the resource ID. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. @@ -806,7 +815,7 @@ export interface ResourceManager { * Obtains the number result with a specified resource object. * * @param resource Indicates the resource object. - * @return Returns the number resource corresponding to the resource object. + * @returns Returns the number resource corresponding to the resource object. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the module resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by module resId. @@ -819,7 +828,7 @@ export interface ResourceManager { * Obtains the number result with a specified resource name. * * @param resName Indicates the resource name. - * @return Returns the number resource corresponding to the resource name. + * @returns Returns the number resource corresponding to the resource name. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001003 - If the resName invalid. * @throws { BusinessError } 9001004 - If the resource not found by resName. @@ -846,13 +855,13 @@ export interface ResourceManager { * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @since 9 */ - getStringValue(resId: number, callback: AsyncCallback): void; + getStringValue(resId: number, callback: _AsyncCallback): void; /** * Obtains string resources associated with a specified resource ID in Promise mode. * * @param resId Indicates the resource ID. - * @return Returns the character string corresponding to the resource ID. + * @returns Returns the character string corresponding to the resource ID. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. @@ -872,13 +881,13 @@ export interface ResourceManager { * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @since 9 */ - getStringArrayValue(resId: number, callback: AsyncCallback>): void; + getStringArrayValue(resId: number, callback: _AsyncCallback>): void; /** * Obtains the array of character strings corresponding to a specified resource ID in Promise mode. * * @param resId Indicates the resource ID. - * @return Returns the array of character strings corresponding to the specified resource ID. + * @returns Returns the array of character strings corresponding to the specified resource ID. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. @@ -901,7 +910,7 @@ export interface ResourceManager { * @throws { BusinessError } 9001006 - If the resource re-ref too much. * @since 9 */ - getPluralStringValue(resId: number, num: number, callback: AsyncCallback): void; + getPluralStringValue(resId: number, num: number, callback: _AsyncCallback): void; /** * Obtains the singular-plural character string represented by the ID string corresponding to @@ -909,7 +918,7 @@ export interface ResourceManager { * * @param resId Indicates the resource ID. * @param num Indicates the number. - * @return Returns the singular-plural character string represented by the ID string + * @returns Returns the singular-plural character string represented by the ID string * corresponding to the specified number. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. @@ -929,13 +938,13 @@ export interface ResourceManager { * @throws { BusinessError } 9001002 - If the resource not found by resId. * @since 9 */ - getMediaContent(resId: number, callback: AsyncCallback): void; + getMediaContent(resId: number, callback: _AsyncCallback): void; /** * Obtains the content of the media file corresponding to a specified resource ID in Promise mode. * * @param resId Indicates the resource ID. - * @return Returns the content of the media file corresponding to the specified resource ID. + * @returns Returns the content of the media file corresponding to the specified resource ID. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. @@ -954,13 +963,13 @@ export interface ResourceManager { * @throws { BusinessError } 9001002 - If the resource not found by resId. * @since 9 */ - getMediaContentBase64(resId: number, callback: AsyncCallback): void; + getMediaContentBase64(resId: number, callback: _AsyncCallback): void; /** * Obtains the Base64 code of the image resource corresponding to the specified resource ID in Promise mode. * * @param resId Indicates the resource ID. - * @return Returns the Base64 code of the image resource corresponding to the specified resource ID. + * @returns Returns the Base64 code of the image resource corresponding to the specified resource ID. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001001 - If the resId invalid. * @throws { BusinessError } 9001002 - If the resource not found by resId. @@ -977,13 +986,13 @@ export interface ResourceManager { * @throws { BusinessError } 9001005 - If the resource not found by path. * @since 9 */ - getRawFileContent(path: string, callback: AsyncCallback): void; + getRawFileContent(path: string, callback: _AsyncCallback): void; /** * Obtains the raw file resource corresponding to the specified resource path in Promise mode. * * @param path Indicates the resource relative path. - * @return Returns the raw file resource corresponding to the specified resource path. + * @returns Returns the raw file resource corresponding to the specified resource path. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001005 - If the resource not found by path. * @since 9 @@ -999,13 +1008,13 @@ export interface ResourceManager { * @throws { BusinessError } 9001005 - If the resource not found by path. * @since 9 */ - getRawFd(path: string, callback: AsyncCallback): void; + getRawFd(path: string, callback: _AsyncCallback): void; /** * Obtains the raw file resource descriptor corresponding to the specified resource path in Promise mode. * * @param path Indicates the resource relative path. - * @return Returns the raw file resource descriptor corresponding to the specified resource path. + * @returns Returns the raw file resource descriptor corresponding to the specified resource path. * @throws { BusinessError } 401 - If the input parameter invalid. * @throws { BusinessError } 9001005 - If the resource not found by path. * @since 9 @@ -1021,7 +1030,7 @@ export interface ResourceManager { * @throws { BusinessError } 9001005 - If the resource not found by path. * @since 9 */ - closeRawFd(path: string, callback: AsyncCallback): void; + closeRawFd(path: string, callback: _AsyncCallback): void; /** * Obtains close raw file resource descriptor corresponding to the specified resource path in Promise mode. diff --git a/api/@ohos.resourceschedule.backgroundTaskManager.d.ts b/api/@ohos.resourceschedule.backgroundTaskManager.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9b82d9d302d74fa5c4b218c0c80b8d46b83babd5 --- /dev/null +++ b/api/@ohos.resourceschedule.backgroundTaskManager.d.ts @@ -0,0 +1,339 @@ +/* + * 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 , Callback} from './basic'; +import { WantAgent } from "./@ohos.wantAgent"; +import Context from './application/BaseContext'; + +/** + * Manages background tasks. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask + */ +declare namespace backgroundTaskManager { + /** + * The info of delay suspend. + * + * @name DelaySuspendInfo + * @since 9 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask + */ + interface DelaySuspendInfo { + /** + * The unique identifier of the delay request. + */ + requestId: number; + /** + * The actual delay duration (ms). + */ + actualDelayTime: number; + } + + /** + * Cancels delayed transition to the suspended state. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask + * @param requestId Indicates the identifier of the delay request. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 9800001 - Memory operation failed. + * @throws { BusinessError } 9800002 - Parcel operation failed. + * @throws { BusinessError } 9800003 - Inner transact failed. + * @throws { BusinessError } 9800004 - System service operation failed. + * @throws { BusinessError } 9900001 - Caller information verification failed. + * @throws { BusinessError } 9900002 - Background task verification failed. + */ + function cancelSuspendDelay(requestId: number): void; + + /** + * Obtains the remaining time before an application enters the suspended state. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask + * @param requestId Indicates the identifier of the delay request. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 9800001 - Memory operation failed. + * @throws { BusinessError } 9800002 - Parcel operation failed. + * @throws { BusinessError } 9800003 - Inner transact failed. + * @throws { BusinessError } 9800004 - System service operation failed. + * @throws { BusinessError } 9900001 - Caller information verification failed. + * @throws { BusinessError } 9900002 - Background task verification failed. + * @returns The remaining delay time + */ + function getRemainingDelayTime(requestId: number, callback: AsyncCallback): void; + function getRemainingDelayTime(requestId: number): Promise; + + /** + * Requests delayed transition to the suspended state. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask + * @param reason Indicates the reason for delayed transition to the suspended state. + * @param callback The callback delay time expired. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 9800001 - Memory operation failed. + * @throws { BusinessError } 9800002 - Parcel operation failed. + * @throws { BusinessError } 9800003 - Inner transact failed. + * @throws { BusinessError } 9800004 - System service operation failed. + * @throws { BusinessError } 9900001 - Caller information verification failed. + * @throws { BusinessError } 9900002 - Background task verification failed. + * @returns Info of delay request + */ + function requestSuspendDelay(reason: string, callback: Callback): DelaySuspendInfo; + + /** + * Service ability uses this method to request start running in background. + * system will publish a notification related to the this service. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask + * @permission ohos.permission.KEEP_BACKGROUND_RUNNING + * @param context app running context. + * @param bgMode Indicates which background mode to request. + * @param wantAgent Indicates which ability to start when user click the notification bar. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 9800001 - Memory operation failed. + * @throws { BusinessError } 9800002 - Parcel operation failed. + * @throws { BusinessError } 9800003 - Inner transact failed. + * @throws { BusinessError } 9800004 - System service operation failed. + * @throws { BusinessError } 9800005 - Background task verification failed. + * @throws { BusinessError } 9800006 - Notification verification failed. + * @throws { BusinessError } 9800007 - Task storage failed. + */ + function startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: WantAgent, callback: AsyncCallback): void; + function startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: WantAgent): Promise; + + /** + * Service ability uses this method to request stop running in background. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask + * @param context app running context. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 9800001 - Memory operation failed. + * @throws { BusinessError } 9800002 - Parcel operation failed. + * @throws { BusinessError } 9800003 - Inner transact failed. + * @throws { BusinessError } 9800004 - System service operation failed. + * @throws { BusinessError } 9800005 - Background task verification failed. + * @throws { BusinessError } 9800006 - Notification verification failed. + * @throws { BusinessError } 9800007 - Task storage failed. + */ + function stopBackgroundRunning(context: Context, callback: AsyncCallback): void; + function stopBackgroundRunning(context: Context): Promise; + + /** + * Apply or unapply efficiency resources. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 9800001 - Memory operation failed. + * @throws { BusinessError } 9800002 - Parcel operation failed. + * @throws { BusinessError } 9800003 - Inner transact failed. + * @throws { BusinessError } 9800004 - System service operation failed. + * @throws { BusinessError } 18700001 - Caller information verification failed. + * @systemapi Hide this for inner system use. + */ + function applyEfficiencyResources(request: EfficiencyResourcesRequest): void; + + /** + * Reset all efficiency resources apply. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply + * @systemapi Hide this for inner system use. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 9800001 - Memory operation failed. + * @throws { BusinessError } 9800002 - Parcel operation failed. + * @throws { BusinessError } 9800003 - Inner transact failed. + * @throws { BusinessError } 9800004 - System service operation failed. + * @throws { BusinessError } 18700001 - Caller information verification failed. + */ + function resetAllEfficiencyResources(): void; + + /** + * Supported background mode. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask + */ + export enum BackgroundMode { + /** + * data transfer mode + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask + */ + DATA_TRANSFER = 1, + + /** + * audio playback mode + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask + */ + AUDIO_PLAYBACK = 2, + + /** + * audio recording mode + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask + */ + AUDIO_RECORDING = 3, + + /** + * location mode + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask + */ + LOCATION = 4, + + /** + * bluetooth interaction mode + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask + */ + BLUETOOTH_INTERACTION = 5, + + /** + * multi-device connection mode + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask + */ + MULTI_DEVICE_CONNECTION = 6, + + /** + * wifi interaction mode + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask + * @systemapi Hide this for inner system use. + */ + WIFI_INTERACTION = 7, + + /** + * Voice over Internet Phone mode + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask + * @systemapi Hide this for inner system use. + */ + VOIP = 8, + + /** + * background continuous calculate mode, for example 3D render. + * only supported in particular device + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask + */ + TASK_KEEPING = 9, + } + + /** + * The type of resource. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply + * @systemapi Hide this for inner system use. + */ + export enum ResourceType { + /** + * The cpu resource for not being suspended. + */ + CPU = 1, + + /** + * The resource for not being proxyed common_event. + */ + COMMON_EVENT = 1 << 1, + + /** + * The resource for not being proxyed timer. + */ + TIMER = 1 << 2, + + /** + * The resource for not being proxyed workscheduler. + */ + WORK_SCHEDULER = 1 << 3, + + /** + * The resource for not being proxyed bluetooth. + */ + BLUETOOTH = 1 << 4, + + /** + * The resource for not being proxyed gps. + */ + GPS = 1 << 5, + + /** + * The resource for not being proxyed audio. + */ + AUDIO = 1 << 6 + } + + /** + * The request of efficiency resources. + * + * @name EfficiencyResourcesRequest + * @since 9 + * @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply + * @systemapi Hide this for inner system use. + */ + export interface EfficiencyResourcesRequest { + /** + * The set of resource types that app wants to apply. + */ + resourceTypes: number; + + /** + * True if the app begin to use, else false. + */ + isApply: boolean; + + /** + * The duration that the resource can be used most. + */ + timeOut: number; + + /** + * True if the apply action is persist, else false. Default value is false. + */ + isPersist?: boolean; + + /** + * True if apply action is for process, false is for package. Default value is false. + */ + isProcess?: boolean; + + /** + * The apply reason. + */ + reason: string; + } +} + +export default backgroundTaskManager; diff --git a/api/@ohos.resourceschedule.usageStatistics.d.ts b/api/@ohos.resourceschedule.usageStatistics.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0916267edf0362ce5be618e814a2c938ccb235a6 --- /dev/null +++ b/api/@ohos.resourceschedule.usageStatistics.d.ts @@ -0,0 +1,648 @@ +/* + * 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 , Callback} from './basic'; + +/** + * Provides methods for managing bundle usage statistics, + * including the methods for querying bundle usage information and state data. + * + *

          You can use the methods defined in this class to query + * the usage history and states of bundles in a specified period. + * The system stores the query result in a {@link BundleStatsInfo} instance and + * then returns it to you. + * + * @since 9 + */ +declare namespace usageStatistics { + + /** + * @since 9 + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @systemapi Hide this for inner system use. + */ + interface BundleStatsInfo { + /** + * The identifier of BundleStatsInfo. + */ + id: number; + /** + * The total duration, in milliseconds. + */ + abilityInFgTotalTime?: number; + /** + * The last time when the application was accessed, in milliseconds. + */ + abilityPrevAccessTime?: number; + /** + * The last time when the application was visible in the foreground, in milliseconds. + */ + abilityPrevSeenTime?: number; + /** + * The total duration, in milliseconds. + */ + abilitySeenTotalTime?: number; + /** + * The bundle name of the application. + */ + bundleName?: string; + /** + * The total duration, in milliseconds. + */ + fgAbilityAccessTotalTime?: number; + /** + * The last time when the foreground application was accessed, in milliseconds. + */ + fgAbilityPrevAccessTime?: number; + /** + * The time of the first bundle usage record in this {@code BundleActiveInfo} object, + * in milliseconds. + */ + infosBeginTime?: number; + /** + * The time of the last bundle usage record in this {@code BundleActiveInfo} object, + * in milliseconds. + */ + infosEndTime?: number; + } + + /** + * @since 9 + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @systemapi Hide this for inner system use. + */ + interface HapFormInfo { + /** + * The form name. + */ + formName: string; + /** + * The form dimension. + */ + formDimension: number; + /** + * The form id. + */ + formId: number; + /** + * The last time when the form was accessed, in milliseconds.. + */ + formLastUsedTime: number; + /** + * The click count of module. + */ + count: number; + } + + /** + * @since 9 + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @systemapi Hide this for inner system use. + */ + interface HapModuleInfo { + /** + * The device id of module. + */ + deviceId?: string; + /** + * The bundle name. + */ + bundleName: string; + /** + * The module name. + */ + moduleName: string; + /** + * The main ability name of module. + */ + abilityName?: string; + /** + * The label id of application. + */ + appLabelId?: number; + /** + * The label id of module. + */ + labelId?: number; + /** + * The description id of application. + */ + descriptionId?: number; + /** + * The ability id of main ability. + */ + abilityLableId?: number; + /** + * The description id of main ability. + */ + abilityDescriptionId?: number; + /** + * The icon id of main ability. + */ + abilityIconId?: number; + /** + * The launch count of module. + */ + launchedCount: number; + /** + * The last time when the module was accessed, in milliseconds. + */ + lastModuleUsedTime: number; + /** + * The form usage record list of current module. + */ + formRecords: Array; + } + + /** + * @since 9 + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @systemapi Hide this for inner system use. + */ + interface DeviceEventStats { + /** + * The bundle name or system event name. + */ + name: string; + + /** + * The event id. + */ + eventId: number; + + /** + * The the event occurrence number. + */ + count: number; + } + + /** + * @since 9 + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + */ + interface BundleEvents { + /** + * The usage group of the application. + */ + appGroup?: number; + /** + * The bundle name. + */ + bundleName?: string; + /** + * The shortcut ID. + */ + indexOfLink?: string; + /** + * The class name. + */ + nameOfClass?: string; + /** + * The time when this state occurred, in milliseconds. + */ + eventOccurredTime?: number; + /** + * The event id. + */ + eventId?: number; + } + /** + * @since 9 + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup + * @systemapi Hide this for inner system use. + */ + interface AppGroupCallbackInfo { + /* + * The usage old group of the application + */ + appOldGroup: number; + /* + * The usage new group of the application + */ + appNewGroup: number; + /* + * The use id + */ + userId: number; + /* + * The change reason + */ + changeReason: number; + /* + * The bundle name + */ + bundleName: string; + } + + /** + * Checks whether the application with a specified bundle name is in the idle state. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup + * @param bundleName Indicates the bundle name of the application to query. + * @throws { BusinessError } 201 - Parameter error. + * @throws { BusinessError } 401 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 10000001 - Memory operation failed. + * @throws { BusinessError } 10000002 - Parcel operation failed. + * @throws { BusinessError } 10000003 - System service operation failed. + * @throws { BusinessError } 10000004 - IPC Communication failed. + * @throws { BusinessError } 10000006 - Get application info failed. + * @returns Returns {@code true} if the application is idle in a particular period; + * returns {@code false} otherwise. The time range of the particular period is defined by the system, + * which may be hours or days. + */ + function isIdleState(bundleName: string, callback: AsyncCallback): void; + function isIdleState(bundleName: string): Promise; + + /** + * Queries the app group of the calling application. + * + *

          The priority defined in a priority group restricts the resource usage of an application, + * for example, restricting the running of background tasks.

          + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup + * @throws { BusinessError } 201 - Parameter error. + * @throws { BusinessError } 401 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 10000001 - Memory operation failed. + * @throws { BusinessError } 10000002 - Parcel operation failed. + * @throws { BusinessError } 10000003 - System service operation failed. + * @throws { BusinessError } 10000004 - IPC Communication failed. + * @throws { BusinessError } 10000005 - Application is not installed. + * @throws { BusinessError } 10000006 - Get application info failed. + * @throws { BusinessError } 10100002 - Get Application group info failed. + * @returns Returns the app group of the calling application. + */ + function queryAppGroup(callback: AsyncCallback): void; + function queryAppGroup(): Promise; + + /** + * Queries the usage priority group of the calling application. + * + *

          The priority defined in a priority group restricts the resource usage of an application, + * for example, restricting the running of background tasks.

          + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup + * @permission ohos.permission.BUNDLE_ACTIVE_INFO + * @systemapi Hide this for inner system use. + * @param bundleName, name of the application. + * @throws { BusinessError } 201 - Parameter error. + * @throws { BusinessError } 401 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 10000001 - Memory operation failed. + * @throws { BusinessError } 10000002 - Parcel operation failed. + * @throws { BusinessError } 10000003 - System service operation failed. + * @throws { BusinessError } 10000004 - IPC Communication failed. + * @throws { BusinessError } 10000005 - Application is not installed. + * @throws { BusinessError } 10000006 - Get application info failed. + * @throws { BusinessError } 10100002 - Get Application group info failed. + * @returns Returns the usage priority group of the calling application. + */ + function queryAppGroup(bundleName : string, callback: AsyncCallback): void; + function queryAppGroup(bundleName : string): Promise; + + /** + * @since 9 + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @systemapi Hide this for inner system use. + */ + interface BundleStatsMap { + [key: string]: BundleStatsInfo; + } + + /** + * Queries usage information about each bundle within a specified period. + * + *

          This method queries usage information at the {@link #BY_OPTIMIZED} interval by default.

          + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @permission ohos.permission.BUNDLE_ACTIVE_INFO + * @systemapi Hide this for inner system use. + * @param begin Indicates the start time of the query period, in milliseconds. + * @param end Indicates the end time of the query period, in milliseconds. + * @throws { BusinessError } 201 - Parameter error. + * @throws { BusinessError } 401 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 10000001 - Memory operation failed. + * @throws { BusinessError } 10000002 - Parcel operation failed. + * @throws { BusinessError } 10000003 - System service operation failed. + * @throws { BusinessError } 10000004 - IPC Communication failed. + * @throws { BusinessError } 10000006 - Get application info failed. + * @throws { BusinessError } 10000007 - Get system or actual time failed. + * @returns Returns the {@link BundleStatsMap} objects containing the usage information about each bundle. + */ + function queryBundleStatsInfos(begin: number, end: number, callback: AsyncCallback): void; + function queryBundleStatsInfos(begin: number, end: number): Promise; + + /** + * Declares interval type. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @systemapi Hide this for inner system use. + */ + export enum IntervalType { + /** + * Indicates the interval type that will determine the optimal interval based on the start and end time. + */ + BY_OPTIMIZED = 0, + + /** + * Indicates the daily interval. + */ + BY_DAILY = 1, + + /** + * Indicates the weekly interval. + */ + BY_WEEKLY = 2, + + /** + * Indicates the monthly interval. + */ + BY_MONTHLY = 3, + + /** + * Indicates the annually interval. + */ + BY_ANNUALLY = 4 + } + + /** + * Queries usage information about each bundle within a specified period at a specified interval. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @permission ohos.permission.BUNDLE_ACTIVE_INFO + * @systemapi Hide this for inner system use. + * @param byInterval Indicates the interval at which the usage statistics are queried. + * The value can be {@link #BY_OPTIMIZED}, {@link #BY_DAILY}, + * {@link #BY_WEEKLY}, {@link #BY_MONTHLY}, or {@link #BY_ANNUALLY}. + * @param begin Indicates the start time of the query period, in milliseconds. + * @param end Indicates the end time of the query period, in milliseconds. + * @throws { BusinessError } 201 - Parameter error. + * @throws { BusinessError } 401 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 10000001 - Memory operation failed. + * @throws { BusinessError } 10000002 - Parcel operation failed. + * @throws { BusinessError } 10000003 - System service operation failed. + * @throws { BusinessError } 10000004 - IPC Communication failed. + * @throws { BusinessError } 10000006 - Get application info failed. + * @throws { BusinessError } 10000007 - Get system or actual time failed. + * @returns Returns the list of {@link BundleStatsInfo} objects containing the usage information about each bundle. + */ + function queryBundleStatsInfoByInterval(byInterval: IntervalType, begin: number, end: number, callback: AsyncCallback>): void; + function queryBundleStatsInfoByInterval(byInterval: IntervalType, begin: number, end: number): Promise>; + + /** + * Queries state data of all bundles within a specified period identified by the start and end time. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @permission ohos.permission.BUNDLE_ACTIVE_INFO + * @systemapi Hide this for inner system use. + * @param begin Indicates the start time of the query period, in milliseconds. + * @param end Indicates the end time of the query period, in milliseconds. + * @throws { BusinessError } 201 - Parameter error. + * @throws { BusinessError } 401 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 10000001 - Memory operation failed. + * @throws { BusinessError } 10000002 - Parcel operation failed. + * @throws { BusinessError } 10000003 - System service operation failed. + * @throws { BusinessError } 10000004 - IPC Communication failed. + * @throws { BusinessError } 10000006 - Get application info failed. + * @throws { BusinessError } 10000007 - Get system or actual time failed. + * @returns Returns the list of {@link BundleEvents} objects containing the state data of all bundles. + */ + function queryBundleEvents(begin: number, end: number, callback: AsyncCallback>): void; + function queryBundleEvents(begin: number, end: number): Promise>; + + /** + * Queries state data of the current bundle within a specified period. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @param begin Indicates the start time of the query period, in milliseconds. + * @param end Indicates the end time of the query period, in milliseconds. + * @throws { BusinessError } 201 - Parameter error. + * @throws { BusinessError } 401 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 10000001 - Memory operation failed. + * @throws { BusinessError } 10000002 - Parcel operation failed. + * @throws { BusinessError } 10000003 - System service operation failed. + * @throws { BusinessError } 10000004 - IPC Communication failed. + * @throws { BusinessError } 10000006 - Get application info failed. + * @throws { BusinessError } 10000007 - Get system or actual time failed. + * @returns Returns the {@link BundleEvents} object Array containing the state data of the current bundle. + */ + function queryCurrentBundleEvents(begin: number, end: number, callback: AsyncCallback>): void; + function queryCurrentBundleEvents(begin: number, end: number): Promise>; + + /** + * Queries recently module usage records. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @permission ohos.permission.BUNDLE_ACTIVE_INFO + * @systemapi Hide this for inner system use. + * @param maxNum Indicates max record number in result, max value is 1000, default value is 1000. + * @throws { BusinessError } 201 - Parameter error. + * @throws { BusinessError } 401 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 10000001 - Memory operation failed. + * @throws { BusinessError } 10000002 - Parcel operation failed. + * @throws { BusinessError } 10000003 - System service operation failed. + * @throws { BusinessError } 10000004 - IPC Communication failed. + * @throws { BusinessError } 10000006 - Get application info failed. + * @throws { BusinessError } 10000007 - Get system or actual time failed. + * @returns Returns the {@link HapModuleInfo} object Array containing the usage data of the modules. + */ + function queryModuleUsageRecords(maxNum: number, callback: AsyncCallback>): void; + function queryModuleUsageRecords(maxNum: number): Promise>; + + /** + * Queries recently module usage records. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @permission ohos.permission.BUNDLE_ACTIVE_INFO + * @systemapi Hide this for inner system use. + * @throws { BusinessError } 201 - Parameter error. + * @throws { BusinessError } 401 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 10000001 - Memory operation failed. + * @throws { BusinessError } 10000002 - Parcel operation failed. + * @throws { BusinessError } 10000003 - System service operation failed. + * @throws { BusinessError } 10000004 - IPC Communication failed. + * @throws { BusinessError } 10000006 - Get application info failed. + * @throws { BusinessError } 10000007 - Get system or actual time failed. + * @returns Returns the {@link HapModuleInfo} object Array containing the usage data of the modules. + */ + function queryModuleUsageRecords(callback: AsyncCallback>): void; + function queryModuleUsageRecords(): Promise>; + + /** + * Declares group type. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup + * @systemapi Hide this for inner system use. + */ + export enum GroupType { + /** + * Indicates the alive group. + */ + ALIVE_GROUP = 10, + + /** + * Indicates the daily group. + */ + DAILY_GROUP = 20, + + /** + * Indicates the fixed group. + */ + FIXED_GROUP = 30, + + /** + * Indicates the rare group. + */ + RARE_GROUP = 40, + + /** + * Indicates the limit group. + */ + LIMITED_GROUP = 50, + + /** + * Indicates the never group. + */ + NEVER_GROUP = 60 + } + + /** + * Set app group by bundleName and number. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup + * @permission ohos.permission.BUNDLE_ACTIVE_INFO + * @systemapi Hide this for inner system use. + * @param bundleName, name of the application. + * @param newGroup, the group of the application whose name is bundleName. + * @throws { BusinessError } 201 - Parameter error. + * @throws { BusinessError } 401 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 10000001 - Memory operation failed. + * @throws { BusinessError } 10000002 - Parcel operation failed. + * @throws { BusinessError } 10000003 - System service operation failed. + * @throws { BusinessError } 10000004 - IPC Communication failed. + * @throws { BusinessError } 10000006 - Get application info failed. + * @throws { BusinessError } 10100001 - Application group operation repeated. + */ + function setAppGroup(bundleName: string, newGroup: GroupType, callback: AsyncCallback): void; + function setAppGroup(bundleName: string, newGroup: GroupType): Promise; + + /** + * Register callback to service. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup + * @permission ohos.permission.BUNDLE_ACTIVE_INFO + * @systemapi Hide this for inner system use. + * @param Callback, callback when application group change,return the AppGroupCallbackInfo. + * @throws { BusinessError } 201 - Parameter error. + * @throws { BusinessError } 401 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 10000001 - Memory operation failed. + * @throws { BusinessError } 10000002 - Parcel operation failed. + * @throws { BusinessError } 10000003 - System service operation failed. + * @throws { BusinessError } 10000004 - IPC Communication failed. + * @throws { BusinessError } 10100001 - Application group operation repeated. + * @returns Returns AppGroupCallbackInfo when the group of bundle changed. + */ + function registerAppGroupCallBack(groupCallback: Callback, callback: AsyncCallback): void; + function registerAppGroupCallBack(groupCallback: Callback): Promise; + + /** + * Unregister callback from service. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.AppGroup + * @permission ohos.permission.BUNDLE_ACTIVE_INFO + * @systemapi Hide this for inner system use. + * @throws { BusinessError } 201 - Parameter error. + * @throws { BusinessError } 401 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 10000001 - Memory operation failed. + * @throws { BusinessError } 10000002 - Parcel operation failed. + * @throws { BusinessError } 10000003 - System service operation failed. + * @throws { BusinessError } 10000004 - IPC Communication failed. + * @throws { BusinessError } 10100001 - Application group operation repeated. + */ + function unregisterAppGroupCallBack(callback: AsyncCallback): void; + function unregisterAppGroupCallBack(): Promise; + + /** + * Queries device event states data within a specified period identified by the start and end time. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @permission ohos.permission.BUNDLE_ACTIVE_INFO + * @systemapi Hide this for inner system use. + * @param begin Indicates the start time of the query period, in milliseconds. + * @param end Indicates the end time of the query period, in milliseconds. + * @throws { BusinessError } 201 - Parameter error. + * @throws { BusinessError } 401 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 10000001 - Memory operation failed. + * @throws { BusinessError } 10000002 - Parcel operation failed. + * @throws { BusinessError } 10000003 - System service operation failed. + * @throws { BusinessError } 10000004 - IPC Communication failed. + * @throws { BusinessError } 10000006 - Get application info failed. + * @throws { BusinessError } 10000007 - Get system or actual time failed. + * @returns Returns the {@link DeviceEventStats} object Array containing the event states data. + */ + function queryDeviceEventStats(begin: number, end: number, callback: AsyncCallback>): void; + function queryDeviceEventStats(begin: number, end: number): Promise>; + + /** + * Queries app notification number within a specified period identified by the start and end time. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.UsageStatistics.App + * @permission ohos.permission.BUNDLE_ACTIVE_INFO + * @systemapi Hide this for inner system use. + * @param begin Indicates the start time of the query period, in milliseconds. + * @param end Indicates the end time of the query period, in milliseconds. + * @throws { BusinessError } 201 - Parameter error. + * @throws { BusinessError } 401 - Permission denied. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 10000001 - Memory operation failed. + * @throws { BusinessError } 10000002 - Parcel operation failed. + * @throws { BusinessError } 10000003 - System service operation failed. + * @throws { BusinessError } 10000004 - IPC Communication failed. + * @throws { BusinessError } 10000006 - Get application info failed. + * @throws { BusinessError } 10000007 - Get system or actual time failed. + * @returns Returns the {@link NotificationEventStats} object Array containing the event states data. + */ + function queryNotificationEventStats(begin: number, end: number, callback: AsyncCallback>): void; + function queryNotificationEventStats(begin: number, end: number): Promise>; +} + +export default usageStatistics; \ No newline at end of file diff --git a/api/@ohos.workScheduler.d.ts b/api/@ohos.resourceschedule.workScheduler.d.ts similarity index 74% rename from api/@ohos.workScheduler.d.ts rename to api/@ohos.resourceschedule.workScheduler.d.ts index 67606bcf855368da4f795d6e192a9c62e91396a7..1cb2eabc86d4aeb43e21a72bd3115550f9aa6fd4 100644 --- a/api/@ohos.workScheduler.d.ts +++ b/api/@ohos.resourceschedule.workScheduler.d.ts @@ -1,277 +1,304 @@ -/* - * 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'; - -/** - * Work scheduler interface. - * - * @since 9 - * @syscap SystemCapability.ResourceSchedule.WorkScheduler - * @StageModelOnly - */ -declare namespace workScheduler { - /** - * The info of work. - * - * @name WorkInfo - * @since 9 - * @syscap SystemCapability.ResourceSchedule.WorkScheduler - * @StageModelOnly - */ - export interface WorkInfo { - /** - * The id of the current work. - */ - workId: number; - /** - * The bundle name of the current work. - */ - bundleName: string; - /** - * The ability name of the current work. - */ - abilityName: string; - /** - * Whether the current work will be saved. - */ - isPersisted?: boolean; - /** - * The network type of the current work. - */ - networkType?: NetworkType; - /** - * Whether a charging state has been set for triggering the work. - */ - isCharging?: boolean; - /** - * The charger type based on which the work is triggered. - */ - chargerType?: ChargingType; - /** - * The battery level for triggering a work. - */ - batteryLevel?: number; - /** - * The battery status for triggering a work. - */ - batteryStatus?: BatteryStatus; - /** - * Whether a storage state has been set for triggering the work. - */ - storageRequest?: StorageRequest; - /** - * The interval at which the work is repeated. - */ - repeatCycleTime?: number; - /** - * Whether the work has been set to repeat at the specified interval. - */ - isRepeat?: boolean; - /** - * The repeat of the current work. - */ - repeatCount?: number; - /** - * Whether the device deep idle state has been set for triggering the work. - */ - isDeepIdle?: boolean; - /** - * The idle wait time based on which the work is triggered. - */ - idleWaitTime?: number; - /** - * The parameters of the work. The value is only supported basic type(Number, String, Boolean). - */ - parameters?: {[key: string]: any}; - } - - /** - * Add a work to the queue. A work can be executed only when it meets the preset triggering condition - * and complies with the rules of work scheduler manager. - * - * @since 9 - * @syscap SystemCapability.ResourceSchedule.WorkScheduler - * @StageModelOnly - * @param work The info of work. - * @return true if success, otherwise false. - */ - function startWork(work: WorkInfo): boolean; - - /** - * Stop a work. - * - * @since 9 - * @syscap SystemCapability.ResourceSchedule.WorkScheduler - * @StageModelOnly - * @param work The info of work. - * @param needCancel True if need to be canceled after being stopped, otherwise false. - * @return true if success, otherwise false. - */ - function stopWork(work: WorkInfo, needCancel?: boolean): boolean; - - /** - * Obtains the work info of the wordId. - * - * @since 9 - * @syscap SystemCapability.ResourceSchedule.WorkScheduler - * @StageModelOnly - * @param workId The id of work. - */ - function getWorkStatus(workId: number, callback: AsyncCallback): void; - function getWorkStatus(workId: number): Promise; - - /** - * Get all works of the calling application. - * - * @since 9 - * @syscap SystemCapability.ResourceSchedule.WorkScheduler - * @StageModelOnly - * @return the work info list. - */ - function obtainAllWorks(callback: AsyncCallback): Array; - function obtainAllWorks(): Promise>; - - /** - * Stop all and clear all works of the calling application. - * - * @since 9 - * @syscap SystemCapability.ResourceSchedule.WorkScheduler - * @StageModelOnly - * @return true if success, otherwise false. - */ - function stopAndClearWorks(): boolean; - - /** - * Check whether last work running is timeout. The interface is for repeating work. - * - * @since 9 - * @syscap SystemCapability.ResourceSchedule.WorkScheduler - * @StageModelOnly - * @param workId The id of work. - * @return true if last work running is timeout, otherwise false. - */ - function isLastWorkTimeOut(workId: number, callback: AsyncCallback): boolean; - function isLastWorkTimeOut(workId: number): Promise; - - /** - * Describes network type. - * - * @name NetworkType - * @since 9 - * @syscap SystemCapability.ResourceSchedule.WorkScheduler - * @StageModelOnly - */ - export enum NetworkType { - /** - * Describes any network connection. - */ - NETWORK_TYPE_ANY = 0, - /** - * Describes a mobile network connection. - */ - NETWORK_TYPE_MOBILE, - /** - * Describes a wifi network connection. - */ - NETWORK_TYPE_WIFI, - /** - * Describes a bluetooth network connection. - */ - NETWORK_TYPE_BLUETOOTH, - /** - * Describes a wifi p2p network connection. - */ - NETWORK_TYPE_WIFI_P2P, - /** - * Describes a wifi wire network connection. - */ - NETWORK_TYPE_ETHERNET - } - - /** - * Describes charging type. - * - * @name ChargingType - * @since 9 - * @syscap SystemCapability.ResourceSchedule.WorkScheduler - * @StageModelOnly - */ - export enum ChargingType { - /** - * Describes any charger is connected. - */ - CHARGING_PLUGGED_ANY = 0, - /** - * Describes ac charger is connected. - */ - CHARGING_PLUGGED_AC, - /** - * Describes usb charger is connected. - */ - CHARGING_PLUGGED_USB, - /** - * Describes wireless charger is connected. - */ - CHARGING_PLUGGED_WIRELESS - } - - /** - * Describes the battery status. - * - * @name BatteryStatus - * @since 9 - * @syscap SystemCapability.ResourceSchedule.WorkScheduler - * @StageModelOnly - */ - export enum BatteryStatus { - /** - * Describes battery status is to low. - */ - BATTERY_STATUS_LOW = 0, - /** - * Describes battery status is to ok. - */ - BATTERY_STATUS_OKAY, - /** - * Describes battery status is to low or ok. - */ - BATTERY_STATUS_LOW_OR_OKAY - } - - /** - * Describes the storage request. - * - * @name StorageRequest - * @since 9 - * @syscap SystemCapability.ResourceSchedule.WorkScheduler - * @StageModelOnly - */ - export enum StorageRequest { - /** - * Describes storage is to low. - */ - STORAGE_LEVEL_LOW = 0, - /** - * Describes storage is to ok. - */ - STORAGE_LEVEL_OKAY, - /** - * Describes storage is to low or ok. - */ - STORAGE_LEVEL_LOW_OR_OKAY - } -} +/* + * 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'; + +/** + * Work scheduler interface. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.WorkScheduler + * @StageModelOnly + */ +declare namespace workScheduler { + /** + * The info of work. + * + * @name WorkInfo + * @since 9 + * @syscap SystemCapability.ResourceSchedule.WorkScheduler + * @StageModelOnly + */ + export interface WorkInfo { + /** + * The id of the current work. + */ + workId: number; + /** + * The bundle name of the current work. + */ + bundleName: string; + /** + * The ability name of the current work. + */ + abilityName: string; + /** + * Whether the current work will be saved. + */ + isPersisted?: boolean; + /** + * The network type of the current work. + */ + networkType?: NetworkType; + /** + * Whether a charging state has been set for triggering the work. + */ + isCharging?: boolean; + /** + * The charger type based on which the work is triggered. + */ + chargerType?: ChargingType; + /** + * The battery level for triggering a work. + */ + batteryLevel?: number; + /** + * The battery status for triggering a work. + */ + batteryStatus?: BatteryStatus; + /** + * Whether a storage state has been set for triggering the work. + */ + storageRequest?: StorageRequest; + /** + * The interval at which the work is repeated. + */ + repeatCycleTime?: number; + /** + * Whether the work has been set to repeat at the specified interval. + */ + isRepeat?: boolean; + /** + * The repeat of the current work. + */ + repeatCount?: number; + /** + * Whether the device deep idle state has been set for triggering the work. + */ + isDeepIdle?: boolean; + /** + * The idle wait time based on which the work is triggered. + */ + idleWaitTime?: number; + /** + * The parameters of the work. The value is only supported basic type(Number, String, Boolean). + */ + parameters?: {[key: string]: any}; + } + + /** + * Add a work to the queue. A work can be executed only when it meets the preset triggering condition + * and complies with the rules of work scheduler manager. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.WorkScheduler + * @StageModelOnly + * @param work The info of work. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 9700001 - Memory operation failed. + * @throws { BusinessError } 9700002 - Parcel operation failed. + * @throws { BusinessError } 9700003 - System service operation failed. + * @throws { BusinessError } 9700004 - Check workInfo failed. + * @throws { BusinessError } 9700005 - StartWork failed. + */ + function startWork(work: WorkInfo): void; + + /** + * Stop a work. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.WorkScheduler + * @StageModelOnly + * @param work The info of work. + * @param needCancel True if need to be canceled after being stopped, otherwise false. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 9700001 - Memory operation failed. + * @throws { BusinessError } 9700002 - Parcel operation failed. + * @throws { BusinessError } 9700003 - System service operation failed. + * @throws { BusinessError } 9700004 - Check workInfo failed. + */ + function stopWork(work: WorkInfo, needCancel?: boolean): void; + + /** + * Obtains the work info of the wordId. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.WorkScheduler + * @StageModelOnly + * @param workId The id of work. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 9700001 - Memory operation failed. + * @throws { BusinessError } 9700002 - Parcel operation failed. + * @throws { BusinessError } 9700003 - System service operation failed. + * @throws { BusinessError } 9700004 - Check workInfo failed. + */ + function getWorkStatus(workId: number, callback: AsyncCallback): void; + function getWorkStatus(workId: number): Promise; + + /** + * Get all works of the calling application. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.WorkScheduler + * @StageModelOnly + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 9700001 - Memory operation failed. + * @throws { BusinessError } 9700002 - Parcel operation failed. + * @throws { BusinessError } 9700003 - System service operation failed. + * @returns the work info list. + */ + function obtainAllWorks(callback: AsyncCallback): Array; + function obtainAllWorks(): Promise>; + + /** + * Stop all and clear all works of the calling application. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.WorkScheduler + * @StageModelOnly + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 9700001 - Memory operation failed. + * @throws { BusinessError } 9700002 - Parcel operation failed. + * @throws { BusinessError } 9700003 - System service operation failed. + * @throws { BusinessError } 9700004 - Check workInfo failed. + */ + function stopAndClearWorks(): void; + + /** + * Check whether last work running is timeout. The interface is for repeating work. + * + * @since 9 + * @syscap SystemCapability.ResourceSchedule.WorkScheduler + * @StageModelOnly + * @param workId The id of work. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 9700001 - Memory operation failed. + * @throws { BusinessError } 9700002 - Parcel operation failed. + * @throws { BusinessError } 9700003 - System service operation failed. + * @throws { BusinessError } 9700004 - Check workInfo failed. + * @returns true if last work running is timeout, otherwise false. + */ + function isLastWorkTimeOut(workId: number, callback: AsyncCallback): boolean; + function isLastWorkTimeOut(workId: number): Promise; + + /** + * Describes network type. + * + * @name NetworkType + * @since 9 + * @syscap SystemCapability.ResourceSchedule.WorkScheduler + * @StageModelOnly + */ + export enum NetworkType { + /** + * Describes any network connection. + */ + NETWORK_TYPE_ANY = 0, + /** + * Describes a mobile network connection. + */ + NETWORK_TYPE_MOBILE, + /** + * Describes a wifi network connection. + */ + NETWORK_TYPE_WIFI, + /** + * Describes a bluetooth network connection. + */ + NETWORK_TYPE_BLUETOOTH, + /** + * Describes a wifi p2p network connection. + */ + NETWORK_TYPE_WIFI_P2P, + /** + * Describes a wifi wire network connection. + */ + NETWORK_TYPE_ETHERNET + } + + /** + * Describes charging type. + * + * @name ChargingType + * @since 9 + * @syscap SystemCapability.ResourceSchedule.WorkScheduler + * @StageModelOnly + */ + export enum ChargingType { + /** + * Describes any charger is connected. + */ + CHARGING_PLUGGED_ANY = 0, + /** + * Describes ac charger is connected. + */ + CHARGING_PLUGGED_AC, + /** + * Describes usb charger is connected. + */ + CHARGING_PLUGGED_USB, + /** + * Describes wireless charger is connected. + */ + CHARGING_PLUGGED_WIRELESS + } + + /** + * Describes the battery status. + * + * @name BatteryStatus + * @since 9 + * @syscap SystemCapability.ResourceSchedule.WorkScheduler + * @StageModelOnly + */ + export enum BatteryStatus { + /** + * Describes battery status is to low. + */ + BATTERY_STATUS_LOW = 0, + /** + * Describes battery status is to ok. + */ + BATTERY_STATUS_OKAY, + /** + * Describes battery status is to low or ok. + */ + BATTERY_STATUS_LOW_OR_OKAY + } + + /** + * Describes the storage request. + * + * @name StorageRequest + * @since 9 + * @syscap SystemCapability.ResourceSchedule.WorkScheduler + * @StageModelOnly + */ + export enum StorageRequest { + /** + * Describes storage is to low. + */ + STORAGE_LEVEL_LOW = 0, + /** + * Describes storage is to ok. + */ + STORAGE_LEVEL_OKAY, + /** + * Describes storage is to low or ok. + */ + STORAGE_LEVEL_LOW_OR_OKAY + } +} export default workScheduler; \ No newline at end of file diff --git a/api/@ohos.rpc.d.ts b/api/@ohos.rpc.d.ts index c966c3c43dcb5ab389c85b38082760d2379f1a21..2f87c580274f23a56817f7bb26f004cae9bccbfb 100644 --- a/api/@ohos.rpc.d.ts +++ b/api/@ohos.rpc.d.ts @@ -66,7 +66,7 @@ declare namespace rpc { } /** - * A data object used for reomote procedure call (RPC). + * A data object used for remote procedure call (RPC). *

          * During RPC, the sender can use the write methods provided by {@link MessageParcel} to * write the to-be-sent data into a {@link MessageParcel} object in a specific format, and the receiver can use the @@ -85,33 +85,32 @@ declare namespace rpc { * @deprecated since 9 * @useinstead ohos.rpc.MessageSequence * @syscap SystemCapability.Communication.IPC.Core - * @import import rpc from '@ohos.rpc' */ class MessageParcel { /** * Creates an empty {@link MessageParcel} object. - * @return Returns the object created. + * @returns Return the object created. * @since 7 */ static create(): MessageParcel; /** - * Reclaims the {@link MessageParcel} object. + * Reclaim the {@link MessageParcel} object. * @since 7 */ reclaim(): void; /** - * Serializes a remote object and writes it to the {@link MessageParcel} object. + * Serialize a remote object and writes it to the {@link MessageParcel} object. * @param object Remote object to serialize. - * @return Returns true if it is successful; returns false otherwise. + * @returns Return true if it is successful; return false otherwise. * @since 7 */ writeRemoteObject(object: IRemoteObject): boolean; /** * Reads a remote object from {@link MessageParcel} object. - * @return Returns the remote object. + * @returns Return the remote object. * @since 7 */ readRemoteObject(): IRemoteObject; @@ -119,29 +118,29 @@ declare namespace rpc { /** * Writes an interface token into the {@link MessageParcel} object. * @param token Interface descriptor to write. - * @return Returns {@code true} if the interface token has been written into the {@link MessageParcel}; - * returns {@code false} otherwise. + * @returns Return {@code true} if the interface token has been written into the {@link MessageParcel}; + * return {@code false} otherwise. * @since 7 */ writeInterfaceToken(token: string): boolean; /** * Reads an interface token from the {@link MessageParcel} object. - * @return Returns a string value. + * @returns Return a string value. * @since 7 */ readInterfaceToken(): string; /** * Obtains the size of data (in bytes) contained in the {@link MessageParcel} object. - * @return Returns the size of data contained in the {@link MessageParcel} object. + * @returns Return the size of data contained in the {@link MessageParcel} object. * @since 7 */ getSize(): number; /** * Obtains the storage capacity (in bytes) of the {@link MessageParcel} object. - * @return Returns the storage capacity of the {@link MessageParcel} object. + * @returns Return the storage capacity of the {@link MessageParcel} object. * @since 7 */ getCapacity(): number; @@ -152,7 +151,7 @@ declare namespace rpc { * than the storage capacity of the {@link MessageParcel}. * * @param size Indicates the data size of the {@link MessageParcel} object. - * @return Returns {@code true} if the setting is successful; returns {@code false} otherwise. + * @returns Return {@code true} if the setting is successful; return {@code false} otherwise. * @since 7 */ setSize(size: number): boolean; @@ -163,7 +162,7 @@ declare namespace rpc { * the size of data contained in the {@link MessageParcel}. * * @param size Indicates the storage capacity of the {@link MessageParcel} object. - * @return Returns {@code true} if the setting is successful; returns {@code false} otherwise. + * @returns Return {@code true} if the setting is successful; return {@code false} otherwise. * @since 7 */ setCapacity(size: number): boolean; @@ -172,7 +171,7 @@ declare namespace rpc { * Obtains the writable data space (in bytes) in the {@link MessageParcel} object. *

          Writable data space = Storage capacity of the {@link MessageParcel} – Size of data contained in the {@link MessageParcel}. * - * @return Returns the writable data space of the {@link MessageParcel} object. + * @returns Return the writable data space of the {@link MessageParcel} object. * @since 7 */ getWritableBytes(): number; @@ -181,21 +180,21 @@ declare namespace rpc { * Obtains the readable data space (in bytes) in the {@link MessageParcel} object. *

          Readable data space = Size of data contained in the {@link MessageParcel} – Size of data that has been read. * - * @return Returns the readable data space of the {@link MessageParcel} object. + * @returns Return the readable data space of the {@link MessageParcel} object. * @since 7 */ getReadableBytes(): number; /** * Obtains the current read position in the {@link MessageParcel} object. - * @return Returns the current read position in the {@link MessageParcel} object. + * @returns Return the current read position in the {@link MessageParcel} object. * @since 7 */ getReadPosition(): number; /** * Obtains the current write position in the {@link MessageParcel} object. - * @return Returns the current write position in the {@link MessageParcel} object. + * @returns Return the current write position in the {@link MessageParcel} object. * @since 7 */ getWritePosition(): number; @@ -206,7 +205,7 @@ declare namespace rpc { * change it, change it to an accurate position. Otherwise, the read data may be incorrect. * * @param pos Indicates the target position to start data reading. - * @return Returns {@code true} if the read position is changed; returns {@code false} otherwise. + * @returns Return {@code true} if the read position is changed; return {@code false} otherwise. * @since 7 */ rewindRead(pos: number): boolean; @@ -217,7 +216,7 @@ declare namespace rpc { * change it, change it to an accurate position. Otherwise, the data to be read may be incorrect. * * @param pos Indicates the target position to start data writing. - * @return Returns {@code true} if the write position is changed; returns {@code false} otherwise. + * @returns Return {@code true} if the write position is changed; return {@code false} otherwise. * @since 7 */ rewindWrite(pos: number): boolean; @@ -242,8 +241,8 @@ declare namespace rpc { /** * Writes a byte value into the {@link MessageParcel} object. * @param val Indicates the byte value to write. - * @return Returns {@code true} if the value has been written into the {@link MessageParcel}; - * returns {@code false} otherwise. + * @returns Return {@code true} if the value has been written into the {@link MessageParcel}; + * return {@code false} otherwise. * @throws ParcelException When capacity in this parcel is insufficient, * exception message: {@link ParcelException#NO_CAPACITY_ERROR}. * @since 7 @@ -253,8 +252,8 @@ declare namespace rpc { /** * Writes a short integer value into the {@link MessageParcel} object. * @param val Indicates the short integer value to write. - * @return Returns {@code true} if the value has been written into the {@link MessageParcel}; - * returns {@code false} otherwise. + * @returns Return {@code true} if the value has been written into the {@link MessageParcel}; + * return {@code false} otherwise. * @throws ParcelException When capacity in this parcel is insufficient, * exception message: {@link ParcelException#NO_CAPACITY_ERROR}. * @since 7 @@ -264,8 +263,8 @@ declare namespace rpc { /** * Writes an integer value into the {@link MessageParcel} object. * @param val Indicates the integer value to write. - * @return Returns {@code true} if the value has been written into the {@link MessageParcel}; - * returns {@code false} otherwise. + * @returns Return {@code true} if the value has been written into the {@link MessageParcel}; + * return {@code false} otherwise. * @throws ParcelException When capacity in this parcel is insufficient, * exception message: {@link ParcelException#NO_CAPACITY_ERROR}. * @since 7 @@ -275,8 +274,8 @@ declare namespace rpc { /** * Writes a long integer value into the {@link MessageParcel} object. * @param val Indicates the long integer value to write. - * @return Returns {@code true} if the value has been written into the {@link MessageParcel}; - * returns {@code false} otherwise. + * @returns Return {@code true} if the value has been written into the {@link MessageParcel}; + * return {@code false} otherwise. * @throws ParcelException When capacity in this parcel is insufficient, * exception message: {@link ParcelException#NO_CAPACITY_ERROR}. * @since 7 @@ -286,8 +285,8 @@ declare namespace rpc { /** * Writes a floating point value into the {@link MessageParcel} object. * @param val Indicates the floating point value to write. - * @return Returns {@code true} if the value has been written into the {@link MessageParcel}; - * returns {@code false} otherwise. + * @returns Return {@code true} if the value has been written into the {@link MessageParcel}; + * return {@code false} otherwise. * @throws ParcelException When capacity in this parcel is insufficient, * exception message: {@link ParcelException#NO_CAPACITY_ERROR}. * @since 7 @@ -297,8 +296,8 @@ declare namespace rpc { /** * Writes a double-precision floating point value into the {@link MessageParcel} object. * @param val Indicates the double-precision floating point value to write. - * @return Returns {@code true} if the value has been written into the {@link MessageParcel}; - * returns {@code false} otherwise. + * @returns Return {@code true} if the value has been written into the {@link MessageParcel}; + * return {@code false} otherwise. * @throws ParcelException When capacity in this parcel is insufficient, * exception message: {@link ParcelException#NO_CAPACITY_ERROR}. * @since 7 @@ -308,8 +307,8 @@ declare namespace rpc { /** * Writes a boolean value into the {@link MessageParcel} object. * @param val Indicates the boolean value to write. - * @return Returns {@code true} if the value has been written into the {@link MessageParcel}; - * returns {@code false} otherwise. + * @returns Return {@code true} if the value has been written into the {@link MessageParcel}; + * return {@code false} otherwise. * @throws ParcelException When capacity in this parcel is insufficient, * exception message: {@link ParcelException#NO_CAPACITY_ERROR}. * @since 7 @@ -319,8 +318,8 @@ declare namespace rpc { /** * Writes a single character value into the {@link MessageParcel} object. * @param val Indicates the single character value to write. - * @return Returns {@code true} if the value has been written into the {@link MessageParcel}; - * returns {@code false} otherwise. + * @returns Return {@code true} if the value has been written into the {@link MessageParcel}; + * return {@code false} otherwise. * @throws ParcelException When capacity in this parcel is insufficient, * exception message: {@link ParcelException#NO_CAPACITY_ERROR}. * @since 7 @@ -330,8 +329,8 @@ declare namespace rpc { /** * Writes a string value into the {@link MessageParcel} object. * @param val Indicates the string value to write. - * @return Returns {@code true} if the value has been written into the {@link MessageParcel}; - * returns {@code false} otherwise. + * @returns Return {@code true} if the value has been written into the {@link MessageParcel}; + * return {@code false} otherwise. * @throws ParcelException When capacity in this parcel is insufficient, * exception message: {@link ParcelException#NO_CAPACITY_ERROR}. * @since 7 @@ -350,8 +349,8 @@ declare namespace rpc { /** * Writes a byte array into the {@link MessageParcel} object. * @param byteArray Indicates the byte array to write. - * @return Returns {@code true} if the array has been written into the {@link MessageParcel}; - * returns {@code false} otherwise. + * @returns Return {@code true} if the array has been written into the {@link MessageParcel}; + * return {@code false} otherwise. * @throws ParcelException When capacity in this parcel is insufficient, * exception message: {@link ParcelException#NO_CAPACITY_ERROR}. * @since 7 @@ -360,104 +359,104 @@ declare namespace rpc { /** * Writes a short integer array into the {@link MessageParcel} object. + * Ensure that the data type and size comply with the interface definition. + * Otherwise,data may be truncated. * @param shortArray Indicates the short integer array to write. - * @return Returns {@code true} if the array has been written into the {@link MessageParcel}; - * returns {@code false} otherwise. + * @returns Return {@code true} if the array has been written into the {@link MessageParcel}; + * return {@code false} otherwise. * @throws ParcelException When capacity in this parcel is insufficient, * exception message: {@link ParcelException#NO_CAPACITY_ERROR}. - * @Note Ensure that the data type and size comply with the interface definition. - * Otherwise,data may be truncated. * @since 7 */ writeShortArray(shortArray: number[]): boolean; /** * Writes an integer array into the {@link MessageParcel} object. + * Ensure that the data type and size comply with the interface definition. + * Otherwise,data may be truncated. * @param intArray Indicates the integer array to write. - * @return Returns {@code true} if the array has been written into the {@link MessageParcel}; - * returns {@code false} otherwise. + * @returns Return {@code true} if the array has been written into the {@link MessageParcel}; + * return {@code false} otherwise. * @throws ParcelException When capacity in this parcel is insufficient, * exception message: {@link ParcelException#NO_CAPACITY_ERROR}. - * @Note Ensure that the data type and size comply with the interface definition. - * Otherwise,data may be truncated. * @since 7 */ writeIntArray(intArray: number[]): boolean; /** * Writes a long integer array into the {@link MessageParcel} object. + * Ensure that the data type and size comply with the interface definition. + * Otherwise,data may be truncated. * @param longArray Indicates the long integer array to write. - * @return Returns {@code true} if the array has been written into the {@link MessageParcel}; - * returns {@code false} otherwise. + * @returns Return {@code true} if the array has been written into the {@link MessageParcel}; + * return {@code false} otherwise. * @throws ParcelException When capacity in this parcel is insufficient, * exception message: {@link ParcelException#NO_CAPACITY_ERROR}. - * @Note Ensure that the data type and size comply with the interface definition. - * Otherwise,data may be truncated. * @since 7 */ writeLongArray(longArray: number[]): boolean; /** * Writes a floating point array into the {@link MessageParcel} object. + * Ensure that the data type and size comply with the interface definition. + * Otherwise,data may be truncated. * @param floatArray Indicates the floating point array to write. - * @return Returns {@code true} if the array has been written into the {@link MessageParcel}; - * returns {@code false} otherwise. + * @returns Return {@code true} if the array has been written into the {@link MessageParcel}; + * return {@code false} otherwise. * @throws ParcelException When capacity in this parcel is insufficient, * exception message: {@link ParcelException#NO_CAPACITY_ERROR}. - * @Note Ensure that the data type and size comply with the interface definition. - * Otherwise,data may be truncated. * @since 7 */ writeFloatArray(floatArray: number[]): boolean; /** * Writes a double-precision floating point array into the {@link MessageParcel} object. + * Ensure that the data type and size comply with the interface definition. + * Otherwise,data may be truncated. * @param doubleArray Indicates the double-precision floating point array to write. - * @return Returns {@code true} if the array has been written into the {@link MessageParcel}; - * returns {@code false} otherwise. + * @returns Return {@code true} if the array has been written into the {@link MessageParcel}; + * return {@code false} otherwise. * @throws ParcelException When capacity in this parcel is insufficient, * exception message: {@link ParcelException#NO_CAPACITY_ERROR}. - * @Note Ensure that the data type and size comply with the interface definition. - * Otherwise,data may be truncated. * @since 7 */ writeDoubleArray(doubleArray: number[]): boolean; /** * Writes a boolean array into the {@link MessageParcel} object. + * Ensure that the data type and size comply with the interface definition. + * Otherwise,data may be truncated. * @param booleanArray Indicates the boolean array to write. - * @return Returns {@code true} if the array has been written into the {@link MessageParcel}; - * returns {@code false} otherwise. + * @returns Return {@code true} if the array has been written into the {@link MessageParcel}; + * return {@code false} otherwise. * @throws ParcelException When capacity in this parcel is insufficient, * exception message: {@link ParcelException#NO_CAPACITY_ERROR}. - * @Note Ensure that the data type and size comply with the interface definition. - * Otherwise,data may be truncated. * @since 7 */ writeBooleanArray(booleanArray: boolean[]): boolean; /** * Writes a single character array into the {@link MessageParcel} object. + * Ensure that the data type and size comply with the interface definition. + * Otherwise,data may be truncated. * @param charArray Indicates the single character array to write. - * @return Returns {@code true} if the array has been written into the {@link MessageParcel}; - * returns {@code false} otherwise. + * @returns Return {@code true} if the array has been written into the {@link MessageParcel}; + * return {@code false} otherwise. * @throws ParcelException When capacity in this parcel is insufficient, * exception message: {@link ParcelException#NO_CAPACITY_ERROR}. - * @Note Ensure that the data type and size comply with the interface definition. - * Otherwise,data may be truncated. * @since 7 */ writeCharArray(charArray: number[]): boolean; /** * Writes a string array into the {@link MessageParcel} object. + * Ensure that the data type and size comply with the interface definition. + * Otherwise,data may be truncated. * @param stringArray Indicates the string array to write. - * @return Returns {@code true} if the array has been written into the {@link MessageParcel}; - * returns {@code false} otherwise. + * @returns Return {@code true} if the array has been written into the {@link MessageParcel}; + * return {@code false} otherwise. * @throws ParcelException When capacity in this parcel is insufficient, * exception message: {@link ParcelException#NO_CAPACITY_ERROR}. - * @Note Ensure that the data type and size comply with the interface definition. - * Otherwise,data may be truncated. * @since 7 */ writeStringArray(stringArray: string[]): boolean; @@ -465,8 +464,8 @@ declare namespace rpc { /** * Writes a {@link Sequenceable} object array into the {@link MessageParcel} object. * @param sequenceableArray Indicates the {@link Sequenceable} object array to write. - * @return Returns {@code true} if the array has been written into the {@link MessageParcel}; - * returns {@code false} otherwise. + * @returns Return {@code true} if the array has been written into the {@link MessageParcel}; + * return {@code false} otherwise. * @throws ParcelException When capacity in this parcel is insufficient, * exception message: {@link ParcelException#NO_CAPACITY_ERROR}. * @since 7 @@ -476,71 +475,71 @@ declare namespace rpc { /** * Writes an array of {@link IRemoteObject} objects to this {@link MessageParcel} object. * @param objectArray Array of {@link IRemoteObject} objects to write. - * @return Returns {@code true} if the {@link IRemoteObject} array is successfully written to the {@link MessageParcel}; - * returns false if the {@link IRemoteObject} array is null or fails to be written to the {@lini MessageParcel}. + * @returns Return {@code true} if the {@link IRemoteObject} array is successfully written to the {@link MessageParcel}; + * return false if the {@link IRemoteObject} array is null or fails to be written to the {@link MessageParcel}. * @since 8 */ writeRemoteObjectArray(objectArray: IRemoteObject[]): boolean; /** * Reads a byte value from the {@link MessageParcel} object. - * @return Returns a byte value. + * @returns Return a byte value. * @since 7 */ readByte(): number; /** * Reads a short integer value from the {@link MessageParcel} object. - * @return Returns a short integer value. + * @returns Return a short integer value. * @since 7 */ readShort(): number; /** * Reads an integer value from the {@link MessageParcel} object. - * @return Returns an integer value. + * @returns Return an integer value. * @since 7 */ readInt(): number; /** * Reads a long integer value from the {@link MessageParcel} object. - * @return Returns a long integer value. + * @returns Return a long integer value. * @since 7 */ readLong(): number; /** * Reads a floating point value from the {@link MessageParcel} object. - * @return Returns a floating point value. + * @returns Return a floating point value. * @since 7 */ readFloat(): number; /** * Reads a double-precision floating point value from the {@link MessageParcel} object. - * @return Returns a double-precision floating point value. + * @returns Return a double-precision floating point value. * @since 7 */ readDouble(): number; /** * Reads a boolean value from the {@link MessageParcel} object. - * @return Returns a boolean value. + * @returns Return a boolean value. * @since 7 */ readBoolean(): boolean; /** * Reads a single character value from the {@link MessageParcel} object. - * @return Returns a single character value. + * @returns Return a single character value. * @since 7 */ readChar(): number; /** * Reads a string value from the {@link MessageParcel} object. - * @return Returns a string value. + * @returns Return a string value. * @since 7 */ readString(): string; @@ -549,7 +548,7 @@ declare namespace rpc { * Reads a {@link Sequenceable} object from the {@link MessageParcel} instance. * @param dataIn Indicates the {@link Sequenceable} object that needs to perform the {@code unmarshalling} operation * using the {@link MessageParcel}. - * @return Returns {@code true} if the unmarshalling is successful; returns {@code false} otherwise. + * @returns Return {@code true} if the unmarshalling is successful; return {@code false} otherwise. * @since 7 */ readSequenceable(dataIn: Sequenceable) : boolean; @@ -557,8 +556,8 @@ declare namespace rpc { /** * Writes a byte array into the {@link MessageParcel} object. * @param dataIn Indicates the byte array read from MessageParcel. - * @return Returns {@code true} if the array has been written into the {@link MessageParcel}; - * returns {@code false} otherwise. + * @returns Return {@code true} if the array has been written into the {@link MessageParcel}; + * return {@code false} otherwise. * @throws ParcelException When capacity in this MessageParcel is insufficient, * exception message: {@link *MessageParcelException#NO_CAPACITY_ERROR}. * @since 7 @@ -567,7 +566,7 @@ declare namespace rpc { /** * Reads a byte array from the {@link MessageParcel} object. - * @return Returns a byte array. + * @returns Return a byte array. * @since 7 */ readByteArray(): number[]; @@ -581,7 +580,7 @@ declare namespace rpc { /** * Reads a short integer array from the {@link MessageParcel} object. - * @return Returns a short integer array. + * @returns Return a short integer array. * @since 7 */ readShortArray(): number[]; @@ -596,7 +595,7 @@ declare namespace rpc { /** * Reads an integer array from the {@link MessageParcel} object. - * @return Returns an integer array. + * @returns Return an integer array. * @since 7 */ readIntArray(): number[]; @@ -611,7 +610,7 @@ declare namespace rpc { /** * Reads a long integer array from the {@link MessageParcel} object. - * @return Returns a long integer array. + * @returns Return a long integer array. * @since 7 */ readLongArray(): number[]; @@ -626,7 +625,7 @@ declare namespace rpc { /** * Reads a floating point array from the {@link MessageParcel} object. - * @return Returns a floating point array. + * @returns Return a floating point array. * @since 7 */ readFloatArray(): number[]; @@ -641,7 +640,7 @@ declare namespace rpc { /** * Reads a double-precision floating point array from the {@link MessageParcel} object. - * @return Returns a double-precision floating point array. + * @returns Return a double-precision floating point array. * @since 7 */ readDoubleArray(): number[]; @@ -656,7 +655,7 @@ declare namespace rpc { /** * Reads a boolean array from the {@link MessageParcel} object. - * @return Returns a boolean array. + * @returns Return a boolean array. * @since 7 */ readBooleanArray(): boolean[]; @@ -671,7 +670,7 @@ declare namespace rpc { /** * Reads a single character array from the {@link MessageParcel} object. - * @return Returns a single character array. + * @returns Return a single character array. * @since 7 */ readCharArray(): number[]; @@ -686,7 +685,7 @@ declare namespace rpc { /** * Reads a string array from the {@link MessageParcel} object. - * @return Returns a string array. + * @returns Return a string array. * @since 7 */ readStringArray(): string[]; @@ -707,7 +706,7 @@ declare namespace rpc { /** * Reads {@link IRemoteObject} objects from this {@link MessageParcel} object. - * @return An array of {@link IRemoteObject} objects obtained. + * @returns An array of {@link IRemoteObject} objects obtained. * @since 8 */ readRemoteObjectArray(): IRemoteObject[]; @@ -722,15 +721,15 @@ declare namespace rpc { /** * Duplicates the specified file descriptor. * @param fd File descriptor to be duplicated. - * @return A duplicated file descriptor. + * @returns A duplicated file descriptor. * @since 8 */ static dupFileDescriptor(fd: number) :number; /** * Checks whether this {@link MessageParcel} object contains a file descriptor. - * @return Returns true if the {@link MessageParcel} object contains a file descriptor; - * returns false otherwise. + * @returns Return true if the {@link MessageParcel} object contains a file descriptor; + * return false otherwise. * @since 8 */ containFileDescriptors(): boolean; @@ -738,14 +737,14 @@ declare namespace rpc { /** * Writes a file descriptor to this {@link MessageParcel} object. * @param fd File descriptor to wrote. - * @return Returns true if the operation is successful; returns false otherwise. + * @returns Return true if the operation is successful; return false otherwise. * @since 8 */ writeFileDescriptor(fd: number): boolean; /** * Reads a file descriptor from this {@link MessageParcel} object. - * @return File descriptor obtained. + * @returns File descriptor obtained. * @since 8 */ readFileDescriptor(): number; @@ -753,21 +752,21 @@ declare namespace rpc { /** * Writes an anonymous shared memory object to this {@link MessageParcel} object. * @param ashmem Anonymous shared memory object to wrote. - * @return Returns true if the operation is successful; returns false otherwise. + * @returns Return true if the operation is successful; return false otherwise. * @since 8 */ writeAshmem(ashmem: Ashmem): boolean; /** * Reads the anonymous shared memory object from this {@link MessageParcel} object. - * @return Anonymous share object obtained. + * @returns Anonymous share object obtained. * @since 8 */ readAshmem(): Ashmem; /** * Obtains the maximum amount of raw data that can be sent in a time. - * @return 128 MB. + * @returns 128 MB. * @since 8 */ getRawDataCapacity(): number; @@ -776,7 +775,7 @@ declare namespace rpc { * Writes raw data to this {@link MessageParcel} object. * @param rawData Raw data to wrote. * @param size Size of the raw data, in bytes. - * @return Returns true if the operation is successful; returns false otherwise. + * @returns Return true if the operation is successful; return false otherwise. * @since 8 */ writeRawData(rawData: number[], size: number): boolean; @@ -784,14 +783,14 @@ declare namespace rpc { /** * Reads raw data from this {@link MessageParcel} object. * @param size Size of the raw data to read. - * @return Raw data obtained, in bytes. + * @returns Raw data obtained, in bytes. * @since 8 */ readRawData(size: number): number[]; } /** - * A data object used for reomote procedure call (RPC). + * A data object used for remote procedure call (RPC). *

          * During RPC, the sender can use the write methods provided by {@link MessageSequence} to * write the to-be-sent data into a {@link MessageSequence} object in a specific format, and the receiver can use the @@ -808,24 +807,23 @@ declare namespace rpc { * * @since 9 * @syscap SystemCapability.Communication.IPC.Core - * @import import rpc from '@ohos.rpc' */ class MessageSequence { /** * Creates an empty {@link MessageSequence} object. - * @return Returns the object created. + * @returns Return the object created. * @since 9 */ static create(): MessageSequence; /** - * Reclaims the {@link MessageSequence} object. + * Reclaim the {@link MessageSequence} object. * @since 9 */ reclaim(): void; /** - * Serializes a remote object and writes it to the {@link MessageSequence} object. + * Serialize a remote object and writes it to the {@link MessageSequence} object. * @param object Remote object to serialize. * @throws { BusinessError } 401 - check param failed * @throws { BusinessError } 1900008 - proxy or remote object is invalid @@ -836,7 +834,7 @@ declare namespace rpc { /** * Reads a remote object from {@link MessageSequence} object. - * @return Returns the remote object. + * @returns Return the remote object. * @throws { BusinessError } 1900008 - proxy or remote object is invalid * @throws { BusinessError } 1900010 - read data from message sequence failed * @since 9 @@ -854,7 +852,7 @@ declare namespace rpc { /** * Reads an interface token from the {@link MessageSequence} object. - * @return Returns a string value. + * @returns Return a string value. * @throws { BusinessError } 1900010 - read data from message sequence failed * @since 9 */ @@ -862,14 +860,14 @@ declare namespace rpc { /** * Obtains the size of data (in bytes) contained in the {@link MessageSequence} object. - * @return Returns the size of data contained in the {@link MessageSequence} object. + * @returns Return the size of data contained in the {@link MessageSequence} object. * @since 9 */ getSize(): number; /** * Obtains the storage capacity (in bytes) of the {@link MessageSequence} object. - * @return Returns the storage capacity of the {@link MessageSequence} object. + * @returns Return the storage capacity of the {@link MessageSequence} object. * @since 9 */ getCapacity(): number; @@ -901,7 +899,7 @@ declare namespace rpc { * Obtains the writable data space (in bytes) in the {@link MessageSequence} object. *

          Writable data space = Storage capacity of the {@link MessageSequence} – Size of data contained in the {@link MessageSequence}. * - * @return Returns the writable data space of the {@link MessageSequence} object. + * @returns Return the writable data space of the {@link MessageSequence} object. * @since 9 */ getWritableBytes(): number; @@ -910,21 +908,21 @@ declare namespace rpc { * Obtains the readable data space (in bytes) in the {@link MessageSequence} object. *

          Readable data space = Size of data contained in the {@link MessageSequence} – Size of data that has been read. * - * @return Returns the readable data space of the {@link MessageSequence} object. + * @returns Return the readable data space of the {@link MessageSequence} object. * @since 9 */ getReadableBytes(): number; /** * Obtains the current read position in the {@link MessageSequence} object. - * @return Returns the current read position in the {@link MessageSequence} object. + * @returns Return the current read position in the {@link MessageSequence} object. * @since 9 */ getReadPosition(): number; /** * Obtains the current write position in the {@link MessageSequence} object. - * @return Returns the current write position in the {@link MessageSequence} object. + * @returns Return the current write position in the {@link MessageSequence} object. * @since 9 */ getWritePosition(): number; @@ -1070,88 +1068,88 @@ declare namespace rpc { /** * Writes a short integer array into the {@link MessageSequence} object. + * Ensure that the data type and size comply with the interface definition. + * Otherwise,data may be truncated. * @param shortArray Indicates the short integer array to write. * @throws { BusinessError } 401 - check param failed * @throws { BusinessError } 1900009 - write data to message sequence failed - * @Note Ensure that the data type and size comply with the interface definition. - * Otherwise,data may be truncated. * @since 9 */ writeShortArray(shortArray: number[]): void; /** * Writes an integer array into the {@link MessageSequence} object. + * Ensure that the data type and size comply with the interface definition. + * Otherwise,data may be truncated. * @param intArray Indicates the integer array to write. * @throws { BusinessError } 401 - check param failed * @throws { BusinessError } 1900009 - write data to message sequence failed - * @Note Ensure that the data type and size comply with the interface definition. - * Otherwise,data may be truncated. * @since 9 */ writeIntArray(intArray: number[]): void; /** * Writes a long integer array into the {@link MessageSequence} object. + * Ensure that the data type and size comply with the interface definition. + * Otherwise,data may be truncated. * @param longArray Indicates the long integer array to write. * @throws { BusinessError } 401 - check param failed * @throws { BusinessError } 1900009 - write data to message sequence failed - * @Note Ensure that the data type and size comply with the interface definition. - * Otherwise,data may be truncated. * @since 9 */ writeLongArray(longArray: number[]): void; /** * Writes a floating point array into the {@link MessageSequence} object. + * Ensure that the data type and size comply with the interface definition. + * Otherwise,data may be truncated. * @param floatArray Indicates the floating point array to write. * @throws { BusinessError } 401 - check param failed * @throws { BusinessError } 1900009 - write data to message sequence failed - * @Note Ensure that the data type and size comply with the interface definition. - * Otherwise,data may be truncated. * @since 9 */ writeFloatArray(floatArray: number[]): void; /** * Writes a double-precision floating point array into the {@link MessageSequence} object. + * Ensure that the data type and size comply with the interface definition. + * Otherwise,data may be truncated. * @param doubleArray Indicates the double-precision floating point array to write. * @throws { BusinessError } 401 - check param failed * @throws { BusinessError } 1900009 - write data to message sequence failed - * @Note Ensure that the data type and size comply with the interface definition. - * Otherwise,data may be truncated. * @since 9 */ writeDoubleArray(doubleArray: number[]): void; /** * Writes a boolean array into the {@link MessageSequence} object. + * Ensure that the data type and size comply with the interface definition. + * Otherwise,data may be truncated. * @param booleanArray Indicates the boolean array to write. * @throws { BusinessError } 401 - check param failed * @throws { BusinessError } 1900009 - write data to message sequence failed - * @Note Ensure that the data type and size comply with the interface definition. - * Otherwise,data may be truncated. * @since 9 */ writeBooleanArray(booleanArray: boolean[]): void; /** * Writes a single character array into the {@link MessageSequence} object. + * Ensure that the data type and size comply with the interface definition. + * Otherwise,data may be truncated. * @param charArray Indicates the single character array to write. * @throws { BusinessError } 401 - check param failed * @throws { BusinessError } 1900009 - write data to message sequence failed - * @Note Ensure that the data type and size comply with the interface definition. - * Otherwise,data may be truncated. * @since 9 */ writeCharArray(charArray: number[]): void; /** * Writes a string array into the {@link MessageSequence} object. + * Ensure that the data type and size comply with the interface definition. + * Otherwise,data may be truncated. * @param stringArray Indicates the string array to write. * @throws { BusinessError } 401 - check param failed * @throws { BusinessError } 1900009 - write data to message sequence failed - * @Note Ensure that the data type and size comply with the interface definition. - * Otherwise,data may be truncated. * @since 9 */ writeStringArray(stringArray: string[]): void; @@ -1176,7 +1174,7 @@ declare namespace rpc { /** * Reads a byte value from the {@link MessageParcel} object. - * @return Returns a byte value. + * @returns Return a byte value. * @throws { BusinessError } 1900010 read data from message sequence failed * @since 9 */ @@ -1184,7 +1182,7 @@ declare namespace rpc { /** * Reads a short integer value from the {@link MessageSequence} object. - * @return Returns a short integer value. + * @returns Return a short integer value. * @throws { BusinessError } 1900010 - read data from message sequence failed * @since 9 */ @@ -1192,7 +1190,7 @@ declare namespace rpc { /** * Reads an integer value from the {@link MessageSequence} object. - * @return Returns an integer value. + * @returns Return an integer value. * @throws { BusinessError } 1900010 - read data from message sequence failed * @since 9 */ @@ -1200,7 +1198,7 @@ declare namespace rpc { /** * Reads a long integer value from the {@link MessageSequence} object. - * @return Returns a long integer value. + * @returns Return a long integer value. * @throws { BusinessError } 1900010 - read data from message sequence failed * @since 9 */ @@ -1208,7 +1206,7 @@ declare namespace rpc { /** * Reads a floating point value from the {@link MessageSequence} object. - * @return Returns a floating point value. + * @returns Return a floating point value. * @throws { BusinessError } 1900010 - read data from message sequence failed * @since 9 */ @@ -1216,7 +1214,7 @@ declare namespace rpc { /** * Reads a double-precision floating point value from the {@link MessageSequence} object. - * @return Returns a double-precision floating point value. + * @returns Return a double-precision floating point value. * @throws { BusinessError } 1900010 - read data from message sequence failed * @since 9 */ @@ -1224,7 +1222,7 @@ declare namespace rpc { /** * Reads a boolean value from the {@link MessageSequence} object. - * @return Returns a boolean value. + * @returns Return a boolean value. * @throws { BusinessError } 1900010 - read data from message sequence failed * @since 9 */ @@ -1232,7 +1230,7 @@ declare namespace rpc { /** * Reads a single character value from the {@link MessageSequence} object. - * @return Returns a single character value. + * @returns Return a single character value. * @throws { BusinessError } 1900010 - read data from message sequence failed * @since 9 */ @@ -1240,7 +1238,7 @@ declare namespace rpc { /** * Reads a string value from the {@link MessageSequence} object. - * @return Returns a string value. + * @returns Return a string value. * @throws { BusinessError } 1900010 - read data from message sequence failed * @since 9 */ @@ -1268,7 +1266,7 @@ declare namespace rpc { /** * Reads a byte array from the {@link MessageSequence} object. - * @return Returns a byte array. + * @returns Return a byte array. * @throws { BusinessError } 401 - check param failed * @throws { BusinessError } 1900010 - read data from message sequence failed * @since 9 @@ -1286,7 +1284,7 @@ declare namespace rpc { /** * Reads a short integer array from the {@link MessageSequence} object. - * @return Returns a short integer array. + * @returns Return a short integer array. * @throws { BusinessError } 1900010 - read data from message sequence failed * @since 9 */ @@ -1303,7 +1301,7 @@ declare namespace rpc { /** * Reads an integer array from the {@link MessageSequence} object. - * @return Returns an integer array. + * @returns Return an integer array. * @throws { BusinessError } 1900010 - read data from message sequence failed * @since 9 */ @@ -1320,7 +1318,7 @@ declare namespace rpc { /** * Reads a long integer array from the {@link MessageSequence} object. - * @return Returns a long integer array. + * @returns Return a long integer array. * @throws { BusinessError } 1900010 - read data from message sequence failed * @since 9 */ @@ -1337,7 +1335,7 @@ declare namespace rpc { /** * Reads a floating point array from the {@link MessageSequence} object. - * @return Returns a floating point array. + * @returns Return a floating point array. * @throws { BusinessError } 1900010 - read data from message sequence failed * @since 9 */ @@ -1354,7 +1352,7 @@ declare namespace rpc { /** * Reads a double-precision floating point array from the {@link MessageSequence} object. - * @return Returns a double-precision floating point array. + * @returns Return a double-precision floating point array. * @throws { BusinessError } 1900010 - read data from message sequence failed * @since 9 */ @@ -1371,7 +1369,7 @@ declare namespace rpc { /** * Reads a boolean array from the {@link MessageSequence} object. - * @return Returns a boolean array. + * @returns Return a boolean array. * @throws { BusinessError } 1900010 - read data from message sequence failed * @since 9 */ @@ -1388,7 +1386,7 @@ declare namespace rpc { /** * Reads a single character array from the {@link MessageSequence} object. - * @return Returns a single character array. + * @returns Return a single character array. * @throws { BusinessError } 1900010 - read data from message sequence failed * @since 9 */ @@ -1406,7 +1404,7 @@ declare namespace rpc { /** * Reads a string array from the {@link MessageSequence} object. - * @return Returns a string array. + * @returns Return a string array. * @throws { BusinessError } 1900010 - read data from message sequence failed * @since 9 */ @@ -1433,7 +1431,7 @@ declare namespace rpc { /** * Reads {@link IRemoteObject} objects from this {@link MessageSequence} object. - * @return An array of {@link IRemoteObject} objects obtained. + * @returns An array of {@link IRemoteObject} objects obtained. * @throws { BusinessError } 1900010 - read data from message sequence failed * @since 9 */ @@ -1450,7 +1448,7 @@ declare namespace rpc { /** * Duplicates the specified file descriptor. * @param fd File descriptor to be duplicated. - * @return A duplicated file descriptor. + * @returns A duplicated file descriptor. * @throws { BusinessError } 401 - check param failed * @throws { BusinessError } 1900013 call os dup function failed * @since 9 @@ -1459,8 +1457,8 @@ declare namespace rpc { /** * Checks whether this {@link MessageSequence} object contains a file descriptor. - * @return Returns true if the {@link MessageSequence} object contains a file descriptor; - * returns false otherwise. + * @returns Return true if the {@link MessageSequence} object contains a file descriptor; + * return false otherwise. * @since 9 */ containFileDescriptors(): boolean; @@ -1476,7 +1474,7 @@ declare namespace rpc { /** * Reads a file descriptor from this {@link MessageSequence} object. - * @return File descriptor obtained. + * @returns File descriptor obtained. * @throws { BusinessError } 1900010 - read data from message sequence failed * @since 9 */ @@ -1486,23 +1484,23 @@ declare namespace rpc { * Writes an anonymous shared memory object to this {@link MessageSequence} object. * @param ashmem Anonymous shared memory object to wrote. * @throws { BusinessError } 401 - check param failed - * @throws { BusinessError } 1900009 - write data to message sequence failed + * @throws { BusinessError } 1900003 - write to ashmem failed * @since 9 */ writeAshmem(ashmem: Ashmem): void; /** * Reads the anonymous shared memory object from this {@link MessageSequence} object. - * @return Anonymous share object obtained. + * @returns Anonymous share object obtained. * @throws { BusinessError } 401 - check param failed - * @throws { BusinessError } 1900009 - write data to message sequence failed + * @throws { BusinessError } 1900004 - read from ashmem failed * @since 9 */ readAshmem(): Ashmem; /** * Obtains the maximum amount of raw data that can be sent in a time. - * @return 128 MB. + * @returns 128 MB. * @since 9 */ getRawDataCapacity(): number; @@ -1520,7 +1518,7 @@ declare namespace rpc { /** * Reads raw data from this {@link MessageSequence} object. * @param size Size of the raw data to read. - * @return Raw data obtained, in bytes. + * @returns Raw data obtained, in bytes. * @throws { BusinessError } 401 - check param failed * @throws { BusinessError } 1900010 - read data from message sequence failed * @since 9 @@ -1530,29 +1528,28 @@ declare namespace rpc { /** * @syscap SystemCapability.Communication.IPC.Core - * @import import rpc from '@ohos.rpc' * @since 7 * @deprecated since 9 * @useinstead ohos.rpc.Parcelable */ interface Sequenceable { /** - * Marshals this {@code Sequenceable} object into a {@link MessageParcel}. + * Marshal this {@code Sequenceable} object into a {@link MessageParcel}. * * @param dataOut Indicates the {@link MessageParcel} object to which the {@code Sequenceable} - * object will be marshaled.. - * @return Returns {@code true} if the marshalling is successful; returns {@code false} otherwise. + * object will be marshalled.. + * @returns Return {@code true} if the marshalling is successful; return {@code false} otherwise. * @throws ParcelException Throws this exception if the operation fails. * @since 7 */ marshalling(dataOut: MessageParcel): boolean; /** - * Unmarshals this {@code Sequenceable} object from a {@link MessageParcel}. + * Unmarshal this {@code Sequenceable} object from a {@link MessageParcel}. * * @param dataIn Indicates the {@link MessageParcel} object into which the {@code Sequenceable} - * object has been marshaled. - * @return Returns {@code true} if the unmarshalling is successful; returns {@code false} otherwise. + * object has been marshalled. + * @returns Return {@code true} if the unmarshalling is successful; return {@code false} otherwise. * @throws ParcelException Throws this exception if the operation fails. * @since 7 */ @@ -1561,27 +1558,26 @@ declare namespace rpc { /** * @syscap SystemCapability.Communication.IPC.Core - * @import import rpc from '@ohos.rpc' * @since 9 */ interface Parcelable { /** - * Marshals this {@code Parcelable} object into a {@link MessageSequence}. + * Marshal this {@code Parcelable} object into a {@link MessageSequence}. * * @param dataOut Indicates the {@link MessageSequence} object to which the {@code Parcelable} - * object will be marshaled.. - * @return Returns {@code true} if the marshalling is successful; returns {@code false} otherwise. + * object will be marshalled.. + * @returns Return {@code true} if the marshalling is successful; return {@code false} otherwise. * @throws ParcelException Throws this exception if the operation fails. * @since 9 */ marshalling(dataOut: MessageSequence): boolean; /** - * Unmarshals this {@code Parcelable} object from a {@link MessageSequence}. + * Unmarshal this {@code Parcelable} object from a {@link MessageSequence}. * * @param dataIn Indicates the {@link MessageSequence} object into which the {@code Parcelable} - * object has been marshaled. - * @return Returns {@code true} if the unmarshalling is successful; returns {@code false} otherwise. + * object has been marshalled. + * @returns Return {@code true} if the unmarshalling is successful; return {@code false} otherwise. * @throws ParcelException Throws this exception if the operation fails. * @since 9 */ @@ -1594,7 +1590,6 @@ declare namespace rpc { * namely error code of this operation, request code, data parcel * and reply parcel. * @syscap SystemCapability.Communication.IPC.Core - * @import import rpc from '@ohos.rpc' * @since 8 * @deprecated since 9 * @useinstead ohos.rpc.RequestResult @@ -1633,7 +1628,6 @@ declare namespace rpc { * namely error code of this operation, request code, data parcel * and reply parcel. * @syscap SystemCapability.Communication.IPC.Core - * @import import rpc from '@ohos.rpc' * @since 9 */ interface RequestResult { @@ -1666,7 +1660,6 @@ declare namespace rpc { /** * @syscap SystemCapability.Communication.IPC.Core - * @import import rpc from '@ohos.rpc' * @since 7 */ abstract class IRemoteObject { @@ -1678,7 +1671,7 @@ declare namespace rpc { * indicating that the interface is not a local one. * * @param descriptor Indicates the interface descriptor. - * @return Returns the {@link IRemoteBroker} object bound to the specified interface descriptor. + * @returns Return the {@link IRemoteBroker} object bound to the specified interface descriptor. * @since 7 * @deprecated since 9 * @useinstead ohos.rpc.IRemoteObject#getLocalInterface @@ -1693,7 +1686,7 @@ declare namespace rpc { * indicating that the interface is not a local one. * * @param descriptor Indicates the interface descriptor. - * @return Returns the {@link IRemoteBroker} object bound to the specified interface descriptor. + * @returns Return the {@link IRemoteBroker} object bound to the specified interface descriptor. * @throws { BusinessError } 401 - check param failed * @since 9 */ @@ -1712,7 +1705,7 @@ declare namespace rpc { * @param data Indicates the {@link MessageParcel} object sent to the peer process. * @param reply Indicates the {@link MessageParcel} object returned by the peer process. * @param options Indicates the synchronous or asynchronous mode to send messages. - * @return Returns {@code true} if the method is called successfully; returns {@code false} otherwise. + * @returns Return {@code true} if the method is called successfully; return {@code false} otherwise. * @throws RemoteException Throws this exception if the method fails to be called. * @since 7 * @deprecated since 9 @@ -1796,11 +1789,11 @@ declare namespace rpc { sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption, callback: AsyncCallback): void; /** - * Registers a callback used to receive notifications of the death of a remote object. + * Register a callback used to receive notifications of the death of a remote object. * * @param recipient Indicates the callback to be registered. * @param flags Indicates the flag of the death notification. - * @return Returns {@code true} if the callback is registered successfully; returns {@code false} otherwise. + * @returns Return {@code true} if the callback is registered successfully; return {@code false} otherwise. * @since 7 * @deprecated since 9 * @useinstead ohos.rpc.IRemoteObject#registerDeathRecipient @@ -1808,7 +1801,7 @@ declare namespace rpc { addDeathRecipient(recipient: DeathRecipient, flags: number): boolean; /** - * Registers a callback used to receive notifications of the death of a remote object. + * Register a callback used to receive notifications of the death of a remote object. * * @param recipient Indicates the callback to be registered. * @param flags Indicates the flag of the death notification. @@ -1819,11 +1812,11 @@ declare namespace rpc { registerDeathRecipient(recipient: DeathRecipient, flags: number): void; /** - * Deregisters a callback used to receive notifications of the death of a remote object. + * Unregister a callback used to receive notifications of the death of a remote object. * - * @param recipient Indicates the callback to be deregistered. + * @param recipient Indicates the callback to be unregister. * @param flags Indicates the flag of the death notification. - * @return Returns {@code true} if the callback is deregistered successfully; returns {@code false} otherwise. + * @returns Return {@code true} if the callback is unregister successfully; return {@code false} otherwise. * @since 7 * @deprecated since 9 * @useinstead ohos.rpc.IRemoteObject#unregisterDeathRecipient @@ -1831,9 +1824,9 @@ declare namespace rpc { removeDeathRecipient(recipient: DeathRecipient, flags: number): boolean; /** - * Deregisters a callback used to receive notifications of the death of a remote object. + * Unregister a callback used to receive notifications of the death of a remote object. * - * @param recipient Indicates the callback to be deregistered. + * @param recipient Indicates the callback to be unregister. * @param flags Indicates the flag of the death notification. * @throws { BusinessError } 401 - check param failed * @throws { BusinessError } 1900008 - proxy or remote object is invalid @@ -1846,10 +1839,10 @@ declare namespace rpc { * *

          The interface descriptor is a character string. * - * @return Returns the interface descriptor. + * @returns Return the interface descriptor. * @since 7 * @deprecated since 9 - * @useinstead ohos.rpc.IRemoteObject#getInterfaceDescriptor + * @useinstead ohos.rpc.IRemoteObject#getDescriptor */ getInterfaceDescriptor(): string; @@ -1858,16 +1851,16 @@ declare namespace rpc { * *

          The interface descriptor is a character string. * - * @return Returns the interface descriptor. + * @returns Return the interface descriptor. * @throws { BusinessError } 1900008 - proxy or remote object is invalid * @since 9 */ - getInterfaceDescriptor(): string; + getDescriptor(): string; /** * Checks whether an object is dead. * - * @return Returns {@code true} if the object is dead; returns {@code false} otherwise. + * @returns Return {@code true} if the object is dead; return {@code false} otherwise. * @since 7 */ isObjectDead(): boolean; @@ -1875,14 +1868,13 @@ declare namespace rpc { /** * @syscap SystemCapability.Communication.IPC.Core - * @import import rpc from '@ohos.rpc' * @since 7 */ interface IRemoteBroker { /** * Obtains a proxy or remote object. This method must be implemented by its derived classes. * - * @return Returns the RemoteObject if the caller is a RemoteObject; returns the IRemoteObject, + * @returns Return the RemoteObject if the caller is a RemoteObject; return the IRemoteObject, * that is, the holder of this RemoteProxy object, if the caller is a RemoteProxy object. * @since 7 */ @@ -1892,7 +1884,6 @@ declare namespace rpc { /** * @since 7 * @syscap SystemCapability.Communication.IPC.Core - * @import import rpc from '@ohos.rpc' */ interface DeathRecipient { /** @@ -1905,7 +1896,6 @@ declare namespace rpc { /** * @syscap SystemCapability.Communication.IPC.Core - * @import import rpc from '@ohos.rpc' * @since 7 */ class MessageOption { @@ -1966,7 +1956,7 @@ declare namespace rpc { /** * Obtains the SendRequest call flag, which can be synchronous or asynchronous. * - * @return Returns whether the SendRequest is called synchronously or asynchronously. + * @returns Return whether the SendRequest is called synchronously or asynchronously. * @since 7 */ getFlags(): number; @@ -1982,7 +1972,7 @@ declare namespace rpc { /** * Obtains the SendRequest call flag, which can be synchronous or asynchronous. * - * @return Returns whether the SendRequest is called synchronously or asynchronously. + * @returns Return whether the SendRequest is called synchronously or asynchronously. * @since 9 */ isAsync(): boolean; @@ -1998,7 +1988,7 @@ declare namespace rpc { /** * Obtains the maximum wait time for this RPC call. * - * @return Returns maximum wait time obtained. + * @returns Return maximum wait time obtained. * @since 7 */ getWaitTime(): number; @@ -2014,7 +2004,6 @@ declare namespace rpc { /** * @syscap SystemCapability.Communication.IPC.Core - * @import import rpc from '@ohos.rpc' * @since 7 */ class RemoteObject extends IRemoteObject { @@ -2030,7 +2019,7 @@ declare namespace rpc { * Queries a remote object using an interface descriptor. * * @param descriptor Indicates the interface descriptor used to query the remote object. - * @return Returns the remote object matching the interface descriptor; returns null + * @returns Return the remote object matching the interface descriptor; return null * if no such remote object is found. * @since 7 * @deprecated since 9 @@ -2042,7 +2031,7 @@ declare namespace rpc { * Queries a remote object using an interface descriptor. * * @param descriptor Indicates the interface descriptor used to query the remote object. - * @return Returns the remote object matching the interface descriptor; returns null + * @returns Return the remote object matching the interface descriptor; return null * if no such remote object is found. * @throws { BusinessError } 401 - check param failed * @since 9 @@ -2052,7 +2041,7 @@ declare namespace rpc { /** * Queries an interface descriptor. * - * @return Returns the interface descriptor. + * @returns Return the interface descriptor. * @since 7 * @deprecated since 9 * @useinstead ohos.rpc.RemoteObject#getDescriptor @@ -2062,7 +2051,7 @@ declare namespace rpc { /** * Queries an interface descriptor. * - * @return Returns the interface descriptor. + * @returns Return the interface descriptor. * @throws { BusinessError } 1900008 - proxy or remote object is invalid * @since 9 */ @@ -2079,13 +2068,12 @@ declare namespace rpc { * @param reply Indicates the response message object sent from the remote service. * The local service writes the response data to the {@link MessageParcel} object. * @param options Indicates whether the operation is synchronous or asynchronous. - * @return - * Returns a simple boolean which is {@code true} if the operation succeeds; {{@code false} otherwise} when the function call is synchronous. - * Returns a promise object with a boolean when the function call is asynchronous. - * @throws RemoteException Throws this exception if a remote service error occurs. + * @returns + * Return a simple boolean which is {@code true} if the operation succeeds; {{@code false} otherwise} when the function call is synchronous. + * Return a promise object with a boolean when the function call is asynchronous. * @since 9 */ - onRemoteRequestEx(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): boolean | Promise; + onRemoteMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption): boolean | Promise; /** * Sets an entry for receiving requests. @@ -2098,10 +2086,11 @@ declare namespace rpc { * @param reply Indicates the response message object sent from the remote service. * The local service writes the response data to the {@link MessageParcel} object. * @param options Indicates whether the operation is synchronous or asynchronous. - * @return Returns {@code true} if the operation succeeds; returns {@code false} otherwise. + * @returns Return {@code true} if the operation succeeds; return {@code false} otherwise. * @throws RemoteException Throws this exception if a remote service error occurs. * @since 7 * @deprecated since 9 + * @useinstead ohos.rpc.RemoteObject#onRemoteMessageRequest */ onRemoteRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): boolean; @@ -2115,9 +2104,9 @@ declare namespace rpc { * @param data Indicates the {@link MessageParcel} object storing the data to be sent. * @param reply Indicates the {@link MessageParcel} object receiving the response data. * @param options Indicates a synchronous (default) or asynchronous request. - * @return Returns {@code true} if the operation succeeds; returns {@code false} otherwise. - * @deprecated since 8 + * @returns Return {@code true} if the operation succeeds; return {@code false} otherwise. * @since 7 + * @deprecated since 8 */ sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): boolean; @@ -2199,7 +2188,7 @@ declare namespace rpc { /** * Obtains the PID of the {@link RemoteProxy} object. * - * @return Returns the PID of the {@link RemoteProxy} object. + * @returns Return the PID of the {@link RemoteProxy} object. * @since 7 */ getCallingPid(): number; @@ -2207,7 +2196,7 @@ declare namespace rpc { /** * Obtains the UID of the {@link RemoteProxy} object. * - * @return Returns the UID of the {@link RemoteProxy} object. + * @returns Return the UID of the {@link RemoteProxy} object. * @since 7 */ getCallingUid(): number; @@ -2240,7 +2229,6 @@ declare namespace rpc { /** * @syscap SystemCapability.Communication.IPC.Core - * @import import rpc from '@ohos.rpc' * @since 7 */ class RemoteProxy implements IRemoteObject { @@ -2297,7 +2285,7 @@ declare namespace rpc { * Queries a local interface with a specified descriptor. * * @param descriptor Indicates the descriptor of the interface to query. - * @return Returns null by default, indicating a proxy interface. + * @returns Return null by default, indicating a proxy interface. * @since 7 * @deprecated since 9 * @useinstead ohos.rpc.RemoteProxy#getLocalInterface @@ -2308,7 +2296,7 @@ declare namespace rpc { * Queries a local interface with a specified descriptor. * * @param descriptor Indicates the descriptor of the interface to query. - * @return Returns null by default, indicating a proxy interface. + * @returns Return null by default, indicating a proxy interface. * @throws { BusinessError } 401 - check param failed * @throws { BusinessError } 1900006 - only remote object permitted * @since 9 @@ -2316,11 +2304,11 @@ declare namespace rpc { getLocalInterface(interface: string): IRemoteBroker; /** - * Registers a callback used to receive death notifications of a remote object. + * Register a callback used to receive death notifications of a remote object. * * @param recipient Indicates the callback to be registered. * @param flags Indicates the flag of the death notification. This is a reserved parameter. Set it to {@code 0}. - * @return Returns {@code true} if the callback is registered successfully; returns {@code false} otherwise. + * @returns Return {@code true} if the callback is registered successfully; return {@code false} otherwise. * @since 7 * @deprecated since 9 * @useinstead ohos.rpc.RemoteProxy#registerDeathRecipient @@ -2328,7 +2316,7 @@ declare namespace rpc { addDeathRecipient(recipient: DeathRecipient, flags: number): boolean; /** - * Registers a callback used to receive death notifications of a remote object. + * Register a callback used to receive death notifications of a remote object. * * @param recipient Indicates the callback to be registered. * @param flags Indicates the flag of the death notification. This is a reserved parameter. Set it to {@code 0}. @@ -2339,11 +2327,11 @@ declare namespace rpc { registerDeathRecipient(recipient: DeathRecipient, flags: number): void; /** - * Deregisters a callback used to receive death notifications of a remote object. + * Unregister a callback used to receive death notifications of a remote object. * - * @param recipient Indicates the callback to be deregistered. + * @param recipient Indicates the callback to be unregister. * @param flags Indicates the flag of the death notification. This is a reserved parameter. Set it to {@code 0}. - * @return Returns {@code true} if the callback is deregistered successfully; returns {@code false} otherwise. + * @returns Return {@code true} if the callback is unregister successfully; return {@code false} otherwise. * @since 7 * @deprecated since 9 * @useinstead ohos.rpc.RemoteProxy#unregisterDeathRecipient @@ -2351,9 +2339,9 @@ declare namespace rpc { removeDeathRecipient(recipient: DeathRecipient, flags: number): boolean; /** - * Deregisters a callback used to receive death notifications of a remote object. + * Unregister a callback used to receive death notifications of a remote object. * - * @param recipient Indicates the callback to be deregistered. + * @param recipient Indicates the callback to be unregister. * @param flags Indicates the flag of the death notification. This is a reserved parameter. Set it to {@code 0}. * @throws { BusinessError } 401 - check param failed * @throws { BusinessError } 1900008 - proxy or remote object is invalid @@ -2364,7 +2352,7 @@ declare namespace rpc { /** * Queries the interface descriptor of remote object. * - * @return Returns the interface descriptor. + * @returns Return the interface descriptor. * @since 7 * @deprecated since 9 * @useinstead ohos.rpc.RemoteProxy#getDescriptor @@ -2374,7 +2362,7 @@ declare namespace rpc { /** * Queries the interface descriptor of remote object. * - * @return Returns the interface descriptor. + * @returns Return the interface descriptor. * @throws { BusinessError } 1900007 - communication failed * @throws { BusinessError } 1900008 - proxy or remote object is invalid * @since 9 @@ -2391,10 +2379,10 @@ declare namespace rpc { * @param data Indicates the {@link MessageParcel} object storing the data to be sent. * @param reply Indicates the {@link MessageParcel} object receiving the response data. * @param options Indicates a synchronous (default) or asynchronous request. - * @return Returns {@code true} if the operation succeeds; returns {@code false} otherwise. + * @returns Return {@code true} if the operation succeeds; return {@code false} otherwise. * @throws RemoteException Throws this exception if a remote object exception occurs. - * @deprecated since 8 * @since 7 + * @deprecated since 8 */ sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): boolean; @@ -2476,7 +2464,7 @@ declare namespace rpc { /** * Checks whether the {@code RemoteObject} corresponding to a {@code RemoteProxy} is dead. * - * @return Returns {@code true} if the {@code RemoteObject} is dead; returns {@code false} otherwise. + * @returns Return {@code true} if the {@code RemoteObject} is dead; return {@code false} otherwise. * @since 7 */ isObjectDead(): boolean; @@ -2484,7 +2472,6 @@ declare namespace rpc { /** * @syscap SystemCapability.Communication.IPC.Core - * @import import rpc from '@ohos.rpc' * @since 7 */ class IPCSkeleton { @@ -2493,7 +2480,7 @@ declare namespace rpc { * *

          This method is static. * - * @return Returns an {@link IRemoteObject} reference of the registered service. + * @returns Return an {@link IRemoteObject} reference of the registered service. * @since 7 */ static getContextObject(): IRemoteObject; @@ -2507,7 +2494,7 @@ declare namespace rpc { * {@code 0} is returned; if this method is called from the {@link RemoteObject} object, * the PID of the corresponding {@link RemoteProxy} object is returned. * - * @return Returns the PID of the proxy. + * @returns Return the PID of the proxy. * @since 7 */ static getCallingPid(): number; @@ -2521,7 +2508,7 @@ declare namespace rpc { * {@code 0} is returned; if this method is called from the {@link RemoteObject} object, * the UID of the corresponding {@link RemoteProxy} object is returned. * - * @return Returns the UID of the proxy. + * @returns Return the UID of the proxy. * @since 7 */ static getCallingUid(): number; @@ -2531,7 +2518,7 @@ declare namespace rpc { * *

          This method is static. * - * @return Returns the TOKENID. + * @returns Return the TOKENID. * @since 8 */ static getCallingTokenId(): number; @@ -2541,7 +2528,7 @@ declare namespace rpc { * *

          This method is static. * - * @return Returns the ID of the device where the peer process resides. + * @returns Return the ID of the device where the peer process resides. * @since 7 */ static getCallingDeviceID(): string; @@ -2551,7 +2538,7 @@ declare namespace rpc { * *

          This method is static. * - * @return Returns the ID of the local device. + * @returns Return the ID of the local device. * @since 7 */ static getLocalDeviceID(): string; @@ -2561,18 +2548,18 @@ declare namespace rpc { * *

          This method is static. * - * @return Returns {@code true} if the call is made on the same device; returns {@code false} otherwise. + * @returns Return {@code true} if the call is made on the same device; return {@code false} otherwise. * @since 7 */ static isLocalCalling(): boolean; /** - * Flushes all pending commands from a specified {@link RemoteProxy} to the corresponding {@link RemoteObject}. + * Flush all pending commands from a specified {@link RemoteProxy} to the corresponding {@link RemoteObject}. * *

          This method is static. You are advised to call this method before performing any time-sensitive operations. * * @param object Indicates the specified {@link RemoteProxy}. - * @return Returns {@code 0} if the operation succeeds; returns an error code if the input object is empty + * @returns Return {@code 0} if the operation succeeds; return an error code if the input object is empty * or {@link RemoteObject}, or the operation fails. * @since 7 * @deprecated since 9 @@ -2581,7 +2568,7 @@ declare namespace rpc { static flushCommands(object: IRemoteObject): number; /** - * Flushes all pending commands from a specified {@link RemoteProxy} to the corresponding {@link RemoteObject}. + * Flush all pending commands from a specified {@link RemoteProxy} to the corresponding {@link RemoteObject}. * *

          This method is static. You are advised to call this method before performing any time-sensitive operations. * @@ -2596,20 +2583,20 @@ declare namespace rpc { * *

          This method is static. It can be used in scenarios like authentication. * - * @return Returns a string containing the UID and PID of the remote user. + * @returns Return a string containing the UID and PID of the remote user. * @since 7 */ static resetCallingIdentity(): string; /** - * Restores the UID and PID to those of the remote user. + * Restore the UID and PID to those of the remote user. * *

          This method is static. It is usually called after {@code resetCallingIdentity} is used * and requires the UID and PID of the remote user returned by {@code resetCallingIdentity}. * * @param identity Indicates the string containing the UID and PID of the remote user, * which is returned by {@code resetCallingIdentity}. - * @return Returns {@code true} if the operation succeeds; returns {@code false} otherwise. + * @returns Return {@code true} if the operation succeeds; return {@code false} otherwise. * @since 7 * @deprecated since 9 * @useinstead ohos.rpc.IPCSkeleton#restoreCallingIdentity @@ -2617,7 +2604,7 @@ declare namespace rpc { static setCallingIdentity(identity: string): boolean; /** - * Restores the UID and PID to those of the remote user. + * Restore the UID and PID to those of the remote user. * *

          This method is static. It is usually called after {@code resetCallingIdentity} is used * and requires the UID and PID of the remote user returned by {@code resetCallingIdentity}. @@ -2636,7 +2623,6 @@ declare namespace rpc { * reading data from and writing data to an Ashmem object, * obtaining the Ashmem size, and setting Ashmem protection. * @syscap SystemCapability.Communication.IPC.Core - * @import import rpc from '@ohos.rpc' * @since 8 */ class Ashmem { @@ -2680,7 +2666,7 @@ declare namespace rpc { * Creates an Ashmem object with the specified name and size. * @param name Name of the Ashmem object to create. * @param size Size (in bytes) of the Ashmem object to create. - * @return Returns the Ashmem object if it is created successfully; returns null otherwise. + * @returns Return the Ashmem object if it is created successfully; return null otherwise. * @since 8 * @deprecated since 9 * @useinstead ohos.rpc.Ashmem#create @@ -2691,7 +2677,7 @@ declare namespace rpc { * Creates an Ashmem object with the specified name and size. * @param name Name of the Ashmem object to create. * @param size Size (in bytes) of the Ashmem object to create. - * @return Returns the Ashmem object if it is created successfully; returns null otherwise. + * @returns Return the Ashmem object if it is created successfully; return null otherwise. * @throws { BusinessError } 401 - check param failed * @since 9 */ @@ -2701,7 +2687,7 @@ declare namespace rpc { * Creates an Ashmem object by copying the file descriptor (FD) of an existing Ashmem object. * The two Ashmem objects point to the same shared memory region. * @param ashmem Existing Ashmem object. - * @return Ashmem object created. + * @returns Ashmem object created. * @since 8 * @deprecated since 9 * @useinstead ohos.rpc.Ashmem#create @@ -2712,7 +2698,7 @@ declare namespace rpc { * Creates an Ashmem object by copying the file descriptor (FD) of an existing Ashmem object. * The two Ashmem objects point to the same shared memory region. * @param ashmem Existing Ashmem object. - * @return Ashmem object created. + * @returns Ashmem object created. * @throws { BusinessError } 401 - check param failed * @since 9 */ @@ -2732,7 +2718,7 @@ declare namespace rpc { /** * Obtains the mapped memory size of this Ashmem object. - * @return Memory size mapped. + * @returns Memory size mapped. * @since 8 */ getAshmemSize(): number; @@ -2741,7 +2727,7 @@ declare namespace rpc { * Creates the shared file mapping on the virtual address space of this process. * The size of the mapping region is specified by this Ashmem object. * @param mapType Protection level of the memory region to which the shared file is mapped. - * @return Returns true if the operation is successful; returns false otherwise. + * @returns Return true if the operation is successful; return false otherwise. * @since 8 * @deprecated since 9 * @useinstead ohos.rpc.Ashmem#mapTypedAshmem @@ -2752,6 +2738,7 @@ declare namespace rpc { * Creates the shared file mapping on the virtual address space of this process. * The size of the mapping region is specified by this Ashmem object. * @param mapType Protection level of the memory region to which the shared file is mapped. + * @throws { BusinessError } 401 - check param failed * @throws { BusinessError } 1900001 - call mmap function failed * @since 9 */ @@ -2759,7 +2746,7 @@ declare namespace rpc { /** * Maps the shared file to the readable and writable virtual address space of the process. - * @return Returns true if the operation is successful; returns false otherwise. + * @returns Return true if the operation is successful; return false otherwise. * @since 8 * @deprecated since 9 * @useinstead ohos.rpc.Ashmem#mapReadWriteAshmem @@ -2775,7 +2762,7 @@ declare namespace rpc { /** * Maps the shared file to the read-only virtual address space of the process. - * @return Returns true if the operation is successful; returns false otherwise. + * @returns Return true if the operation is successful; return false otherwise. * @since 8 * @deprecated since 9 * @useinstead ohos.rpc.Ashmem#mapReadonlyAshmem @@ -2792,7 +2779,7 @@ declare namespace rpc { /** * Sets the protection level of the memory region to which the shared file is mapped. * @param protectionType Protection type to set. - * @return Returns true if the operation is successful; returns false otherwise. + * @returns Return true if the operation is successful; return false otherwise. * @since 8 * @deprecated since 9 * @useinstead ohos.rpc.Ashmem#setProtectionType @@ -2802,6 +2789,7 @@ declare namespace rpc { /** * Sets the protection level of the memory region to which the shared file is mapped. * @param protectionType Protection type to set. + * @throws { BusinessError } 401 - check param failed * @throws { BusinessError } 1900002 - os ioctl function failed * @since 9 */ @@ -2812,7 +2800,7 @@ declare namespace rpc { * @param buf Data to write * @param size Size of the data to write * @param offset Start position of the data to write in the memory region associated with this Ashmem object. - * @return Returns true is the data is written successfully; returns false otherwise. + * @returns Return true is the data is written successfully; return false otherwise. * @since 8 * @deprecated since 9 * @useinstead ohos.rpc.Ashmem#writeAshmem @@ -2825,7 +2813,7 @@ declare namespace rpc { * @param size Size of the data to write * @param offset Start position of the data to write in the memory region associated with this Ashmem object. * @throws { BusinessError } 401 - check param failed - * @throws { BusinessError } 1900009 - write to ashmem failed + * @throws { BusinessError } 1900003 - write to ashmem failed * @since 9 */ writeAshmem(buf: number[], size: number, offset: number): void; @@ -2834,7 +2822,7 @@ declare namespace rpc { * Reads data from the shared file associated with this Ashmem object. * @param size Size of the data to read. * @param offset Start position of the data to read in the memory region associated with this Ashmem object. - * @return Data read. + * @returns Data read. * @since 8 * @deprecated since 9 * @useinstead ohos.rpc.Ashmem#readAshmem @@ -2845,9 +2833,9 @@ declare namespace rpc { * Reads data from the shared file associated with this Ashmem object. * @param size Size of the data to read. * @param offset Start position of the data to read in the memory region associated with this Ashmem object. - * @return Data read. + * @returns Data read. * @throws { BusinessError } 401 - check param failed - * @throws { BusinessError } 1900010 - read from ashmem failed + * @throws { BusinessError } 1900004 - read from ashmem failed * @since 9 */ readAshmem(size: number, offset: number): number[]; diff --git a/api/@ohos.runningLock.d.ts b/api/@ohos.runningLock.d.ts index d9365fbcf38354c149b12a47f207b70fa82fed55..2379a2fb7c11774269f1f8499ff2db27d9f40e71 100644 --- a/api/@ohos.runningLock.d.ts +++ b/api/@ohos.runningLock.d.ts @@ -13,16 +13,16 @@ * limitations under the License. */ -import {AsyncCallback} from './basic'; +import {AsyncCallback, BusinessError} from './basic'; /** * Provides a mechanism to prevent the system from hibernating so that the applications can run in the background or * when the screen is off. * - *

          {@link createRunningLock} can be called to obtain a {@link RunningLock}. - *

          {@link lock} can be called to set the lock duration, during which the system will not hibernate. After the - * lock duration times out, the lock is automatically released and the system hibernates if no other {@link - * RunningLock} is set. + *

          {@link create} can be called to obtain a {@link RunningLock}. + *

          {@link hold} can be called to set the lock duration, during which the system will not hibernate. After the + * lock duration times out, the lock is automatically released and the system hibernates if no other + * {@link RunningLock} is set. * * @syscap SystemCapability.PowerManager.PowerManager.Core * @since 7 @@ -33,29 +33,67 @@ declare namespace runningLock { * Prevents the system from hibernating and sets the lock duration. * This method requires the ohos.permission.RUNNING_LOCK permission. * + * @permission ohos.permission.RUNNING_LOCK * @param timeout Indicates the lock duration (ms). After the lock duration times out, the lock is automatically * released and the system hibernates if no other {@link RunningLock} is set. - * @permission ohos.permission.RUNNING_LOCK * @since 7 + * @deprecated since 9 + * @useinstead {@link RunningLock#hold} */ lock(timeout: number): void; + /** + * Prevents the system from hibernating and sets the lock duration. + * This method requires the ohos.permission.RUNNING_LOCK permission. + * + * @permission ohos.permission.RUNNING_LOCK + * @param {number} timeout Indicates the lock duration (ms). After the lock duration times out, + * the lock is automatically released and the system hibernates if no other {@link RunningLock} is set. + * @throws {BusinessError} 401 - If the timeout is not valid. + * @throws {BusinessError} 4900101 - If connecting to the service failed. + * @since 9 + */ + hold(timeout: number): void; + /** * Checks whether a lock is held or in use. * - * @return Returns true if the lock is held or in use; returns false if the lock has been released. + * @returns Returns true if the lock is held or in use; returns false if the lock has been released. * @since 7 + * @deprecated since 9 + * @useinstead {@link RunningLock#isHolding} */ isUsed(): boolean; + /** + * Checks whether a lock is held or in use. + * + * @returns Returns true if the lock is held or in use; returns false if the lock has been released. + * @throws {BusinessError} 4900101 - If connecting to the service failed. + * @since 9 + */ + isHolding(): boolean; + /** * Release the {@link RunningLock} that prevents the system from hibernating. * This method requires the ohos.permission.RUNNING_LOCK permission. * - * @since 7 * @permission ohos.permission.RUNNING_LOCK + * @since 7 + * @deprecated since 9 + * @useinstead {@link RunningLock#unhold} */ unlock(): void; + + /** + * Release the {@link RunningLock} that prevents the system from hibernating. + * This method requires the ohos.permission.RUNNING_LOCK permission. + * + * @permission ohos.permission.RUNNING_LOCK + * @throws {BusinessError} 4900101 - If connecting to the service failed. + * @since 9 + */ + unhold(): void; } /** @@ -85,12 +123,28 @@ declare namespace runningLock { * Checks whether the specified {@link RunningLockType} is supported. * * @param type Indicates the specified {@link RunningLockType}. - * @return Returns true if the specified {@link RunningLockType} is supported; + * @param callback Indicates the callback function contains the result whether the specified + * {@link RunningLockType} is supported. + * @returns Returns true if the specified {@link RunningLockType} is supported; * returns false otherwise. * @since 7 + * @deprecated since 9 + * @useinstead {@link RunningLock#isSupported} */ function isRunningLockTypeSupported(type: RunningLockType, callback: AsyncCallback): void; function isRunningLockTypeSupported(type: RunningLockType): Promise; + + /** + * Checks whether the specified {@link RunningLockType} is supported. + * + * @param {RunningLockType} type Indicates the specified {@link RunningLockType}. + * @returns {boolean} Whether the specified {@link RunningLockType} is supported. + * @throws {BusinessError} 401 - If the type is not valid. + * @throws {BusinessError} 4900101 - If connecting to the service failed. + * @since 9 + */ + function isSupported(type: RunningLockType): boolean; + /** * Creates a {@link RunningLock} object. * @@ -101,11 +155,48 @@ declare namespace runningLock { * @param name Indicates the {@link RunningLock} name. A recommended name consists of the package or class name and * a suffix. * @param type Indicates the {@link RunningLockType}. - * @return Returns the {@link RunningLock} object. + * @param callback Indicates the callback contains the {@link RunningLock} object. + * @returns Returns the {@link RunningLock} object. * @permission ohos.permission.RUNNING_LOCK * @since 7 + * @deprecated since 9 + * @useinstead {@link RunningLock#create} */ function createRunningLock(name: string, type: RunningLockType, callback: AsyncCallback): void; function createRunningLock(name: string, type: RunningLockType): Promise; + + /** + * Creates a {@link RunningLock} object. + * + *

          This method requires the ohos.permission.RUNNING_LOCK permission. + * + *

          The {@link RunningLock} object can be used to perform a lock operation to prevent the system from hibernating. + * + * @permission ohos.permission.RUNNING_LOCK + * @param {string} name Indicates the {@link RunningLock} name. A recommended name consists of the package or + * class name and a suffix. + * @param {RunningLockType} type Indicates the {@link RunningLockType}. + * @param {AsyncCallback)} callback Indicates the callback of {@link RunningLock} object. + * @throws {BusinessError} 401 - If the name, type or callback is not valid. + * @since 9 + */ + function create(name: string, type: RunningLockType, callback: AsyncCallback): void; + + /** + * Creates a {@link RunningLock} object. + * + *

          This method requires the ohos.permission.RUNNING_LOCK permission. + * + *

          The {@link RunningLock} object can be used to perform a lock operation to prevent the system from hibernating. + * + * @permission ohos.permission.RUNNING_LOCK + * @param {string} name Indicates the {@link RunningLock} name. A recommended name consists of the package or + * class name and a suffix. + * @param {RunningLockType} type Indicates the {@link RunningLockType}. + * @returns {Promise} The {@link RunningLock} object. + * @throws {BusinessError} 401 - If the name or type is not valid. + * @since 9 + */ + function create(name: string, type: RunningLockType): Promise; } export default runningLock; diff --git a/api/@ohos.screen.d.ts b/api/@ohos.screen.d.ts index a9da9f645201d7bd6dfb3adecb3143f7b8d9237e..649236ac4bcc11410ee2aef1dc582165e0009d3c 100644 --- a/api/@ohos.screen.d.ts +++ b/api/@ohos.screen.d.ts @@ -240,7 +240,7 @@ declare namespace screen { } /** - * The infomation of the screen + * The information of the screen * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 9 */ diff --git a/api/@ohos.screenLock.d.ts b/api/@ohos.screenLock.d.ts index 68d56d5320e8ab101d22c9be645ade57fe6c2fa4..b6088367ad772e957a9f9c8c123bd2e564768994 100644 --- a/api/@ohos.screenLock.d.ts +++ b/api/@ohos.screenLock.d.ts @@ -59,7 +59,7 @@ declare namespace screenLock { function isSecure(): boolean; /** - * Unlocks the screen. + * Unlock the screen. * return - * @since 7 * @deprecated since 9 @@ -69,7 +69,7 @@ declare namespace screenLock { function unlockScreen():Promise; /** - * Unlocks the screen. Returns true if the screen unlocked successfully. returns false otherwise. + * Unlock the screen. Returns true if the screen unlocked successfully. returns false otherwise. * @returns { Promise } the Promise returned by the function. * @throws {BusinessError} 401 - parameter error. * @since 9 @@ -95,8 +95,8 @@ declare namespace screenLock { } /** - * Register system event related to syscreen lock. Returns true if register system event is success. returns false otherwise. - * @params callback The callback function for indcating the system event related screen lock + * Register system event related to sysscreen lock. Returns true if register system event is success. returns false otherwise. + * @param { Callback } callback - the callback function for indicating the system event related screen lock * @returns { boolean } the boolean returned by the function. * @throws {BusinessError} 401 - parameter error. * @systemapi Hide this for inner system use. @@ -105,8 +105,9 @@ declare namespace screenLock { function onSystemEvent(callback: Callback): boolean; /** - * screenlockAPP send event to screenlockSA. - * @params parameter The params of the event. + * The screen lock app sends the event to the screen lock service. + * @param { String } event - event type. + * @param { number } parameter - operation result of the event. * @throws {BusinessError} 401 - parameter error. * @systemapi Hide this for inner system use. * @since 9 diff --git a/api/@ohos.security.cryptoFramework.d.ts b/api/@ohos.security.cryptoFramework.d.ts index 69aab9025d880f6b6e6528612c3331ceacec4b0a..9660b0b325b1d6859015ff389956f0ab438b6c93 100755 --- a/api/@ohos.security.cryptoFramework.d.ts +++ b/api/@ohos.security.cryptoFramework.d.ts @@ -13,15 +13,13 @@ * limitations under the License. */ - import {AsyncCallback, Callback} from './basic'; /** * Provides a set of encryption and decryption algorithm library framework, shields the underlying differences, - * encapsulates the relevant algorithm library, and provides a unified functional interface upward. + * encapsulate the relevant algorithm library, and provides a unified functional interface upward. * * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 */ declare namespace cryptoFramework { @@ -86,16 +84,30 @@ declare namespace cryptoFramework { ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE = 17630007, } + /** + * Provides the data blob type. + * @typedef DataBlob + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ interface DataBlob { data : Uint8Array; } + /** + * Provides the data array type. + * @typedef DataArray + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ interface DataArray { data : Array; } /** - * Enum for supported cert encoding format + * Enum for supported cert encoding format. + * @enum {number} + * @syscap SystemCapability.Security.CryptoFramework * @since 9 */ enum EncodingFormat { @@ -112,41 +124,68 @@ declare namespace cryptoFramework { FORMAT_PEM = 1, } + /** + * Provides the cert encoding blob type. + * @typedef EncodingBlob + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ interface EncodingBlob { data : Uint8Array; encodingFormat : EncodingFormat; } + /** + * Provides the cert chain data type. + * @typedef CertChainData + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ interface CertChainData { data: Uint8Array; count : number; encodingFormat: EncodingFormat; } + /** + * Provides the ParamsSpec type, including the algorithm name. + * @typedef ParamsSpec + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ interface ParamsSpec { /** * Indicates the algorithm name. - * * @syscap SystemCapability.Security.CryptoFramework * @since 9 */ algoName : string; } + /** + * Provides the IvParamsSpec type, including the parameter iv. + * @typedef IvParamsSpec + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ interface IvParamsSpec extends ParamsSpec { /** * Indicates the algorithm parameters such as iv. - * * @syscap SystemCapability.Security.CryptoFramework * @since 9 */ iv : DataBlob; } + /** + * Provides the GcmParamsSpec type, including the parameter iv, aad and authTag. + * @typedef GcmParamsSpec + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ interface GcmParamsSpec extends ParamsSpec { /** * Indicates the GCM algorithm parameters such as iv. - * * @syscap SystemCapability.Security.CryptoFramework * @since 9 */ @@ -154,7 +193,6 @@ declare namespace cryptoFramework { /** * Indicates the GCM additional message for integrity check. - * * @syscap SystemCapability.Security.CryptoFramework * @since 9 */ @@ -162,13 +200,18 @@ declare namespace cryptoFramework { /** * Indicates the GCM Authenticated Data. - * * @syscap SystemCapability.Security.CryptoFramework * @since 9 */ authTag : DataBlob; } + /** + * Provides the CcmParamsSpec type, including the parameter iv, aad and authTag. + * @typedef CcmParamsSpec + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ interface CcmParamsSpec extends ParamsSpec { /** * Indicates the GCM algorithm parameters such as iv. @@ -180,7 +223,6 @@ declare namespace cryptoFramework { /** * Indicates the CCM additional message for integrity check. - * * @syscap SystemCapability.Security.CryptoFramework * @since 9 */ @@ -188,7 +230,6 @@ declare namespace cryptoFramework { /** * Indicates the CCM Authenticated Data. - * * @syscap SystemCapability.Security.CryptoFramework * @since 9 */ @@ -215,17 +256,14 @@ declare namespace cryptoFramework { /** * The common parents class of key. - * * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 */ interface Key { /** - * Encode key Object to bin. - * + * Encode the key object to binary data. + * @returns { DataBlob } the binary data of the key object. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 */ getEncoded() : DataBlob; @@ -234,16 +272,13 @@ declare namespace cryptoFramework { * Key format. * * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 */ readonly format : string; /** * Key algorithm name. - * * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 */ readonly algName : string; @@ -254,56 +289,45 @@ declare namespace cryptoFramework { } /** - * The private key class of asy-key. + * The private key class of asymmetrical key. * * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 */ interface PriKey extends Key { /** * The function used to clear private key mem. - * * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 */ clearMem() : void; } /** - * The public key class of asy-key. - * + * The public key class of asymmetrical key. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 */ interface PubKey extends Key {} /** - * The keyPair class of asy-key. Include privateKey and publickey. - * + * The keyPair class of asymmetrical key. Include privateKey and publickey. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 */ interface KeyPair { /** * Public key. - * * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 */ readonly priKey : PriKey; /** * Private key. - * * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 */ readonly pubKey : PubKey; @@ -312,21 +336,20 @@ declare namespace cryptoFramework { interface Random { /** - * Generate radom DataBlob by given length - * + * Generate radom DataBlob by given length. + * @param len Indicates the length of random DataBlob. + * @returns Returns the generated random blob. * @syscap SystemCapability.Security.CryptoFramework * @since 9 - * @param len Indicates the length of random DataBlob */ generateRandom(len : number, callback: AsyncCallback) : void; generateRandom(len : number) : Promise; /** - * set seed by given DataBlob - * + * Set seed by given DataBlob. + * @param seed Indicates the seed DataBlob. * @syscap SystemCapability.Security.CryptoFramework * @since 9 - * @param seed Indicates the seed DataBlob */ setSeed(seed : DataBlob, callback : AsyncCallback) : void; setSeed(seed : DataBlob) : Promise; @@ -334,111 +357,135 @@ declare namespace cryptoFramework { /** * Provides the rand create func. - * + * @returns Returns the created rand instance. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @return Returns the rand create instance. */ function createRandom() : Random; /** - * The generator used to generate asy_key. - * + * The generator used to generate asymmetrical key. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 */ interface AsyKeyGenerator { /** - * Generate keyPair by init params. - * + * Used to generate asymetric key pair. + * @param { AsyncCallback } callback - the callback used to return keypair. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @return The generated keyPair. */ generateKeyPair(callback : AsyncCallback) : void; generateKeyPair() : Promise; /** * Convert keyPair object from privateKey and publicKey binary data. - * - * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' - * @since 9 * @param pubKey The binary data of public key. * @param priKey The binary data of private key. - * @return The Converted key pair. + * @returns The Converted key pair. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 */ convertKey(pubKey : DataBlob, priKey : DataBlob, callback : AsyncCallback) : void; convertKey(pubKey : DataBlob, priKey : DataBlob) : Promise; /** - * The algorothm name of generator. - * + * The algorithm name of generator. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 */ readonly algName : string; } + /** + * Provides the SymKeyGenerator type, which is used for generating symmetric key. + * @typedef SymKeyGenerator + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ interface SymKeyGenerator { + /** + * Generate a symmetric key object randomly. + * @param { AsyncCallback } callback - the callback of generateSymKey. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ generateSymKey(callback : AsyncCallback) : void; + + /** + * Generate a symmetric key object randomly. + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ generateSymKey() : Promise; + + /** + * Generate a symmetric key object according to the provided binary key data. + * @param { AsyncCallback } callback - the callback of generateSymKey. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ convertKey(key : DataBlob, callback : AsyncCallback) : void; + + /** + * Generate a symmetric key object according to the provided binary key data. + * @returns { Promise } the promise returned by the function. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ convertKey(key : DataBlob) : Promise; + + /** + * Indicates the algorithm name of the SymKeyGenerator object. + * @type { string } + * @readonly + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ readonly algName : string; } /** - * Provides the asy key generator instance func. - * + * Provides the asymmetrical key generator instance func. + * @param algName This algName contains params of generateKeyPair, like bits, primes or ECC_curve; + * @returns The generator object. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @param algName This algName contains params of generateKeyPair, like bits, primes or ECC_curve; - * @return The generator object. */ function createAsyKeyGenerator(algName : string) : AsyKeyGenerator; /** * Provides the sym key generator instance func. - * + * @param algName Indicates the algorithm name. + * @returns Returns the sym key generator instance. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @param algName Indicates the algorithm name. - * @return Returns the sym key generator instance. */ function createSymKeyGenerator(algName : string) : SymKeyGenerator; interface Mac { /** * Init hmac with given SymKey - * + * @param key Indicates the SymKey * @syscap SystemCapability.Security.CryptoFramework * @since 9 - * @param key Indicates the SymKey */ init(key : SymKey, callback : AsyncCallback) : void; init(key : SymKey) : Promise; /** * Update hmac with DataBlob - * + * @param input Indicates the DataBlob * @syscap SystemCapability.Security.CryptoFramework * @since 9 - * @param input Indicates the DataBlob */ update(input : DataBlob, callback : AsyncCallback) : void; update(input : DataBlob) : Promise; /** * Output the result of hmac calculation - * * @syscap SystemCapability.Security.CryptoFramework * @since 9 */ @@ -447,7 +494,6 @@ declare namespace cryptoFramework { /** * Output the length of hmac result - * * @syscap SystemCapability.Security.CryptoFramework * @since 9 */ @@ -455,7 +501,6 @@ declare namespace cryptoFramework { /** * Indicates the algorithm name - * * @syscap SystemCapability.Security.CryptoFramework * @since 9 */ @@ -464,29 +509,25 @@ declare namespace cryptoFramework { /** * Provides the mac create func. - * + * @param algName Indicates the mac algorithm name. + * @returns Returns the mac create instance. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @param algName Indicates the mac algorithm name. - * @return Returns the mac create instance. */ function createMac(algName : string) : Mac; interface Md { /** * Update md with DataBlob - * + * @param input Indicates the DataBlob * @syscap SystemCapability.Security.CryptoFramework * @since 9 - * @param input Indicates the DataBlob */ update(input : DataBlob, callback : AsyncCallback) : void; update(input : DataBlob) : Promise; /** * Output the result of md calculation - * * @syscap SystemCapability.Security.CryptoFramework * @since 9 */ @@ -495,7 +536,6 @@ declare namespace cryptoFramework { /** * Output the length of md result - * * @syscap SystemCapability.Security.CryptoFramework * @since 9 */ @@ -503,7 +543,6 @@ declare namespace cryptoFramework { /** * Indicates the algorithm name - * * @syscap SystemCapability.Security.CryptoFramework * @since 9 */ @@ -512,41 +551,36 @@ declare namespace cryptoFramework { /** * Provides the md create func. - * + * @param algorithm Indicates the md algorithm. + * @returns Returns the md create instances. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @param algorithm Indicates the md algorithm. - * @return Returns the md create instances. */ function createMd(algName : string) : Md; interface Cipher { /** * Init cipher with given cipher mode, key and params. - * - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 * @param opMode Indicates the cipher mode. - * @param key Indicates the SymKey or AsyKey. + * @param key Indicates the SymKey or asymmetrical key. * @param params Indicates the algorithm parameters such as IV. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 */ init(opMode : CryptoMode, key : Key, params : ParamsSpec, callback : AsyncCallback) : void; init(opMode : CryptoMode, key : Key, params : ParamsSpec) : Promise; /** * Update cipher with DataBlob. - * + * @param input Indicates the DataBlob * @syscap SystemCapability.Security.CryptoFramework * @since 9 - * @param input Indicates the DataBlob */ update(data : DataBlob, callback : AsyncCallback) : void; update(data : DataBlob) : Promise; /** * Output the result of cipher calculation. - * * @syscap SystemCapability.Security.CryptoFramework * @since 9 */ @@ -555,7 +589,6 @@ declare namespace cryptoFramework { /** * Indicates the algorithm name. - * * @syscap SystemCapability.Security.CryptoFramework * @since 9 */ @@ -564,139 +597,130 @@ declare namespace cryptoFramework { /** * Provides the cipher create func. - * + * @param transformation Indicates the transform type, and contains init params of cipher. + * @returns Returns the cipher create instance. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @param transformation Indicates the transform type, and contains init params of cipher. - * @return Returns the cipher create instance. */ function createCipher(transformation : string) : Cipher; /** * The sign class - * * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 */ interface Sign { /** * This init function used to Initialize environment, must be invoked before update and sign. - * + * @param priKey The prikey object. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @param priKey The prikey object. */ init(priKey : PriKey, callback : AsyncCallback) : void; init(priKey : PriKey) : Promise; /** * This function used to update data. - * + * @param data The data need to update. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @param data The data need to update. */ update(data : DataBlob, callback : AsyncCallback) : void; update(data : DataBlob) : Promise; /** * This function used to sign all data. - * + * @param data The data need to update. + * @returns The sign data. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @param data The data need to update. - * @return The sign data. */ sign(data : DataBlob, callback : AsyncCallback) : void; sign(data : DataBlob) : Promise; + + /** + * The sign algName. + * @type { string } + * @syscap SystemCapability.Security.CryptoFramework. + * @readonly + * @since 9 + */ readonly algName : string; } /** * The verify class - * * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 */ interface Verify { /** * This init function used to Initialize environment, must be invoked before update and verify. - * + * @param priKey The prikey object. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @param priKey The prikey object. */ init(pubKey : PubKey, callback : AsyncCallback) : void; init(pubKey : PubKey) : Promise; /** * This function used to update data. - * + * @param data The data need to update. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @param data The data need to update. */ update(data : DataBlob, callback : AsyncCallback) : void; update(data : DataBlob) : Promise; /** * This function used to sign all data. - * - * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' - * @since 9 * @param data The data need to update. * @param signatureData The sign data. - * @return true means verify success. + * @returns true means verify success. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 */ verify(data : DataBlob, signatureData : DataBlob, callback : AsyncCallback) : void; verify(data : DataBlob, signatureData : DataBlob) : Promise; + + /** + * Indicates the verify algorithm name. + * @type { string } + * @readonly + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ readonly algName : string; } /** * Provides the sign func. - * + * @param algName Indicates the sign algorithm name, include init detail params. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @param algName Indicates the sign algorithm name, include init detail params. */ function createSign(algName : string) : Sign; /** * Provides the verify func. - * + * @param algName Indicates the verify algorithm name, include init detail params. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @param algName Indicates the verify algorithm name, include init detail params. */ function createVerify(algName : string) : Verify; interface KeyAgreement { /** * Generate secret by init params. - * + * @returns The generated secret. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @return The generated secret. */ generateSecret(priKey : PriKey, pubKey : PubKey, callback : AsyncCallback) : void; generateSecret(priKey : PriKey, pubKey : PubKey) : Promise; /** * Indicates the algorithm name - * * @syscap SystemCapability.Security.CryptoFramework * @since 9 */ @@ -707,7 +731,6 @@ declare namespace cryptoFramework { * Provides the key agree func. * * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 * @param algName Indicates the key agreement algorithm name. */ @@ -716,207 +739,167 @@ declare namespace cryptoFramework { interface X509Cert { /** * Verify the X509 cert. - * + * @param key Indicates the cert chain validator data. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @param key Indicates the cert chain validator data. */ verify(key : PubKey, callback : AsyncCallback) : void; verify(key : PubKey) : Promise; /** * Get X509 cert encoded data. - * + * @returns Returns X509 cert encoded data. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @return Returns X509 cert encoded data. */ getEncoded(callback : AsyncCallback) : void; getEncoded() : Promise; /** * Get X509 cert public key. - * + * @returns Returns X509 cert pubKey. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @return Returns X509 cert pubKey. */ getPublicKey(callback : AsyncCallback) : void; getPublicKey() : Promise; /** * Check the X509 cert validity with date. - * + * @param date Indicates the cert date. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @param date Indicates the cert date. */ checkValidityWithDate(date: string, callback : AsyncCallback) : void; checkValidityWithDate(date: string) : Promise; /** * Get X509 cert version. - * + * @returns Returns X509 cert version. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @return Returns X509 cert version. */ getVersion() : number; /** * Get X509 cert serial number. - * + * @returns Returns X509 cert serial number. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @return Returns X509 cert serial number. */ getSerialNumber() : number; /** * Get X509 cert issuer name. - * + * @returns Returns X509 cert issuer name. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @return Returns X509 cert issuer name. */ getIssuerName() : DataBlob; /** * Get X509 cert subject name. - * + * @returns Returns X509 cert subject name. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @return Returns X509 cert subject name. */ getSubjectName() : DataBlob; /** * Get X509 cert not before time. - * + * @returns Returns X509 cert not before time. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @return Returns X509 cert not before time. */ getNotBeforeTime() : string; /** * Get X509 cert not after time. - * + * @returns Returns X509 cert not after time. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @return Returns X509 cert not after time. */ getNotAfterTime() : string; /** * Get X509 cert signature. - * + * @returns Returns X509 cert signature. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @return Returns X509 cert signature. */ getSignature() : DataBlob; /** * Get X509 cert signature's algorithm name. - * + * @returns Returns X509 cert signature's algorithm name. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @return Returns X509 cert signature's algorithm name. */ getSignatureAlgName() : string; /** * Get X509 cert signature's algorithm oid. - * + * @returns Returns X509 cert signature's algorithm oid. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @return Returns X509 cert signature's algorithm oid. */ getSignatureAlgOid() : string; /** * Get X509 cert signature's algorithm name. - * + * @returns Returns X509 cert signature's algorithm name. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @return Returns X509 cert signature's algorithm name. */ getSignatureAlgParams() : DataBlob; /** * Get X509 cert key usage. - * + * @returns Returns X509 cert key usage. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @return Returns X509 cert key usage. */ getKeyUsage() : DataBlob; /** * Get X509 cert extended key usage. - * + * @returns Returns X509 cert extended key usage. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @return Returns X509 cert extended key usage. */ getExtKeyUsage() : DataArray; /** * Get X509 cert basic constraints path len. - * + * @returns Returns X509 cert basic constraints path len. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @return Returns X509 cert basic constraints path len. */ getBasicConstraints() : number; /** * Get X509 cert subject alternative name. - * + * @returns Returns X509 cert subject alternative name. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @return Returns X509 cert subject alternative name. */ getSubjectAltNames() : DataArray; /** * Get X509 cert issuer alternative name. - * + * @returns Returns X509 cert issuer alternative name. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @return Returns X509 cert issuer alternative name. */ getIssuerAltNames() : DataArray; } /** * Provides the x509 cert func. - * + * @param inStream Indicates the input cert data. + * @returns Returns X509 cert instance. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @param inStream Indicates the input cert data. - * @return Returns X509 cert instance. */ function createX509Cert(inStream : EncodingBlob, callback : AsyncCallback) : void; function createX509Cert(inStream : EncodingBlob) : Promise; @@ -929,43 +912,35 @@ declare namespace cryptoFramework { interface X509CrlEntry { /** * Returns the ASN of this CRL entry 1 der coding form, i.e. internal sequence. - * + * @returns Returns EncodingBlob of crl entry. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @return Returns EncodingBlob of crl entry. */ getEncoded(callback : AsyncCallback) : void; getEncoded() : Promise; /** * Get the serial number from this x509crl entry. - * + * @returns Returns serial number of crl entry. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @return Returns serial number of crl entry. */ getSerialNumber() : number; /** * Get the issuer of the x509 certificate described by this entry. - * + * @returns Returns DataBlob of issuer. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @return Returns DataBlob of issuer. */ getCertIssuer(callback : AsyncCallback) : void; getCertIssuer() : Promise; /** * Get the revocation date from x509crl entry. - * + * @returns Returns string of revocation date. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @return Returns string of revocation date. */ getRevocationDate(callback : AsyncCallback) : void; getRevocationDate() : Promise; @@ -979,162 +954,132 @@ declare namespace cryptoFramework { interface X509Crl { /** * Check if the given certificate is on this CRL. - * + * @param X509Cert Input cert data. + * @returns Returns result of Check cert is revoked or not. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @param X509Cert Input cert data. - * @return Returns result of Check cert is revoked or not. */ isRevoked(cert : X509Cert, callback : AsyncCallback) : void; isRevoked(cert : X509Cert) : Promise; /** * Returns the type of this CRL. - * + * @returns Returns string of crl type. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @return Returns string of crl type. */ getType() : string; /** * Get the der coding format. - * + * @returns Returns EncodingBlob of crl. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @return Returns EncodingBlob of crl. */ getEncoded(callback : AsyncCallback) : void; getEncoded() : Promise; /** * Use the public key to verify the signature of CRL. - * + * @param PubKey Input public Key. + * @returns Returns verify result. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @param PubKey Input public Key. - * @return Returns verify result. */ verify(key : PubKey, callback : AsyncCallback) : void; verify(key : PubKey) : Promise; /** * Get version number from CRL. - * + * @returns Returns version of crl. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @return Returns version of crl. */ getVersion() : number; /** * Get the issuer name from CRL. Issuer means the entity that signs and publishes the CRL. - * + * @returns Returns issuer name of crl. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @return Returns issuer name of crl. */ getIssuerName() : DataBlob; /** * Get lastUpdate value from CRL. - * + * @returns Returns last update of crl. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @return Returns last update of crl. */ getLastUpdate() : string; /** * Get nextUpdate value from CRL. - * + * @returns Returns next update of crl. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @return Returns next update of crl. */ getNextUpdate() : string; /** * This method can be used to find CRL entries in indirect CRLs. - * + * @param serialNumber serial number of crl. + * @returns Returns next update of crl. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @param serialNumber serial number of crl. - * @return Returns next update of crl. */ getRevokedCert(serialNumber : number, callback : AsyncCallback) : void; getRevokedCert(serialNumber : number) : Promise; /** * This method can be used to find CRL entries in indirect cert. - * + * @param X509Cert Cert of x509. + * @returns Returns X509CrlEntry instance. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @param X509Cert Cert of x509. - * @return Returns X509CrlEntry instance. */ getRevokedCertWithCert(cert : X509Cert, callback : AsyncCallback) : void; getRevokedCertWithCert(cert : X509Cert) : Promise; /** * Get all entries in this CRL. - * + * @returns Returns Array of X509CrlEntry instance. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @return Returns Array of X509CrlEntry instance. */ getRevokedCerts(callback : AsyncCallback>) : void; getRevokedCerts() : Promise>; /** * Get the CRL information encoded by Der from this CRL. - * + * @returns Returns DataBlob of tbs info. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @return Returns DataBlob of tbs info. */ getTbsInfo(callback : AsyncCallback) : void; getTbsInfo() : Promise; /** * Get signature value from CRL. - * + * @returns Returns DataBlob of signature. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @return Returns DataBlob of signature. */ getSignature() : DataBlob; /** * Get the signature algorithm name of the CRL signature algorithm. - * + * @returns Returns string of signature algorithm name. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @return Returns string of signature algorithm name. */ getSignatureAlgName() : string; /** * Get the signature algorithm oid string from CRL. - * + * @returns Returns string of signature algorithm oid. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @return Returns string of signature algorithm oid. */ getSignatureAlgOid() : string; @@ -1142,21 +1087,18 @@ declare namespace cryptoFramework { * Get the der encoded signature algorithm parameters from the CRL signature algorithm. * * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @return Returns DataBlob of signature algorithm params. + * @returns Returns DataBlob of signature algorithm params. */ getSignatureAlgParams() : DataBlob; } /** * Provides the x509 CRL func. - * + * @param inStream Indicates the input CRL data. + * @returns Returns the x509 CRL instance. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @param inStream Indicates the input CRL data. - * @return Returns the x509 CRL instance. */ function createX509Crl(inStream : EncodingBlob, callback : AsyncCallback) : void; function createX509Crl(inStream : EncodingBlob) : Promise; @@ -1169,11 +1111,9 @@ declare namespace cryptoFramework { interface CertChainValidator { /** * Validate the cert chain. - * + * @param certChain Indicates the cert chain validator data. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @param certChain Indicates the cert chain validator data. */ validate(certChain : CertChainData, callback : AsyncCallback) : void; validate(certChain : CertChainData) : Promise; @@ -1182,12 +1122,10 @@ declare namespace cryptoFramework { /** * Provides the cert chain validator func. - * + * @param algorithm Indicates the cert chain validator type. + * @returns { CertChainValidator } the cert chain validator instance. * @syscap SystemCapability.Security.CryptoFramework - * @import import cryptoFramework from '@ohos.security.cryptoFramework' * @since 9 - * @param algorithm Indicates the cert chain validator type. - * @return Returns the cert chain validator instance. */ function createCertChainValidator(algorithm :string) : CertChainValidator; } diff --git a/api/@ohos.sensor.d.ts b/api/@ohos.sensor.d.ts index b7f99aab63ab014ad65eef2288c79f2ba2723d19..67a893093a5c896f6772a892036c50433780a176 100644 --- a/api/@ohos.sensor.d.ts +++ b/api/@ohos.sensor.d.ts @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { AsyncCallback, Callback } from "./basic"; /** @@ -19,7 +20,6 @@ import { AsyncCallback, Callback } from "./basic"; * * @since 8 * @syscap SystemCapability.Sensors.Sensor - * @import import sensor from '@ohos.sensor' */ declare namespace sensor { /** @@ -824,7 +824,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.ACCELEROMETER + * @useinstead sensor#event:SensorId.ACCELEROMETER */ function on(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback, options?: Options): void; @@ -837,7 +837,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.ACCELEROMETER_UNCALIBRATED + * @useinstead sensor#event:SensorId.ACCELEROMETER_UNCALIBRATED */ function on(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback, options?: Options): void; @@ -849,7 +849,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.AMBIENT_LIGHT + * @useinstead sensor#event:SensorId.AMBIENT_LIGHT */ function on(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback, options?: Options): void; @@ -861,7 +861,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.AMBIENT_TEMPERATURE + * @useinstead sensor#event:SensorId.AMBIENT_TEMPERATURE */ function on(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback, options?: Options): void; @@ -873,7 +873,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.BAROMETER + * @useinstead sensor#event:SensorId.BAROMETER */ function on(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback, options?: Options): void; @@ -885,7 +885,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.GRAVITY + * @useinstead sensor#event:SensorId.GRAVITY */ function on(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback, options?: Options): void; @@ -898,7 +898,7 @@ declare namespace sensor { * @permission ohos.permission.GYROSCOPE * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.GYROSCOPE + * @useinstead sensor#event:SensorId.GYROSCOPE */ function on(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback, options?: Options): void; @@ -911,7 +911,7 @@ declare namespace sensor { * @permission ohos.permission.GYROSCOPE * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.GYROSCOPE_UNCALIBRATED + * @useinstead sensor#event:SensorId.GYROSCOPE_UNCALIBRATED */ function on(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback, options?: Options): void; @@ -923,7 +923,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.HALL + * @useinstead sensor#event:SensorId.HALL */ function on(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback, options?: Options): void; @@ -936,7 +936,7 @@ declare namespace sensor { * @permission ohos.permission.HEALTH_DATA * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.HEART_RATE + * @useinstead sensor#event:SensorId.HEART_RATE */ function on(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback, options?: Options): void; @@ -948,7 +948,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.HUMIDITY + * @useinstead sensor#event:SensorId.HUMIDITY */ function on(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback, options?: Options): void; @@ -961,7 +961,7 @@ declare namespace sensor { * @permission ohos.permission.ACCELEROMETER * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.LINEAR_ACCELEROMETER + * @useinstead sensor#event:SensorId.LINEAR_ACCELEROMETER */ function on(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback, options?: Options): void; @@ -973,7 +973,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.MAGNETIC_FIELD + * @useinstead sensor#event:SensorId.MAGNETIC_FIELD */ function on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback, options?: Options): void; @@ -985,7 +985,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.MAGNETIC_FIELD_UNCALIBRATED + * @useinstead sensor#event:SensorId.MAGNETIC_FIELD_UNCALIBRATED */ function on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback, options?: Options): void; @@ -997,7 +997,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.ORIENTATION + * @useinstead sensor#event:SensorId.ORIENTATION */ function on(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback, options?: Options): void; @@ -1010,7 +1010,7 @@ declare namespace sensor { * @permission ohos.permission.ACTIVITY_MOTION * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.PEDOMETER + * @useinstead sensor#event:SensorId.PEDOMETER */ function on(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback, options?: Options): void; @@ -1023,7 +1023,7 @@ declare namespace sensor { * @permission ohos.permission.ACTIVITY_MOTION * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.PEDOMETER_DETECTION + * @useinstead sensor#event:SensorId.PEDOMETER_DETECTION */ function on(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback, options?: Options): void; @@ -1035,7 +1035,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.PROXIMITY + * @useinstead sensor#event:SensorId.PROXIMITY */ function on(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback, options?: Options): void; @@ -1047,7 +1047,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.ROTATION_VECTOR + * @useinstead sensor#event:SensorId.ROTATION_VECTOR */ function on(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback, options?: Options): void; @@ -1059,7 +1059,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.SIGNIFICANT_MOTION + * @useinstead sensor#event:SensorId.SIGNIFICANT_MOTION */ function on(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback, options?: Options): void; @@ -1071,7 +1071,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.WEAR_DETECTION + * @useinstead sensor#event:SensorId.WEAR_DETECTION */ function on(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback, options?: Options): void; @@ -1083,7 +1083,7 @@ declare namespace sensor { * @permission ohos.permission.ACCELEROMETER * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.ACCELEROMETER + * @useinstead sensor#event:SensorId.ACCELEROMETER */ function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback): void; @@ -1094,7 +1094,7 @@ declare namespace sensor { * @permission ohos.permission.ACCELEROMETER * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.ACCELEROMETER_UNCALIBRATED + * @useinstead sensor#event:SensorId.ACCELEROMETER_UNCALIBRATED */ function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback): void; @@ -1104,7 +1104,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.AMBIENT_LIGHT + * @useinstead sensor#event:SensorId.AMBIENT_LIGHT */ function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback): void; @@ -1114,7 +1114,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.AMBIENT_TEMPERATURE + * @useinstead sensor#event:SensorId.AMBIENT_TEMPERATURE */ function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback): void; @@ -1124,7 +1124,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.BAROMETER + * @useinstead sensor#event:SensorId.BAROMETER */ function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback): void; @@ -1134,7 +1134,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.GRAVITY + * @useinstead sensor#event:SensorId.GRAVITY */ function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback): void; @@ -1145,7 +1145,7 @@ declare namespace sensor { * @permission ohos.permission.GYROSCOPE * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.GYROSCOPE + * @useinstead sensor#event:SensorId.GYROSCOPE */ function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback): void; @@ -1156,7 +1156,7 @@ declare namespace sensor { * @permission ohos.permission.GYROSCOPE * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.GYROSCOPE_UNCALIBRATED + * @useinstead sensor#event:SensorId.GYROSCOPE_UNCALIBRATED */ function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback): void; @@ -1166,7 +1166,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.HALL + * @useinstead sensor#event:SensorId.HALL */ function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback): void; @@ -1177,7 +1177,7 @@ declare namespace sensor { * @permission ohos.permission.HEART_RATE * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.HEART_RATE + * @useinstead sensor#event:SensorId.HEART_RATE */ function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback): void; @@ -1187,7 +1187,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.HUMIDITY + * @useinstead sensor#event:SensorId.HUMIDITY */ function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback): void; @@ -1198,7 +1198,7 @@ declare namespace sensor { * @permission ohos.permission.ACCELERATION * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.LINEAR_ACCELEROMETER + * @useinstead sensor#event:SensorId.LINEAR_ACCELEROMETER */ function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback): void; @@ -1208,7 +1208,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.MAGNETIC_FIELD + * @useinstead sensor#event:SensorId.MAGNETIC_FIELD */ function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback): void; @@ -1218,7 +1218,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.MAGNETIC_FIELD_UNCALIBRATED + * @useinstead sensor#event:SensorId.MAGNETIC_FIELD_UNCALIBRATED */ function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback): void; @@ -1228,7 +1228,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.ORIENTATION + * @useinstead sensor#event:SensorId.ORIENTATION */ function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback): void; @@ -1239,7 +1239,7 @@ declare namespace sensor { * @permission ohos.permission.ACTIVITY_MOTION * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.PEDOMETER + * @useinstead sensor#event:SensorId.PEDOMETER */ function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback): void; @@ -1250,7 +1250,7 @@ declare namespace sensor { * @permission ohos.permission.ACTIVITY_MOTION * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.PEDOMETER_DETECTION + * @useinstead sensor#event:SensorId.PEDOMETER_DETECTION */ function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback): void; @@ -1260,7 +1260,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.PROXIMITY + * @useinstead sensor#event:SensorId.PROXIMITY */ function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback): void; @@ -1270,7 +1270,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.ROTATION_VECTOR + * @useinstead sensor#event:SensorId.ROTATION_VECTOR */ function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback): void; @@ -1280,7 +1280,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.SIGNIFICANT_MOTION + * @useinstead sensor#event:SensorId.SIGNIFICANT_MOTION */ function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback): void; @@ -1290,7 +1290,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.WEAR_DETECTION + * @useinstead sensor#event:SensorId.WEAR_DETECTION */ function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback): void; @@ -1301,7 +1301,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.ACCELEROMETER + * @useinstead sensor#event:SensorId.ACCELEROMETER */ function off(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback?: Callback): void; @@ -1312,7 +1312,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.ACCELEROMETER_UNCALIBRATED + * @useinstead sensor#event:SensorId.ACCELEROMETER_UNCALIBRATED */ function off(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback?: Callback): void; @@ -1323,7 +1323,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.AMBIENT_LIGHT + * @useinstead sensor#event:SensorId.AMBIENT_LIGHT */ function off(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback?: Callback): void; @@ -1333,7 +1333,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.AMBIENT_TEMPERATURE + * @useinstead sensor#event:SensorId.AMBIENT_TEMPERATURE */ function off(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback?: Callback): void; @@ -1343,7 +1343,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.BAROMETER + * @useinstead sensor#event:SensorId.BAROMETER */ function off(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback?: Callback): void; @@ -1353,7 +1353,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.GRAVITY + * @useinstead sensor#event:SensorId.GRAVITY */ function off(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback?: Callback): void; @@ -1364,7 +1364,7 @@ declare namespace sensor { * @permission ohos.permission.GYROSCOPE * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.GYROSCOPE + * @useinstead sensor#event:SensorId.GYROSCOPE */ function off(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback?: Callback): void; @@ -1375,7 +1375,7 @@ declare namespace sensor { * @permission ohos.permission.GYROSCOPE * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.GYROSCOPE_UNCALIBRATED + * @useinstead sensor#event:SensorId.GYROSCOPE_UNCALIBRATED */ function off(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback?: Callback): void; @@ -1385,7 +1385,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.HALL + * @useinstead sensor#event:SensorId.HALL */ function off(type: SensorType.SENSOR_TYPE_ID_HALL, callback?: Callback): void; @@ -1396,7 +1396,7 @@ declare namespace sensor { * @permission ohos.permission.HEALTH_DATA * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.HEART_RATE + * @useinstead sensor#event:SensorId.HEART_RATE */ function off(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback?: Callback): void; @@ -1406,7 +1406,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.HUMIDITY + * @useinstead sensor#event:SensorId.HUMIDITY */ function off(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback?: Callback): void; @@ -1417,7 +1417,7 @@ declare namespace sensor { * @permission ohos.permission.ACCELEROMETER * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.LINEAR_ACCELEROMETER + * @useinstead sensor#event:SensorId.LINEAR_ACCELEROMETER */ function off(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback?: Callback): void; @@ -1427,7 +1427,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.MAGNETIC_FIELD + * @useinstead sensor#event:SensorId.MAGNETIC_FIELD */ function off(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback?: Callback): void; @@ -1437,7 +1437,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.MAGNETIC_FIELD_UNCALIBRATED + * @useinstead sensor#event:SensorId.MAGNETIC_FIELD_UNCALIBRATED */ function off(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback?: Callback): void; @@ -1447,7 +1447,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.ORIENTATION + * @useinstead sensor#event:SensorId.ORIENTATION */ function off(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback?: Callback): void; @@ -1458,7 +1458,7 @@ declare namespace sensor { * @permission ohos.permission.ACTIVITY_MOTION * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.PEDOMETER + * @useinstead sensor#event:SensorId.PEDOMETER */ function off(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback?: Callback): void; @@ -1469,7 +1469,7 @@ declare namespace sensor { * @permission ohos.permission.ACTIVITY_MOTION * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.PEDOMETER_DETECTION + * @useinstead sensor#event:SensorId.PEDOMETER_DETECTION */ function off(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback?: Callback): void; @@ -1479,7 +1479,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.PROXIMITY + * @useinstead sensor#event:SensorId.PROXIMITY */ function off(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback?: Callback): void; @@ -1489,7 +1489,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.ROTATION_VECTOR + * @useinstead sensor#event:SensorId.ROTATION_VECTOR */ function off(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback?: Callback): void; @@ -1499,7 +1499,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.SIGNIFICANT_MOTION + * @useinstead sensor#event:SensorId.SIGNIFICANT_MOTION */ function off(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback?: Callback): void; @@ -1509,7 +1509,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId.WEAR_DETECTION + * @useinstead sensor#event:SensorId.WEAR_DETECTION */ function off(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback?: Callback): void; @@ -1525,8 +1525,8 @@ declare namespace sensor { hardwareVersion:string; /**< Sensor hardware version */ sensorId:number; /**< Sensor type ID, {@code SensorType} */ maxRange:number; /**< Maximum measurement range of the sensor */ - minSamplePeriod; /**< Minimum sample period allowed, in ns */ - maxSamplePeriod; /**< maximum sample period allowed, in ns */ + minSamplePeriod:number; /**< Minimum sample period allowed, in ns */ + maxSamplePeriod:number; /**< maximum sample period allowed, in ns */ precision:number; /**< Sensor accuracy */ power:number; /**< Sensor power */ } @@ -1589,11 +1589,11 @@ declare namespace sensor { * @param LocationOptions Indicates geographic location, {@code LocationOptions}. * @param timeMillis Indicates the time at which the magnetic declination is to be obtained, in milliseconds * since the Unix epoch. - * @return Returns the geomagnetic field data, {@code GeomagneticResponse}. + * @returns Returns the geomagnetic field data, {@code GeomagneticResponse}. * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.getGeomagneticInfo + * @useinstead sensor#getGeomagneticInfo */ function getGeomagneticField(locationOptions: LocationOptions, timeMillis: number, callback: AsyncCallback): void; function getGeomagneticField(locationOptions: LocationOptions, timeMillis: number): Promise; @@ -1618,11 +1618,11 @@ declare namespace sensor { * * @param seaPressure Indicates the sea level pressure, in hPa. * @param currentPressure Indicates the atmospheric pressure measured by the barometer, in hPa. - * @return Returns the altitude in meters at which the device is located. + * @returns Returns the altitude in meters at which the device is located. * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.getDeviceAltitude + * @useinstead sensor#getDeviceAltitude */ function getAltitude(seaPressure: number, currentPressure: number, callback: AsyncCallback): void; function getAltitude(seaPressure: number, currentPressure: number): Promise; @@ -1645,11 +1645,11 @@ declare namespace sensor { * Computes the geomagnetic inclination angle in radians from the inclination matrix. * * @param inclinationMatrix Indicates the inclination matrix. - * @return Returns the geomagnetic inclination angle in radians. + * @returns Returns the geomagnetic inclination angle in radians. * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.getInclination + * @useinstead sensor#getInclination */ function getGeomagneticDip(inclinationMatrix: Array, callback: AsyncCallback): void; function getGeomagneticDip(inclinationMatrix: Array): Promise; @@ -1672,11 +1672,11 @@ declare namespace sensor { * * @param currentRotationMatrix Indicates the current rotation matrix. * @param preRotationMatrix Indicates the current rotation matrix. - * @return Returns the array of number(z, x and y) in which the angle variety. + * @returns Returns the array of number(z, x and y) in which the angle variety. * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.getAngleVariation + * @useinstead sensor#getAngleVariation */ function getAngleModify(currentRotationMatrix: Array, preRotationMatrix: Array, callback: AsyncCallback>): void; @@ -1701,11 +1701,11 @@ declare namespace sensor { * Convert rotation vector to rotation matrix. * * @param rotationVector Indicates the rotation vector. - * @return Returns the rotation matrix. + * @returns Returns the rotation matrix. * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.getRotationMatrix + * @useinstead sensor#getRotationMatrix */ function createRotationMatrix(rotationVector: Array, callback: AsyncCallback>): void; function createRotationMatrix(rotationVector: Array): Promise>; @@ -1745,11 +1745,11 @@ declare namespace sensor { * Coordinate System * @param inRotationVector Indicates the rotation matrix to be transformed. * @param coordinates Indicates coordinate system guidance, {@code CoordinatesOptions}. - * @return Returns the transformed rotation matrix. + * @returns Returns the transformed rotation matrix. * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.transformRotationMatrix + * @useinstead sensor#transformRotationMatrix */ function transformCoordinateSystem(inRotationVector: Array, coordinates: CoordinatesOptions, callback: AsyncCallback>): void; @@ -1774,11 +1774,11 @@ declare namespace sensor { * convert a rotation vector to a normalized quaternion. * * @param rotationVector Indicates the rotation vector. - * @return Returns the normalized quaternion. + * @returns Returns the normalized quaternion. * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.getQuaternion + * @useinstead sensor#getQuaternion */ function createQuaternion(rotationVector: Array, callback: AsyncCallback>): void; function createQuaternion(rotationVector: Array): Promise>; @@ -1800,11 +1800,11 @@ declare namespace sensor { * Computes the device's orientation based on the rotation matrix. * * @param rotationMatrix Indicates the rotation matrix. - * @return Returns the array is the angle of rotation around the z, x, y axis. + * @returns Returns the array is the angle of rotation around the z, x, y axis. * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.getOrientation + * @useinstead sensor#getOrientation */ function getDirection(rotationMatrix: Array, callback: AsyncCallback>): void; function getDirection(rotationMatrix: Array): Promise>; @@ -1837,11 +1837,11 @@ declare namespace sensor { * * @param gravity Indicates the gravity vector. * @param geomagnetic Indicates the geomagnetic vector. - * @return Returns the rotation matrix, {@code RotationMatrixResponse}. + * @returns Returns the rotation matrix, {@code RotationMatrixResponse}. * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.getRotationMatrix + * @useinstead sensor#getRotationMatrix */ function createRotationMatrix(gravity: Array, geomagnetic: Array, callback: AsyncCallback): void; function createRotationMatrix(gravity: Array, geomagnetic: Array,): Promise; @@ -1874,7 +1874,7 @@ declare namespace sensor { * @syscap SystemCapability.Sensors.Sensor * @since 8 * @deprecated since 9 - * @useinstead ohos.sensor.SensorId + * @useinstead sensor.SensorId */ enum SensorType { SENSOR_TYPE_ID_ACCELEROMETER = 1, /**< Acceleration sensor */ diff --git a/api/@ohos.systemParameterV9.d.ts b/api/@ohos.systemParameterV9.d.ts index a32bcb4fb5a93f3714b1abb6fa9e184fd9f3c2dd..9d37d7f828e9cb6fede73078eefd74f7b6a4ba01 100755 --- a/api/@ohos.systemParameterV9.d.ts +++ b/api/@ohos.systemParameterV9.d.ts @@ -15,58 +15,6 @@ import { AsyncCallback, BusinessError } from './basic'; -/** - * Enumerates error code. - * - * @since 9 - */ -export enum SystemParameterErrorCode { - /** - * Input parameter is missing or invalid. - * - * @since 9 - */ - SYSPARAM_INVALID_INPUT = 401, - - /** - * System parameter can not be found.
          - * When getting system parameter values, if def value is specified, it will not return this error. - * - * @since 9 - */ - SYSPARAM_NOT_FOUND = 14700101, - - /** - * System parameter value is invalid.
          - * -

          When setting system parameters, the value length should not exceed 95 bytes.

          - * -

          And system parameter has three value types: string, integer and bool. - * if the value type is not matched, it will also return this error code.

          - * - * @since 9 - */ - SYSPARAM_INVALID_VALUE = 14700102, - - /** - * System permission operation permission denied.
          - *

          System parameter are system resources, each parameter is protected by DAC and MAC rules. - *

          Typical permission checking include:

          - * -

          systemapi: only system application can call system parameter related APIs

          - * -

          DAC: each system parameter has user and group owner with get, set permissions. - * Applications can only operate User/Group/Ownership matched system parameters.

          - * -

          MAC: each system parameter is also protected by SELinux labels.

          - * - * @since 9 - */ - SYSPARAM_PERMISSION_DENIED = 14700103, - - /** - * System internal error including out of memory, deadlock etc. - * - * @since 9 - */ - SYSPARAM_SYSTEM_ERROR = 14700104, -} - /** * The interface of system parameters class. * @@ -80,7 +28,7 @@ declare namespace systemParameterV9 { * * @param key Key of the system attribute. * @param def Default value. - * @return the value of the parameter. + * @returns the value of the parameter. * @throws {BusinessError} 401 - if type of key is not string or key is not specified. * @throws {BusinessError} 14700101 - if key is not found * @throws {BusinessError} 14700103 - if permission denied @@ -128,7 +76,7 @@ declare namespace systemParameterV9 { * @throws {BusinessError} 14700101 - if key is not found * @throws {BusinessError} 14700103 - if permission denied * @throws {BusinessError} 14700104 - if system internal error - * @return Promise, which is used to obtain the result asynchronously. + * @returns Promise, which is used to obtain the result asynchronously. * @syscap SystemCapability.Startup.SystemInfo * @since 9 */ @@ -168,7 +116,7 @@ declare namespace systemParameterV9 { * * @param key Key of the system attribute. * @param value Default value. - * @return Promise, which is used to obtain the result asynchronously. + * @returns Promise, which is used to obtain the result asynchronously. * @throws {BusinessError} 401 - if type of key is not string or key is not specified. * @throws {BusinessError} 14700102 - if value is invalid * @throws {BusinessError} 14700103 - if permission denied @@ -179,4 +127,4 @@ declare namespace systemParameterV9 { function set(key: string, value: string): Promise; } -export default systemParameter; +export default systemParameterV9; diff --git a/api/@ohos.systemparameter.d.ts b/api/@ohos.systemparameter.d.ts index 18f92152a4d997eada96721738cddebc8a02a620..93aa70a203d1fd3433e8ac06e9c18de4527bdd41 100644 --- a/api/@ohos.systemparameter.d.ts +++ b/api/@ohos.systemparameter.d.ts @@ -28,7 +28,7 @@ declare namespace systemParameter { * * @param key Key of the system attribute. * @param def Default value. - * @return if the parameter is empty or doesn't exist, empty string will be returned. + * @returns if the parameter is empty or doesn't exist, empty string will be returned. * @syscap SystemCapability.Startup.SystemInfo * @since 6 */ @@ -60,7 +60,7 @@ declare namespace systemParameter { * * @param key Key of the system attribute. * @param def Default value. - * @return Promise, which is used to obtain the result asynchronously. + * @returns Promise, which is used to obtain the result asynchronously. * @syscap SystemCapability.Startup.SystemInfo * @since 6 */ @@ -92,7 +92,7 @@ declare namespace systemParameter { * * @param key Key of the system attribute. * @param value Default value. - * @return Promise, which is used to obtain the result asynchronously. + * @returns Promise, which is used to obtain the result asynchronously. * @syscap SystemCapability.Startup.SystemInfo * @since 6 */ diff --git a/api/@ohos.telephony.call.d.ts b/api/@ohos.telephony.call.d.ts index a0a6b2abafeef8e2c88bb600337284ca92bd7a74..4a5bb01d2ffee37e95c3edb7fc75d60a42e64c89 100644 --- a/api/@ohos.telephony.call.d.ts +++ b/api/@ohos.telephony.call.d.ts @@ -154,6 +154,7 @@ declare namespace call { * Hangups the foreground call. * * @param callId Indicates the identifier of the call to hangup. + * @permission ohos.permission.ANSWER_CALL * @systemapi Hide this for inner system use. * @since 7 */ @@ -173,6 +174,7 @@ declare namespace call { * * @param callId Indicates the identifier of the call to reject. * @param options Indicates the text message to reject. + * @permission ohos.permission.ANSWER_CALL * @systemapi Hide this for inner system use. * @since 7 */ @@ -184,6 +186,7 @@ declare namespace call { * Rejects the incoming call without callId. * * @param options Indicates the text message to reject. + * @permission ohos.permission.ANSWER_CALL * @systemapi Hide this for inner system use. * @since 9 */ @@ -191,6 +194,7 @@ declare namespace call { function reject(options: RejectMessageOptions, callback: AsyncCallback): void; /** + * @permission ohos.permission.ANSWER_CALL * @systemapi Hide this for inner system use. * @since 7 */ @@ -198,6 +202,7 @@ declare namespace call { function holdCall(callId: number): Promise; /** + * @permission ohos.permission.ANSWER_CALL * @systemapi Hide this for inner system use. * @since 7 */ @@ -205,6 +210,7 @@ declare namespace call { function unHoldCall(callId: number): Promise; /** + * @permission ohos.permission.ANSWER_CALL * @systemapi Hide this for inner system use. * @since 7 */ @@ -240,6 +246,7 @@ declare namespace call { function getCallIdListForConference(callId: number): Promise>; /** + * @permission ohos.permission.GET_TELEPHONY_STATE * @systemapi Hide this for inner system use. * @since 7 */ @@ -247,6 +254,7 @@ declare namespace call { function getCallWaitingStatus(slotId: number): Promise; /** + * @permission ohos.permission.SET_TELEPHONY_STATE * @systemapi Hide this for inner system use. * @since 7 */ @@ -276,36 +284,42 @@ declare namespace call { function isInEmergencyCall(): Promise; /** + * @permission ohos.permission.SET_TELEPHONY_STATE * @systemapi Hide this for inner system use. * @since 7 */ function on(type: 'callDetailsChange', callback: Callback): void; /** + * @permission ohos.permission.SET_TELEPHONY_STATE * @systemapi Hide this for inner system use. * @since 7 */ function off(type: 'callDetailsChange', callback?: Callback): void; /** + * @permission ohos.permission.SET_TELEPHONY_STATE * @systemapi Hide this for inner system use. * @since 8 */ function on(type: 'callEventChange', callback: Callback): void; /** + * @permission ohos.permission.SET_TELEPHONY_STATE * @systemapi Hide this for inner system use. * @since 8 */ function off(type: 'callEventChange', callback?: Callback): void; /** + * @permission ohos.permission.SET_TELEPHONY_STATE * @systemapi Hide this for inner system use. * @since 8 */ function on(type: 'callDisconnectedCause', callback: Callback): void; /** + * @permission ohos.permission.SET_TELEPHONY_STATE * @systemapi Hide this for inner system use. * @since 8 */ @@ -316,19 +330,35 @@ declare namespace call { * * @param type Indicates the observer type. * @param callback Return the result of MMI code. + * @permission ohos.permission.SET_TELEPHONY_STATE + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 401 - Parameter error. + * @throws {BusinessError} 8300001 - Invalid parameter value. + * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. + * @throws {BusinessError} 8300003 - System internal error. + * @throws {BusinessError} 8300004 - Do not have sim card. + * @throws {BusinessError} 8300999 - Unknown error code. * @systemapi Hide this for inner system use. * @since 9 */ function on(type: 'mmiCodeResult', callback: Callback): void; - /** - * Unobserve the result of MMI code - * - * @param type Indicates the observer type. - * @param callback Return the result of MMI code. - * @systemapi Hide this for inner system use. - * @since 9 - */ + /** + * Unobserve the result of MMI code + * + * @param type Indicates the observer type. + * @param callback Return the result of MMI code. + * @permission ohos.permission.SET_TELEPHONY_STATE + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 401 - Parameter error. + * @throws {BusinessError} 8300001 - Invalid parameter value. + * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. + * @throws {BusinessError} 8300003 - System internal error. + * @throws {BusinessError} 8300004 - Do not have sim card. + * @throws {BusinessError} 8300999 - Unknown error code. + * @systemapi Hide this for inner system use. + * @since 9 + */ function off(type: 'mmiCodeResult', callback?: Callback): void; /** @@ -346,6 +376,7 @@ declare namespace call { function separateConference(callId: number): Promise; /** + * @permission ohos.permission.GET_TELEPHONY_STATE * @systemapi Hide this for inner system use. * @since 8 */ @@ -353,6 +384,7 @@ declare namespace call { function getCallRestrictionStatus(slotId: number, type: CallRestrictionType): Promise; /** + * @permission ohos.permission.SET_TELEPHONY_STATE * @systemapi Hide this for inner system use. * @since 8 */ @@ -360,6 +392,7 @@ declare namespace call { function setCallRestriction(slotId: number, info: CallRestrictionInfo): Promise; /** + * @permission ohos.permission.GET_TELEPHONY_STATE * @systemapi Hide this for inner system use. * @since 8 */ @@ -367,6 +400,7 @@ declare namespace call { function getCallTransferInfo(slotId: number, type: CallTransferType): Promise; /** + * @permission ohos.permission.SET_TELEPHONY_STATE * @systemapi Hide this for inner system use. * @since 8 */ @@ -432,6 +466,7 @@ declare namespace call { function updateImsCallMode(callId: number, mode: ImsCallMode): Promise; /** + * @permission ohos.permission.SET_TELEPHONY_STATE * @systemapi Hide this for inner system use. * @since 8 */ @@ -439,6 +474,7 @@ declare namespace call { function enableImsSwitch(slotId: number): Promise; /** + * @permission ohos.permission.SET_TELEPHONY_STATE * @systemapi Hide this for inner system use. * @since 8 */ @@ -809,4 +845,4 @@ declare namespace call { } } -export default call; \ No newline at end of file +export default call; diff --git a/api/@ohos.telephony.data.d.ts b/api/@ohos.telephony.data.d.ts index 1ca3ce823f77aed38d4cfc72243670bd0c3022db..a562d690804057646804409fa2c69881e6cd3176 100644 --- a/api/@ohos.telephony.data.d.ts +++ b/api/@ohos.telephony.data.d.ts @@ -26,7 +26,6 @@ declare namespace data { * Checks whether cellular data services are enabled. * * @return Returns {@code true} if cellular data services are enabled; returns {@code false} otherwise. - * @permission ohos.permission.GET_NETWORK_INFO */ function getDefaultCellularDataSlotId(callback: AsyncCallback): void; function getDefaultCellularDataSlotId(): Promise; @@ -34,10 +33,7 @@ declare namespace data { /** * Checks whether cellular data services are enabled. * - *

          Requires Permission: {@code ohos.permission.GET_NETWORK_INFO}. - * * @return Returns default cellular data slot id. - * @permission ohos.permission.GET_NETWORK_INFO * @since 9 */ function getDefaultCellularDataSlotIdSync(): number; @@ -199,4 +195,4 @@ declare namespace data { } } -export default data; \ No newline at end of file +export default data; diff --git a/api/@ohos.telephony.radio.d.ts b/api/@ohos.telephony.radio.d.ts index 4886f4aa2c83e2c853a7bb57198cc46771d4aa7e..e5cc3b93fc75eb797cc8f2f30b31b8a204422973 100644 --- a/api/@ohos.telephony.radio.d.ts +++ b/api/@ohos.telephony.radio.d.ts @@ -13,7 +13,7 @@ * limitations under the License. */ -import {AsyncCallback} from "./basic"; +import {AsyncCallback, Callback} from "./basic"; /** * Provides interfaces for applications to obtain the network state, cell information, signal information, @@ -67,6 +67,7 @@ declare namespace radio { /** * Proactively requests to update location information. * + * @permission ohos.permission.LOCATION * @param { number } [ slotId ] - indicates the card slot index number. * @param { AsyncCallback } callback - the callback of sendUpdateCellLocationRequest. * @systemapi @@ -78,6 +79,7 @@ declare namespace radio { /** * Proactively requests to update location information. * + * @permission ohos.permission.LOCATION * @param { number } [ slotId ] - indicates the card slot index number. * @returns { Promise } the promise returned by the function. * @systemapi @@ -305,6 +307,13 @@ declare namespace radio { * @param imsType Indicates the ims service type of the {@link ImsServiceType}. * @param callback including an instance of the {@link ImsRegInfo} class. * @permission ohos.permission.GET_TELEPHONY_STATE + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 401 - Parameter error. + * @throws {BusinessError} 8300001 - Invalid parameter value. + * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. + * @throws {BusinessError} 8300003 - System internal error. + * @throws {BusinessError} 8300004 - Do not have sim card. + * @throws {BusinessError} 8300999 - Unknown error code. * @systemapi Hide this for inner system use. * @since 9 */ @@ -320,6 +329,13 @@ declare namespace radio { * @param imsType Indicates the ims service type of the {@link ImsServiceType}. * @param callback including an instance of the {@link ImsRegInfo} class. * @permission ohos.permission.GET_TELEPHONY_STATE + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 401 - Parameter error. + * @throws {BusinessError} 8300001 - Invalid parameter value. + * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. + * @throws {BusinessError} 8300003 - System internal error. + * @throws {BusinessError} 8300004 - Do not have sim card. + * @throws {BusinessError} 8300999 - Unknown error code. * @systemapi Hide this for inner system use. * @since 9 */ @@ -328,6 +344,13 @@ declare namespace radio { /** * @permission ohos.permission.GET_TELEPHONY_STATE + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 401 - Parameter error. + * @throws {BusinessError} 8300001 - Invalid parameter value. + * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. + * @throws {BusinessError} 8300003 - System internal error. + * @throws {BusinessError} 8300004 - Do not have sim card. + * @throws {BusinessError} 8300999 - Unknown error code. * @systemapi Hide this for inner system use. * @since 9 */ @@ -835,7 +858,7 @@ declare namespace radio { IMS_UNREGISTERED, IMS_REGISTERED, } - + /** * @systemapi Hide this for inner system use. * @since 9 @@ -846,7 +869,7 @@ declare namespace radio { REGISTRATION_TECH_IWLAN, REGISTRATION_TECH_NR, } - + /** * @systemapi Hide this for inner system use. * @since 9 @@ -855,7 +878,7 @@ declare namespace radio { imsRegState: ImsRegState; imsRegTech: ImsRegTech; } - + /** * @systemapi Hide this for inner system use. * @since 9 diff --git a/api/@ohos.telephony.sim.d.ts b/api/@ohos.telephony.sim.d.ts index 7e3d87ff684255067e2e99fea96f472741cf0da1..0b269cb7ea9b20b97147d1b4647c38bf6611c96a 100644 --- a/api/@ohos.telephony.sim.d.ts +++ b/api/@ohos.telephony.sim.d.ts @@ -399,6 +399,7 @@ declare namespace sim { function updateIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo): Promise; /** + * @permission ohos.permission.GET_TELEPHONY_STATE * @systemapi Hide this for inner system use. * @since 8 */ @@ -434,6 +435,14 @@ declare namespace sim { * * @param slotId Indicates the card slot index number, * ranging from 0 to the maximum card slot index number supported by the device. + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 401 - Parameter error. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 8300001 - Invalid parameter value. + * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. + * @throws {BusinessError} 8300003 - System internal error. + * @throws {BusinessError} 8300004 - Do not have sim card. + * @throws {BusinessError} 8300999 - Unknown error code. * @return Returns the opkey; returns an empty string if no SIM card is inserted or * no opkey matched. * @since 9 @@ -441,17 +450,25 @@ declare namespace sim { function getOpKey(slotId: number, callback: AsyncCallback): void; function getOpKey(slotId: number): Promise; - /** - * Obtains the opname of the SIM card in a specified slot. - * - * @param slotId Indicates the card slot index number, - * ranging from 0 to the maximum card slot index number supported by the device. - * @return Returns the opname; returns an empty string if no SIM card is inserted or - * no opname matched. - * @since 9 - */ - function getOpName(slotId: number, callback: AsyncCallback): void; - function getOpName(slotId: number): Promise; + /** + * Obtains the opname of the SIM card in a specified slot. + * + * @param slotId Indicates the card slot index number, + * ranging from 0 to the maximum card slot index number supported by the device. + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 401 - Parameter error. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 8300001 - Invalid parameter value. + * @throws {BusinessError} 8300002 - Operation failed. Cannot connect to service. + * @throws {BusinessError} 8300003 - System internal error. + * @throws {BusinessError} 8300004 - Do not have sim card. + * @throws {BusinessError} 8300999 - Unknown error code. + * @return Returns the opname; returns an empty string if no SIM card is inserted or + * no opname matched. + * @since 9 + */ + function getOpName(slotId: number, callback: AsyncCallback): void; + function getOpName(slotId: number): Promise; /** * @systemapi Hide this for inner system use. diff --git a/api/@ohos.thermal.d.ts b/api/@ohos.thermal.d.ts index eb80bfa5f9ba464d9a2273216255a2e2307ecd13..0be0b69dd0628e08eba384db687d5dc394c189e4 100644 --- a/api/@ohos.thermal.d.ts +++ b/api/@ohos.thermal.d.ts @@ -13,13 +13,13 @@ * limitations under the License. */ -import { AsyncCallback, Callback } from './basic'; +import {AsyncCallback, BusinessError, Callback} from './basic'; /** - * Provides thermal level-related callback and query APIs to obtain the information required for + * Provides thermal level-related callback and query APIs to obtain the information required for * temperature control. The APIs are as follows: - * {@link subscribeThermalLevel}: subscribes to callbacks of thermal level changes. - * {@link getThermalLevel}: obtains the thermal level of the system in real time. + * {@link registerThermalLevelCallback}: subscribes to callbacks of thermal level changes. + * {@link getLevel}: obtains the thermal level of the system in real time. * * @syscap SystemCapability.PowerManager.ThermalManager * @since 8 @@ -44,50 +44,85 @@ declare namespace thermal { */ WARM = 2, /** - * The device is heating up. You need to stop all imperceptible services and downgrade + * The device is heating up. You need to stop all imperceptible services and downgrade * or reduce the load of other services. */ HOT = 3, /** - * The device is overheated. You need to stop all imperceptible services and downgrade + * The device is overheated. You need to stop all imperceptible services and downgrade * or reduce the load of major services. */ OVERHEATED = 4, /** - * The device is overheated and is about to enter the emergency state. You need to stop + * The device is overheated and is about to enter the emergency state. You need to stop * all imperceptible services and downgrade major services to the maximum extent. */ WARNING = 5, /** - * The device has entered the emergency state. You need to stop all services except those + * The device has entered the emergency state. You need to stop all services except those * for the emergency help purposes. */ EMERGENCY = 6, } + /** * Subscribes to callbacks of thermal level changes. * * @param callback Callback of thermal level changes. - * @return Returns the thermal level. + * @returns Returns the thermal level. * @since 8 + * @deprecated since 9 + * @useinstead {@link thermal#registerThermalLevelCallback} */ function subscribeThermalLevel(callback: AsyncCallback): void; + /** + * Registers to callbacks of thermal level changes. + * + * @param {Callback} callback Callback of thermal level changes. + * @throws {BusinessError} 401 - If callback is not valid. + * @throws {BusinessError} 4800101 If connecting to the service failed. + * @since 9 + */ + function registerThermalLevelCallback(callback: Callback): void; + /** * Unsubscribes from the callbacks of thermal level changes. * * @param callback Callback of thermal level changes. - * @since 8 + * @deprecated since 9 + * @useinstead {@link thermal#unregisterThermalLevelCallback} */ function unsubscribeThermalLevel(callback?: AsyncCallback): void; + /** + * Unregisters from the callbacks of thermal level changes. + * + * @param {Callback} callback Callback of thermal level changes. + * @throws {BusinessError} 401 - If callback is not valid. + * @throws {BusinessError} 4800101 If connecting to the service failed. + * @since 9 + */ + function unregisterThermalLevelCallback(callback?: Callback): void; + /** * Obtains the current thermal level. * - * @return Returns the thermal level. + * @returns Returns the thermal level. * @since 8 + * @deprecated since 9 + * @useinstead {@link thermal#getLevel} */ function getThermalLevel(): ThermalLevel; + + /** + * Obtains the current thermal level. + * + * @returns {ThermalLevel} The thermal level. + * @throws {BusinessError} 4800101 If connecting to the service failed. + * @since 9 + */ + function getLevel(): ThermalLevel; } export default thermal; diff --git a/api/@ohos.uitest.d.ts b/api/@ohos.uitest.d.ts index eeb34b69b9c969162092a90b60b76e664fcae2fc..e694beb9fb326b2c706861ebee072abf555a87c6 100644 --- a/api/@ohos.uitest.d.ts +++ b/api/@ohos.uitest.d.ts @@ -63,7 +63,7 @@ declare class By { * @syscap SystemCapability.Test.UiTest * @param txt The text value. * @param pattern The {@link MatchPattern} of the text value,default to {@link MatchPattern.EQUALS} - * @return Returns this {@link By} object. + * @returns this {@link By} object. * @since 8 * @deprecated since 9 * @useinstead ohos.uitest.On#text @@ -75,7 +75,7 @@ declare class By { * Specifies the inspector key of the target UiComponent. * @syscap SystemCapability.Test.UiTest * @param key The inspectorKey value. - * @return Returns this {@link By} object. + * @returns this {@link By} object. * @since 8 * @deprecated since 9 * @useinstead ohos.uitest.On#id @@ -87,7 +87,7 @@ declare class By { * Specifies the id of the target UiComponent. * @syscap SystemCapability.Test.UiTest * @param id The id value. - * @return Returns this {@link By} object. + * @returns this {@link By} object. * @since 8 * @deprecated since 9 * @test @@ -98,7 +98,7 @@ declare class By { * Specifies the type of the target UiComponent. * @syscap SystemCapability.Test.UiTest * @param tp The type value. - * @return Returns this {@link By} object. + * @returns this {@link By} object. * @since 8 * @deprecated since 9 * @useinstead ohos.uitest.On#type @@ -110,7 +110,7 @@ declare class By { * Specifies the clickable status of the target UiComponent. * @syscap SystemCapability.Test.UiTest * @param b The clickable status,default to true. - * @return Returns this {@link By} object. + * @returns this {@link By} object. * @since 8 * @deprecated since 9 * @useinstead ohos.uitest.On#clickable @@ -122,7 +122,7 @@ declare class By { * Specifies the scrollable status of the target UiComponent. * @syscap SystemCapability.Test.UiTest * @param b The scrollable status,default to true. - * @return Returns this {@link By} object. + * @returns this {@link By} object. * @since 8 * @deprecated since 9 * @useinstead ohos.uitest.On#scrollable @@ -134,7 +134,7 @@ declare class By { * Specifies the enabled status of the target UiComponent. * @syscap SystemCapability.Test.UiTest * @param b The enabled status,default to true. - * @return Returns this {@link By} object. + * @returns this {@link By} object. * @since 8 * @deprecated since 9 * @useinstead ohos.uitest.On#enabled @@ -146,7 +146,7 @@ declare class By { * Specifies the focused status of the target UiComponent. * @syscap SystemCapability.Test.UiTest * @param b The focused status,default to true. - * @return Returns this {@link By} object. + * @returns this {@link By} object. * @since 8 * @deprecated since 9 * @useinstead ohos.uitest.On#focused @@ -158,7 +158,7 @@ declare class By { * Specifies the selected status of the target UiComponent. * @syscap SystemCapability.Test.UiTest * @param b The selected status,default to true. - * @return Returns this {@link By} object. + * @returns this {@link By} object. * @since 8 * @deprecated since 9 * @useinstead ohos.uitest.On#selected @@ -171,7 +171,7 @@ declare class By { * object,used to locate UiComponent relatively. * @syscap SystemCapability.Test.UiTest * @param by Describes the attribute requirements of UiComponent which the target one is in front of. - * @return Returns this {@link By} object. + * @returns this {@link By} object. * @since 8 * @deprecated since 9 * @useinstead {@link On.isBefore} @@ -184,7 +184,7 @@ declare class By { * object,used to locate UiComponent relatively. * @syscap SystemCapability.Test.UiTest * @param by Describes the attribute requirements of UiComponent which the target one is in back of. - * @return Returns this {@link By} object. + * @returns this {@link By} object. * @since 8 * @deprecated since 9 * @useinstead {@link On.isAfter} @@ -345,7 +345,7 @@ declare class UiComponent { * Scroll on this {@link UiComponent}to find matched {@link UiComponent},applicable to scrollable one. * @syscap SystemCapability.Test.UiTest * @param by The attribute requirements of the target {@link UiComponent}. - * @return the found result,or undefined if not found. + * @returns the found result,or undefined if not found. * @since 8 * @deprecated since 9 * @useinstead {@link Component.scrollSearch} @@ -576,10 +576,10 @@ declare interface Rect { * @since 9 */ declare interface WindowFilter { - readonly bundleName?: string; - readonly title?: string; - readonly focused?: boolean; - readonly actived?: boolean; + bundleName?: string; + title?: string; + focused?: boolean; + actived?: boolean; } /** @@ -594,7 +594,7 @@ declare class On { * @syscap SystemCapability.Test.UiTest * @param txt The text value. * @param pattern The {@link MatchPattern} of the text value, default to {@link MatchPattern.EQUALS} - * @return Returns this {@link On} object. + * @returns this {@link On} object. * @throws {BusinessError} 401 - if the input parameters are invalid. * @since 9 * @test @@ -605,7 +605,7 @@ declare class On { * Specifies the id of the target Component. * @syscap SystemCapability.Test.UiTest * @param id The id value. - * @return Returns this {@link On} object. + * @returns this {@link On} object. * @throws {BusinessError} 401 - if the input parameters are invalid. * @since 9 * @test @@ -616,7 +616,7 @@ declare class On { * Specifies the type of the target Component. * @syscap SystemCapability.Test.UiTest * @param tp The type value. - * @return Returns this {@link On} object. + * @returns this {@link On} object. * @throws {BusinessError} 401 - if the input parameters are invalid. * @since 9 * @test @@ -627,7 +627,7 @@ declare class On { * Specifies the clickable status of the target Component. * @syscap SystemCapability.Test.UiTest * @param b The clickable status,default to true. - * @return Returns this {@link On} object. + * @returns this {@link On} object. * @throws {BusinessError} 401 - if the input parameters are invalid. * @since 9 * @test @@ -638,7 +638,7 @@ declare class On { * Specifies the longClickable status of the target Component. * @syscap SystemCapability.Test.UiTest * @param b The clickable status,default to true. - * @return Returns this {@link On} object. + * @returns this {@link On} object. * @throws {BusinessError} 401 - if the input parameters are invalid. * @since 9 * @test @@ -649,7 +649,7 @@ declare class On { * Specifies the scrollable status of the target Component. * @syscap SystemCapability.Test.UiTest * @param b The scrollable status,default to true. - * @return Returns this {@link On} object. + * @returns this {@link On} object. * @throws {BusinessError} 401 - if the input parameters are invalid. * @since 9 * @test @@ -660,7 +660,7 @@ declare class On { * Specifies the enabled status of the target Component. * @syscap SystemCapability.Test.UiTest * @param b The enabled status,default to true. - * @return Returns this {@link On} object. + * @returns this {@link On} object. * @throws {BusinessError} 401 - if the input parameters are invalid. * @since 9 * @test @@ -671,7 +671,7 @@ declare class On { * Specifies the focused status of the target Component. * @syscap SystemCapability.Test.UiTest * @param b The focused status,default to true. - * @return Returns this {@link On} object. + * @returns this {@link On} object. * @throws {BusinessError} 401 - if the input parameters are invalid. * @since 9 * @test @@ -682,7 +682,7 @@ declare class On { * Specifies the selected status of the target Component. * @syscap SystemCapability.Test.UiTest * @param b The selected status,default to true. - * @return Returns this {@link On} object. + * @returns this {@link On} object. * @throws {BusinessError} 401 - if the input parameters are invalid. * @since 9 * @test @@ -693,7 +693,7 @@ declare class On { * Specifies the checked status of the target Component. * @syscap SystemCapability.Test.UiTest * @param b The checked status,default to false. - * @return Returns this {@link On} object. + * @returns this {@link On} object. * @throws {BusinessError} 401 - if the input parameters are invalid. * @since 9 * @test @@ -704,7 +704,7 @@ declare class On { * Specifies the checkable status of the target Component. * @syscap SystemCapability.Test.UiTest * @param b The checkable status,default to false. - * @return Returns this {@link On} object. + * @returns this {@link On} object. * @throws {BusinessError} 401 - if the input parameters are invalid. * @since 9 * @test @@ -716,7 +716,7 @@ declare class On { * object,used to locate Component relatively. * @syscap SystemCapability.Test.UiTest * @param on Describes the attribute requirements of Component which the target one is in front of. - * @return Returns this {@link On} object. + * @returns this {@link On} object. * @throws {BusinessError} 401 - if the input parameters are invalid. * @since 9 * @test @@ -728,7 +728,7 @@ declare class On { * object,used to locate Component relatively. * @syscap SystemCapability.Test.UiTest * @param on Describes the attribute requirements of Component which the target one is in back of. - * @return Returns this {@link On} object. + * @returns this {@link On} object. * @throws {BusinessError} 401 - if the input parameters are invalid. * @since 9 * @test @@ -944,7 +944,7 @@ declare class Component { * Scroll on this {@link Component}to find matched {@link Component},applicable to scrollable one. * @syscap SystemCapability.Test.UiTest * @param on The attribute requirements of the target {@link Component}. - * @return the found result,or undefined if not found. + * @returns the found result,or undefined if not found. * @throws {BusinessError} 401 - if the input parameters are invalid. * @throws {BusinessError} 17000002 - if the async function was not called with await. * @throws {BusinessError} 17000004 - if the component is invisible or destroyed. @@ -956,7 +956,7 @@ declare class Component { /** * Get the bounds rect of this {@link Component}. * @syscap SystemCapability.Test.UiTest - * @return the bounds rect object. + * @returns the bounds rect object. * @throws {BusinessError} 17000002 - if the async function was not called with await. * @throws {BusinessError} 17000004 - if the component is invisible or destroyed. * @since 9 @@ -967,7 +967,7 @@ declare class Component { /** * Get the boundsCenter of this {@link Component}. * @syscap SystemCapability.Test.UiTest - * @return the boundsCenter object. + * @returns the boundsCenter object. * @throws {BusinessError} 17000002 - if the async function was not called with await. * @throws {BusinessError} 17000004 - if the component is invisible or destroyed. * @since 9 @@ -1345,7 +1345,7 @@ declare class UiWindow { /** * Get the bounds rect of this {@link UiWindow}. * @syscap SystemCapability.Test.UiTest - * @return the bounds rect object. + * @returns the bounds rect object. * @throws {BusinessError} 17000002 - if the async function was not called with await. * @throws {BusinessError} 17000004 - if the window is invisible or destroyed. * @since 9 diff --git a/api/@ohos.update.d.ts b/api/@ohos.update.d.ts index 53df49e0010a0fc15998690c5f366c69d4ce0f97..b4d5fb04fc219ce21db1681916702b0f0a4822a0 100644 --- a/api/@ohos.update.d.ts +++ b/api/@ohos.update.d.ts @@ -27,7 +27,9 @@ declare namespace update { * Get online update handler for the calling device. * * @param upgradeInfo indicates client app and business type - * @return online update handler to perform online update + * @returns online update handler to perform online update. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 11500104 - IPC error. * @since 9 */ function getOnlineUpdater(upgradeInfo: UpgradeInfo): Updater; @@ -35,7 +37,9 @@ declare namespace update { /** * Get restore handler. * - * @return restore handler to perform factory reset + * @returns restore handler to perform factory reset. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 11500104 - IPC error. * @since 9 */ function getRestorer(): Restorer; @@ -43,7 +47,9 @@ declare namespace update { /** * Get local update handler. * - * @return local update handler to perform local update + * @returns local update handler to perform local update. + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 11500104 - IPC error. * @since 9 */ function getLocalUpdater(): LocalUpdater; @@ -60,6 +66,8 @@ declare namespace update { * Check new version. * * @permission ohos.permission.UPDATE_SYSTEM + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 11500104 - IPC error. * @since 9 */ checkNewVersion(callback: AsyncCallback): void; @@ -69,6 +77,8 @@ declare namespace update { * Get new version. * * @permission ohos.permission.UPDATE_SYSTEM + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 11500104 - IPC error. * @since 9 */ getNewVersionInfo(callback: AsyncCallback): void; @@ -78,6 +88,9 @@ declare namespace update { * Get new version description. * * @permission ohos.permission.UPDATE_SYSTEM + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 11500104 - IPC error. * @since 9 */ getNewVersionDescription(versionDigestInfo: VersionDigestInfo, descriptionOptions: DescriptionOptions, callback: AsyncCallback>): void; @@ -87,6 +100,8 @@ declare namespace update { * Get current version. * * @permission ohos.permission.UPDATE_SYSTEM + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 11500104 - IPC error. * @since 9 */ getCurrentVersionInfo(callback: AsyncCallback): void; @@ -96,6 +111,9 @@ declare namespace update { * Get current version description. * * @permission ohos.permission.UPDATE_SYSTEM + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 11500104 - IPC error. * @since 9 */ getCurrentVersionDescription(descriptionOptions: DescriptionOptions, callback: AsyncCallback>): void; @@ -105,6 +123,8 @@ declare namespace update { * Get task info. * * @permission ohos.permission.UPDATE_SYSTEM + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 11500104 - IPC error. * @since 9 */ getTaskInfo(callback: AsyncCallback): void; @@ -115,6 +135,9 @@ declare namespace update { * apps should listen to task update event * * @permission ohos.permission.UPDATE_SYSTEM + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 11500104 - IPC error. * @since 9 */ download(versionDigestInfo: VersionDigestInfo, downloadOptions: DownloadOptions, callback: AsyncCallback): void; @@ -125,6 +148,9 @@ declare namespace update { * apps should listen to task update event * * @permission ohos.permission.UPDATE_SYSTEM + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 11500104 - IPC error. * @since 9 */ resumeDownload(versionDigestInfo: VersionDigestInfo, resumeDownloadOptions: ResumeDownloadOptions, callback: AsyncCallback): void; @@ -135,6 +161,9 @@ declare namespace update { * apps should listen to task update event * * @permission ohos.permission.UPDATE_SYSTEM + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 11500104 - IPC error. * @since 9 */ pauseDownload(versionDigestInfo: VersionDigestInfo, pauseDownloadOptions: PauseDownloadOptions, callback: AsyncCallback): void; @@ -145,6 +174,9 @@ declare namespace update { * apps should listen to task update event * * @permission ohos.permission.UPDATE_SYSTEM + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 11500104 - IPC error. * @since 9 */ upgrade(versionDigestInfo: VersionDigestInfo, upgradeOptions: UpgradeOptions, callback: AsyncCallback): void; @@ -154,6 +186,9 @@ declare namespace update { * clear error during upgrade. * * @permission ohos.permission.UPDATE_SYSTEM + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 11500104 - IPC error. * @since 9 */ clearError(versionDigestInfo: VersionDigestInfo, clearOptions: ClearOptions, callback: AsyncCallback): void; @@ -163,6 +198,8 @@ declare namespace update { * Get current upgrade policy. * * @permission ohos.permission.UPDATE_SYSTEM + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 11500104 - IPC error. * @since 9 */ getUpgradePolicy(callback: AsyncCallback): void; @@ -172,6 +209,8 @@ declare namespace update { * Set upgrade policy. * * @permission ohos.permission.UPDATE_SYSTEM + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 11500104 - IPC error. * @since 9 */ setUpgradePolicy(policy: UpgradePolicy, callback: AsyncCallback): void; @@ -181,6 +220,8 @@ declare namespace update { * terminate upgrade task. * * @permission ohos.permission.UPDATE_SYSTEM + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 11500104 - IPC error. * @since 9 */ terminateUpgrade(callback: AsyncCallback): void; @@ -189,6 +230,9 @@ declare namespace update { /** * Subscribe task update events * + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 11500104 - IPC error. * @since 9 */ on(eventClassifyInfo: EventClassifyInfo, taskCallback: UpgradeTaskCallback): void; @@ -196,6 +240,9 @@ declare namespace update { /** * Unsubscribe task update events * + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 11500104 - IPC error. * @since 9 */ off(eventClassifyInfo: EventClassifyInfo, taskCallback?: UpgradeTaskCallback): void; @@ -213,6 +260,8 @@ declare namespace update { * Reboot and clean user data. * * @permission ohos.permission.FACTORY_RESET + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 11500104 - IPC error. * @since 9 */ factoryReset(callback: AsyncCallback): void; @@ -231,6 +280,9 @@ declare namespace update { * Verify local update package. * * @permission ohos.permission.UPDATE_SYSTEM + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 11500104 - IPC error. * @since 9 */ verifyUpgradePackage(upgradeFile: UpgradeFile, certsFile: string, callback: AsyncCallback): void; @@ -241,6 +293,9 @@ declare namespace update { * apps should listen to task update event * * @permission ohos.permission.UPDATE_SYSTEM + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 11500104 - IPC error. * @since 9 */ applyNewVersion(upgradeFiles: Array, callback: AsyncCallback): void; @@ -249,6 +304,8 @@ declare namespace update { /** * Subscribe task update events * + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 11500104 - IPC error. * @since 9 */ on(eventClassifyInfo: EventClassifyInfo, taskCallback: UpgradeTaskCallback): void; @@ -256,6 +313,9 @@ declare namespace update { /** * Unsubscribe task update events * + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 11500104 - IPC error. * @since 9 */ off(eventClassifyInfo: EventClassifyInfo, taskCallback?: UpgradeTaskCallback): void; diff --git a/api/@ohos.uri.d.ts b/api/@ohos.uri.d.ts index 12b6b2230612efcc9d18be077fbbb47c71922e9a..585008714b9caa3ea95ebbeb67f8d0c55dc5cf79 100644 --- a/api/@ohos.uri.d.ts +++ b/api/@ohos.uri.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 @@ -21,10 +21,18 @@ * @permission N/A */ declare namespace uri { + + /** + * URI Represents a Uniform Resource Identifier (URI) reference. + * @name URI + * @since 8 + * @syscap SystemCapability.Utils.Lang + */ class URI { /** * URI constructor, which is used to instantiate a URI object. * uri: Constructs a URI by parsing a given string. + * @throws {BusinessError} 401 - if the input parameters are invalid. */ constructor(uri: string); @@ -32,24 +40,36 @@ declare namespace uri { * Returns the serialized URI as a string. * @since 8 * @syscap SystemCapability.Utils.Lang - * @return Returns the serialized URI as a string. + * @returns Returns the serialized URI as a string. */ - toString(): string + toString(): string; /** - * Tests whether this URI is equivalent to other URI objects. + * Check whether this URI is equivalent to other URI objects. * @since 8 + * @deprecated since 9 + * @useinstead ohos.uri.URI.equalsTo * @syscap SystemCapability.Utils.Lang * @param other URI object to be compared - * @return boolean Tests whether this URI is equivalent to other URI objects. + * @returns boolean Tests whether this URI is equivalent to other URI objects. */ equals(other: URI): boolean; + /** + * Check whether this URI is equivalent to other URI objects. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param other URI object to be compared + * @returns boolean Tests whether this URI is equivalent to other URI objects. + * @throws {BusinessError} 10200002 - The type of other must be URI. + */ + equalsTo(other: URI): boolean; + /** * Indicates whether this URI is an absolute URI. * @since 8 * @syscap SystemCapability.Utils.Lang - * @return boolean Indicates whether the URI is an absolute URI (whether the scheme component is defined). + * @returns boolean Indicates whether the URI is an absolute URI (whether the scheme component is defined). */ checkIsAbsolute(): boolean; @@ -57,7 +77,7 @@ declare namespace uri { * Normalize the path of this URI. * @since 8 * @syscap SystemCapability.Utils.Lang - * @return URI Used to normalize the path of this URI and return a URI object whose path has been normalized. + * @returns URI Used to normalize the path of this URI and return a URI object whose path has been normalized. */ normalize(): URI; diff --git a/api/@ohos.url.d.ts b/api/@ohos.url.d.ts index 0f1f6b95631d6cac6f6eb2eb2b56e696b7553619..60658249a4f29a38a94dea8c245524619ed6f058 100644 --- a/api/@ohos.url.d.ts +++ b/api/@ohos.url.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 @@ -20,8 +20,15 @@ * @import import url from '@ohos.url'; * @permission N/A */ - declare namespace url { + /** + * The URLSearchParams interface defines some practical methods to process URL query strings. + * @name URLSearchParams + * @since 7 + * @deprecated since 9 + * @useinstead ohos.url.URLParams + * @syscap SystemCapability.Utils.Lang + */ class URLSearchParams { /** * A parameterized constructor used to create an URLSearchParams instance. @@ -30,12 +37,16 @@ declare namespace url { * The input parameter is the object list. * The input parameter is a character string. * The input parameter is the URLSearchParams object. + * @deprecated since 9 + * @useinstead ohos.url.URLParams.constructor */ constructor(init?: string[][] | Record | string | URLSearchParams); /** * Appends a specified key/value pair as a new search parameter. * @since 7 + * @deprecated since 9 + * @useinstead ohos.url.URLParams.append * @syscap SystemCapability.Utils.Lang * @param name Key name of the search parameter to be inserted. * @param value Values of search parameters to be inserted. @@ -45,17 +56,21 @@ declare namespace url { /** * Deletes the given search parameter and its associated value,from the list of all search parameters. * @since 7 + * @deprecated since 9 + * @useinstead ohos.url.URLParams.delete * @syscap SystemCapability.Utils.Lang - * @param Name of the key-value pair to be deleted. + * @param name Name of the key-value pair to be deleted. */ delete(name: string): void; /** * Returns all key-value pairs associated with a given search parameter as an array. * @since 7 + * @deprecated since 9 + * @useinstead ohos.url.URLParams.getAll * @syscap SystemCapability.Utils.Lang - * @param Name Specifies the name of a key value. - * @return string[] Returns all key-value pairs with the specified name. + * @param name Specifies the name of a key value. + * @returns string[] Returns all key-value pairs with the specified name. */ getAll(name: string): string[]; @@ -63,14 +78,18 @@ declare namespace url { * Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. * The first item of Array is name, and the second item of Array is value. * @since 7 + * @deprecated since 9 + * @useinstead ohos.url.URLParams.entries * @syscap SystemCapability.Utils.Lang - * @return Returns an iterator for ES6. + * @returns Returns an iterator for ES6. */ - entries(): IterableIterator<[string, string]>; + entries(): IterableIterator<[string, string]>; /** * Callback functions are used to traverse key-value pairs on the URLSearchParams instance object. * @since 7 + * @deprecated since 9 + * @useinstead ohos.url.URLParams.forEach * @syscap SystemCapability.Utils.Lang * @param value Current traversal key value. * @param key Indicates the name of the key that is traversed. @@ -82,18 +101,22 @@ declare namespace url { /** * Returns the first value associated to the given search parameter. * @since 7 + * @deprecated since 9 + * @useinstead ohos.url.URLParams.get * @syscap SystemCapability.Utils.Lang * @param name Specifies the name of a key-value pair. - * @return Returns the first value found by name. If no value is found, null is returned. + * @returns Returns the first value found by name. If no value is found, null is returned. */ get(name: string): string | null; /** * Returns a Boolean that indicates whether a parameter with the specified name exists. * @since 7 + * @deprecated since 9 + * @useinstead ohos.url.URLParams.has * @syscap SystemCapability.Utils.Lang * @param name Specifies the name of a key-value pair. - * @return Returns a Boolean value that indicates whether a found + * @returns Returns a Boolean value that indicates whether a found */ has(name: string): boolean; @@ -103,6 +126,8 @@ declare namespace url { * deletes the others. If the search parameter doesn't exist, this * method creates it. * @since 7 + * @deprecated since 9 + * @useinstead ohos.url.URLParams.set * @syscap SystemCapability.Utils.Lang * @param name Key name of the parameter to be set. * @param value Indicates the parameter value to be set. @@ -112,6 +137,8 @@ declare namespace url { /** * Sort all key/value pairs contained in this object in place and return undefined. * @since 7 + * @deprecated since 9 + * @useinstead ohos.url.URLParams.sort * @syscap SystemCapability.Utils.Lang */ sort(): void; @@ -119,16 +146,20 @@ declare namespace url { /** * Returns an iterator allowing to go through all keys contained in this object. * @since 7 + * @deprecated since 9 + * @useinstead ohos.url.URLParams.keys * @syscap SystemCapability.Utils.Lang - * @return Returns an ES6 Iterator over the names of each name-value pair. + * @returns Returns an ES6 Iterator over the names of each name-value pair. */ keys(): IterableIterator; /** * Returns an iterator allowing to go through all values contained in this object. * @since 7 + * @deprecated since 9 + * @useinstead ohos.url.URLParams.values * @syscap SystemCapability.Utils.Lang - * @return Returns an ES6 Iterator over the values of each name-value pair. + * @returns Returns an ES6 Iterator over the values of each name-value pair. */ values(): IterableIterator; @@ -136,8 +167,10 @@ declare namespace url { * Returns an iterator allowing to go through all key/value * pairs contained in this object. * @since 7 + * @deprecated since 9 + * @useinstead ohos.url.URLParams.[Symbol.iterator] * @syscap SystemCapability.Utils.Lang - * @return Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. + * @returns Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. * The first item of Array is name, and the second item of Array is value. */ [Symbol.iterator](): IterableIterator<[string, string]>; @@ -145,26 +178,198 @@ declare namespace url { /** * Returns a query string suitable for use in a URL. * @since 7 + * @deprecated since 9 + * @useinstead ohos.url.URLParams.toString * @syscap SystemCapability.Utils.Lang - * @return Returns a search parameter serialized as a string, percent-encoded if necessary. + * @returns Returns a search parameter serialized as a string, percent-encoded if necessary. */ toString(): string; } - class URL { + /** + * The URLParams interface defines some practical methods to process URL query strings. + * @name URLParams + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + class URLParams { + /** + * A parameterized constructor used to create an URLSearchParams instance. + * As the input parameter of the constructor function, init supports four types. + * The input parameter is a character string two-dimensional array. + * The input parameter is the object list. + * The input parameter is a character string. + * The input parameter is the URLSearchParams object. + * @since 9 + * @throws {BusinessError} 401 - The type of init must be string two-dimensional array or object list + * or string or URLSearchParams object. + */ + constructor(init?: string[][] | Record | string | URLSearchParams); + + /** + * Appends a specified key/value pair as a new search parameter. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param name Key name of the search parameter to be inserted. + * @param value Values of search parameters to be inserted. + * @throws {BusinessError} 401 - if the input parameters are invalid. + */ + append(name: string, value: string): void; + /** + * Deletes the given search parameter and its associated value,from the list of all search parameters. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param name Name of the key-value pair to be deleted. + * @throws {BusinessError} 401 - The type of name must be string. + */ + delete(name: string): void; + + /** + * Returns all key-value pairs associated with a given search parameter as an array. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param name Specifies the name of a key value. + * @returns string[] Returns all key-value pairs with the specified name. + * @throws {BusinessError} 401 - The type of name must be string. + */ + getAll(name: string): string[]; + + /** + * Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. + * The first item of Array is name, and the second item of Array is value. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @returns Returns an iterator for ES6. + */ + entries(): IterableIterator<[string, string]>; + + /** + * Callback functions are used to traverse key-value pairs on the URLSearchParams instance object. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param value Current traversal key value. + * @param key Indicates the name of the key that is traversed. + * @param searchParams The instance object that is currently calling the forEach method. + * @param thisArg to be used as this value for when callbackfn is called + * @throws {BusinessError} 401 - if the input parameters are invalid. + */ + forEach(callbackfn: (value: string, key: string, searchParams: this) => void, thisArg?: Object): void; + + /** + * Returns the first value associated to the given search parameter. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param name Specifies the name of a key-value pair. + * @returns Returns the first value found by name. If no value is found, null is returned. + * @throws {BusinessError} 401 - The type of name must be string. + */ + get(name: string): string | null; + + /** + * Returns a Boolean that indicates whether a parameter with the specified name exists. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param name Specifies the name of a key-value pair. + * @returns Returns a Boolean value that indicates whether a found + * @throws {BusinessError} 401 - The type of name must be string. + */ + has(name: string): boolean; + + /** + * Sets the value associated with a given search parameter to the + * given value. If there were several matching values, this method + * deletes the others. If the search parameter doesn't exist, this + * method creates it. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param name Key name of the parameter to be set. + * @param value Indicates the parameter value to be set. + * @throws {BusinessError} 401 - if the input parameters are invalid. + */ + set(name: string, value: string): void; + + /** + * Sort all key/value pairs contained in this object in place and return undefined. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + sort(): void; + + /** + * Returns an iterator allowing to go through all keys contained in this object. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @returns Returns an ES6 Iterator over the names of each name-value pair. + */ + keys(): IterableIterator; + + /** + * Returns an iterator allowing to go through all values contained in this object. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @returns Returns an ES6 Iterator over the values of each name-value pair. + */ + values(): IterableIterator; + + /** + * Returns an iterator allowing to go through all key/value + * pairs contained in this object. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @returns Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. + * The first item of Array is name, and the second item of Array is value. + */ + [Symbol.iterator](): IterableIterator<[string, string]>; + + /** + * Returns a query string suitable for use in a URL. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @returns Returns a search parameter serialized as a string, percent-encoded if necessary. + */ + toString(): string; + } + + /** + * The interface of URL is used to parse, construct, normalize, and encode URLs. + * @name URL + * @since 7 + * @syscap SystemCapability.Utils.Lang + */ + class URL { + /** * URL constructor, which is used to instantiate a URL object. * url: Absolute or relative input URL to resolve. Base is required if input is relative. * If input is an absolute value, base ignores the value. * base: Base URL to parse if input is not absolute. + * @since 7 + * @deprecated since 9 + * @useinstead ohos.URL.constructor */ constructor(url: string, base?: string | URL); + /** + * URL constructor, which is used to instantiate a URL object. + * @since 9 + */ + constructor(); + + /** + * Check the validity of parameters + * url: Absolute or relative input URL to resolve. Base is required if input is relative. + * If input is an absolute value, base ignores the value. + * base: Base URL to parse if input is not absolute. + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200002 - Invalid url string. + */ + static parseURL(url: string, base?: string | URL): URL; + /** * Returns the serialized URL as a string. * @since 7 * @syscap SystemCapability.Utils.Lang - * @return Returns the serialized URL as a string. + * @returns Returns the serialized URL as a string. */ toString(): string; @@ -172,7 +377,7 @@ declare namespace url { * Returns the serialized URL as a string. * @since 7 * @syscap SystemCapability.Utils.Lang - * @return Returns the serialized URL as a string. + * @returns Returns the serialized URL as a string. */ toJSON(): string; @@ -252,9 +457,6 @@ declare namespace url { * the URL instance. To replace the entire query parameter for a URL, use url.searchsetter. * @since 7 * @syscap SystemCapability.Utils.Lang - * @note Be careful when modifying with .searchParams, because the URLSearchParams - * object uses different rules to determine which characters to - * percent-encode according to the WHATWG specification. */ readonly searchParams: URLSearchParams; diff --git a/api/@ohos.usb.d.ts b/api/@ohos.usb.d.ts index 00588468d50fb21fe16de0c73e33a267a6d3f450..b12db3bf577374a1e80a89068164a8196dd47a88 100644 --- a/api/@ohos.usb.d.ts +++ b/api/@ohos.usb.d.ts @@ -13,11 +13,15 @@ * limitations under the License. */ +/** + * @deprecated since 9 + * @useinstead ohos.usbV9 + */ declare namespace usb { /** * Obtains the USB device list. * - * @return Returns the {@link USBDevice} list. + * @returns Returns the {@link USBDevice} list. * @syscap SystemCapability.USB.USBManager * @since 8 */ @@ -27,7 +31,7 @@ declare namespace usb { * Connects to the USB device based on the device information returned by {@link getDevices()}. * * @param device USB device on the device list returned by {@link getDevices()}. - * @return Returns the {@link USBDevicePipe} object for data transfer. + * @returns Returns the {@link USBDevicePipe} object for data transfer. * @syscap SystemCapability.USB.USBManager * @since 8 */ @@ -37,7 +41,7 @@ declare namespace usb { * Checks whether the application has the permission to access the device. * * @param deviceName Device name defined by {@link USBDevice.name}. - * @return Returns **true** if the user has the permission to access the device; return **false** otherwise. + * @returns Returns **true** if the user has the permission to access the device; return **false** otherwise. * @syscap SystemCapability.USB.USBManager * @since 8 */ @@ -47,7 +51,7 @@ declare namespace usb { * Requests the temporary permission for a given application to access the USB device. * * @param deviceName Device name defined by {@link USBDevice.name}. - * @return Returns **true** if the temporary device access permissions are granted; return **false** otherwise. + * @returns Returns **true** if the temporary device access permissions are granted; return **false** otherwise. * @syscap SystemCapability.USB.USBManager * @since 8 */ @@ -57,7 +61,7 @@ declare namespace usb { * Converts the string descriptor of a given USB function list to a numeric mask combination. * * @param funcs Descriptor of the supported function list. - * @return Returns the numeric mask combination of the function list. + * @returns Returns the numeric mask combination of the function list. * @systemapi * @syscap SystemCapability.USB.USBManager * @since 9 @@ -68,7 +72,7 @@ declare namespace usb { * Converts the numeric mask combination of a given USB function list to a string descriptor. * * @param funcs Numeric mask combination of the function list. - * @return Returns the string descriptor of the supported function list. + * @returns Returns the string descriptor of the supported function list. * @systemapi * @syscap SystemCapability.USB.USBManager * @since 9 @@ -79,16 +83,17 @@ declare namespace usb { * Sets the current USB function list in Device mode. * * @param funcs Numeric mask combination of the supported function list. - * @return Returns **true** if the setting is successful; returns **false** otherwise. + * @returns Returns **true** if the setting is successful; returns **false** otherwise. * @systemapi * @syscap SystemCapability.USB.USBManager * @since 9 */ function setCurrentFunctions(funcs: FunctionType): Promise; + /** * Obtains the numeric mask combination for the current USB function list in Device mode. * - * @return Returns the numeric mask combination for the current USB function list in {@link FunctionType}. + * @returns Returns the numeric mask combination for the current USB function list in {@link FunctionType}. * @systemapi * @syscap SystemCapability.USB.USBManager * @since 9 @@ -99,7 +104,7 @@ declare namespace usb { /** * Obtains the {@link USBPort} list. * - * @return Returns the {@link USBPort} list. + * @returns Returns the {@link USBPort} list. * @systemapi * @syscap SystemCapability.USB.USBManager * @since 9 @@ -109,7 +114,7 @@ declare namespace usb { /** * Gets the mask combination for the supported mode list of the specified {@link USBPort}. * - * @return Returns the mask combination for the supported mode list in {@link PortModeType}. + * @returns Returns the mask combination for the supported mode list in {@link PortModeType}. * @systemapi * @syscap SystemCapability.USB.USBManager * @since 9 @@ -122,7 +127,7 @@ declare namespace usb { * @param portId Unique ID of the port. * @param powerRole Charging role defined by {@link PowerRoleType}. * @param dataRole Data role defined by {@link DataRoleType}. - * @return Returns the supported role type. + * @returns Returns the supported role type. * @systemapi * @syscap SystemCapability.USB.USBManager * @since 9 @@ -134,72 +139,78 @@ declare namespace usb { * Claims a USB interface. * * @param pipe Device pipe defined by {@link USBDevicePipe}, which is used to determine the bus number and device address. - * @param iface USB interface defined by {@link USBInterface}, which is used to determine the interface to claim. + * @param iface USB interface defined by {@link USBInterface}, which is used to determine the interface to claim. * @param force Optional parameter that determines whether to forcibly claim the USB interface. - * @return Returns **0** if the USB interface is successfully claimed; returns an error code otherwise. + * @returns Returns **0** if the USB interface is successfully claimed; returns an error code otherwise. * @syscap SystemCapability.USB.USBManager * @since 8 */ function claimInterface(pipe: USBDevicePipe, iface: USBInterface, force?: boolean): number; + /** * Releases a USB interface. * * @param pipe Device pipe defined by {@link USBDevicePipe}, which is used to determine the bus number and device address. - * @param iface USB interface defined by {@link USBInterface}, which is used to determine the interface to release. - * @return Returns **0** if the USB interface is successfully released; returns an error code otherwise. + * @param iface USB interface defined by {@link USBInterface}, which is used to determine the interface to release. + * @returns Returns **0** if the USB interface is successfully released; returns an error code otherwise. * @syscap SystemCapability.USB.USBManager * @since 8 */ function releaseInterface(pipe: USBDevicePipe, iface: USBInterface): number; + /** * Sets the device configuration. * * @param pipe Device pipe defined by {@link USBDevicePipe}, which is used to determine the bus number and device address. * @param config Device configuration defined by {@link USBConfig}. - * @return Returns **0** if the device configuration is successfully set; returns an error code otherwise. + * @returns Returns **0** if the device configuration is successfully set; returns an error code otherwise. * @syscap SystemCapability.USB.USBManager * @since 8 */ function setConfiguration(pipe: USBDevicePipe, config: USBConfig): number; + /** * Sets a USB interface. * * @param pipe Device pipe defined by {@link USBDevicePipe}, which is used to determine the bus number and device address. - * @param iface USB interface defined by {@link USBInterface}, which is used to determine the interface to set. - * @return Returns **0** if the USB interface is successfully set; return an error code otherwise. + * @param iface USB interface defined by {@link USBInterface}, which is used to determine the interface to set. + * @returns Returns **0** if the USB interface is successfully set; return an error code otherwise. * @syscap SystemCapability.USB.USBManager * @since 8 */ function setInterface(pipe: USBDevicePipe, iface: USBInterface): number; + /** * Obtains the raw USB descriptor. * * @param pipe Device pipe defined by {@link USBDevicePipe}, which is used to determine the bus number and device address. - * @return Returns the raw descriptor data. + * @returns Returns the raw descriptor data. * @syscap SystemCapability.USB.USBManager * @since 8 */ function getRawDescriptor(pipe: USBDevicePipe): Uint8Array; + /** * Obtains the file descriptor. * * @param pipe Device pipe defined by {@link USBDevicePipe}, which is used to determine the USB device. - * @return Returns the file descriptor of the USB device. + * @returns Returns the file descriptor of the USB device. * @syscap SystemCapability.USB.USBManager * @since 8 */ function getFileDescriptor(pipe: USBDevicePipe): number; + /** * Performs control transfer. * * @param pipe Device pipe defined by {@link USBDevicePipe}, which is used to determine the USB device. - * @param contrlparam Control transfer parameters. + * @param controlparam Control transfer parameters. * @param timeout Timeout duration. This parameter is optional. The default value is **0**, indicating no timeout. - * @return Returns the size of the transmitted or received data block if the control transfer is successful; return **-1** if an exception occurs. + * @returns Returns the size of the transmitted or received data block if the control transfer is successful; return **-1** if an exception occurs. * @syscap SystemCapability.USB.USBManager * @since 8 */ - function controlTransfer(pipe: USBDevicePipe, contrlparam: USBControlParams, timeout?: number): Promise; + function controlTransfer(pipe: USBDevicePipe, controlparam: USBControlParams, timeout?: number): Promise; /** * Performs bulk transfer. @@ -208,7 +219,7 @@ declare namespace usb { * @param endpoint USB endpoint defined by {@link USBEndpoint}, which is used to determine the USB port for data transfer. * @param buffer Buffer for writing or reading data. * @param timeout Timeout duration. This parameter is optional. The default value is **0**, indicating no timeout. - * @return Returns the size of the transmitted or received data block if the control transfer is successful; return **-1** if an exception occurs. + * @returns Returns the size of the transmitted or received data block if the control transfer is successful; return **-1** if an exception occurs. * @syscap SystemCapability.USB.USBManager * @since 8 */ @@ -219,7 +230,7 @@ declare namespace usb { * Closes a USB device pipe. * * @param pipe Device pipe defined by {@link USBDevicePipe}, which is used to determine the USB device. - * @return Returns **0** if the USB device pipe is closed successfully; return an error code otherwise. + * @returns Returns **0** if the USB device pipe is closed successfully; return an error code otherwise. * @syscap SystemCapability.USB.USBManager * @since 8 */ @@ -291,7 +302,7 @@ declare namespace usb { /** - * Represents a USB interface. One USBconfig {@link USBConfig} can contain multiple **USBInterface** instances, each providing a specific function. + * Represents a USB interface. One config {@link USBConfig} can contain multiple **USBInterface** instances, each providing a specific function. * * @syscap SystemCapability.USB.USBManager * @since 8 @@ -326,7 +337,7 @@ declare namespace usb { subClass: number; /** - * Alternating between descriptors of the same USB interface + * Alternation between descriptors of the same USB interface * * @since 8 */ @@ -419,72 +430,84 @@ declare namespace usb { * @since 8 */ busNum: number; + /** * Device address * * @since 8 */ devAddress: number; + /** * Device SN * * @since 8 */ serial: string; + /** * Device name * * @since 8 */ name: string; + /** * Device manufacturer * * @since 8 */ manufacturerName: string; + /** * Product information * * @since 8 */ productName: string; + /** * Product version * * @since 8 */ version: string; + /** * Vendor ID * * @since 8 */ vendorId: number; + /** * Product ID * * @since 8 */ productId: number; + /** * Device class * * @since 8 */ clazz: number; + /** * Device subclass * * @since 8 */ subClass: number; + /** * Device protocol code * * @since 8 */ protocol: number; + /** * Device configuration descriptor information defined by {@link USBConfig} * @@ -506,6 +529,7 @@ declare namespace usb { * @since 8 */ busNum: number; + /** * Device address * @@ -528,12 +552,14 @@ declare namespace usb { * @since 9 */ NONE = 0, + /** * External power supply * * @since 9 */ SOURCE = 1, + /** * Internal power supply * @@ -556,12 +582,14 @@ declare namespace usb { * @since 9 */ NONE = 0, + /** * Host mode * * @since 9 */ HOST = 1, + /** * Device mode * @@ -584,24 +612,28 @@ declare namespace usb { * @since 9 */ NONE = 0, + /** * Upstream facing port, which functions as the sink of power supply * * @since 9 */ UFP = 1, + /** * Downstream facing port, which functions as the source of power supply * * @since 9 */ DFP = 2, + /** * Dynamic reconfiguration port (DRP), which can function as the DFP (host) or UFP (device). It is not supported currently. * * @since 9 */ DRP = 3, + /** * Not supported currently * @@ -683,30 +715,35 @@ declare namespace usb { * @since 8 */ request: number; + /** * Request target type * * @since 8 */ target: USBRequestTargetType; + /** * Control request type * * @since 8 */ reqType: USBControlRequestType; + /** * Request parameter value * * @since 8 */ value: number; + /** * Index of the parameter value * * @since 8 */ index: number; + /** * Data written to or read from the buffer * @since 8 @@ -727,18 +764,21 @@ declare namespace usb { * @since 8 */ USB_REQUEST_TARGET_DEVICE = 0, + /** * USB interface * * @since 8 */ USB_REQUEST_TARGET_INTERFACE = 1, + /** * Endpoint * * @since 8 */ USB_REQUEST_TARGET_ENDPOINT = 2, + /** * Others * @@ -760,12 +800,14 @@ declare namespace usb { * @since 8 */ USB_REQUEST_TYPE_STANDARD = 0, + /** * Class * * @since 8 */ USB_REQUEST_TYPE_CLASS = 1, + /** * Vendor * @@ -787,6 +829,7 @@ declare namespace usb { * @since 8 */ USB_REQUEST_DIR_TO_DEVICE = 0, + /** * Request for reading data from the device to the host * @@ -809,54 +852,63 @@ declare namespace usb { * @since 9 */ NONE = 0, + /** * Serial port device * * @since 9 */ ACM = 1, + /** * Ethernet port device * * @since 9 */ ECM = 2, + /** * HDC device * * @since 9 */ HDC = 4, + /** * MTP device * * @since 9 */ MTP = 8, + /** * PTP device * * @since 9 */ PTP = 16, + /** * RNDIS device * * @since 9 */ RNDIS = 32, + /** * MIDI device * * @since 9 */ MIDI = 64, + /** * Audio source device * * @since 9 */ AUDIO_SOURCE = 128, + /** * NCM device * diff --git a/api/@ohos.usbV9.d.ts b/api/@ohos.usbV9.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..310be1eebbf52b3f80cf9dbfd313b3c67958ce33 --- /dev/null +++ b/api/@ohos.usbV9.d.ts @@ -0,0 +1,980 @@ +/* + * 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. + */ + +/** + * This module provides the capability of manage USB device. + * @namespace usbV9 + * @syscap SystemCapability.USB.USBManager + * @since 9 + */ +declare namespace usbV9 { + /** + * Obtains the USB device list. + * + * @returns Returns the {@link USBDevice} list. + * @syscap SystemCapability.USB.USBManager + * @since 9 + */ + function getDevices(): Array>; + + /** + * Connects to the USB device based on the device information returned by {@link getDevices()}. + * + * @param device USB device on the device list returned by {@link getDevices()}. + * @returns Returns the {@link USBDevicePipe} object for data transfer. + * @throws {BusinessError} 401 - The parameter types do not match or parameter is not specified. + * @throws {BusinessError} 14400001 - USB Device access denied. + * @syscap SystemCapability.USB.USBManager + * @since 9 + */ + function connectDevice(device: USBDevice): Readonly; + + /** + * Checks whether the application has the permission to access the device. + * + * @param deviceName Device name defined by {@link USBDevice.name}. + * @returns Returns **true** if the user has the permission to access the device; return **false** otherwise. + * @throws {BusinessError} 401 - The parameter types do not match or parameter is not specified. + * @syscap SystemCapability.USB.USBManager + * @since 9 + */ + function hasRight(deviceName: string): boolean; + + /** + * Requests the permission for a given application to access the USB device. + * + * @param deviceName Device name defined by {@link USBDevice.name}. + * @returns Returns **true** if the device access permissions are granted; return **false** otherwise. + * @throws {BusinessError} 401 - The parameter types do not match or parameter is not specified. + * @syscap SystemCapability.USB.USBManager + * @since 9 + */ + function requestRight(deviceName: string): Promise; + + /** + * Remove the permission for a given application to access the USB device. + * + * @param deviceName Device name defined by {@link USBDevice.name}. + * @returns Returns **true** if the device access permissions are removed; return **false** otherwise. + * @throws {BusinessError} 401 - The parameter types do not match or parameter is not specified. + * @syscap SystemCapability.USB.USBManager + * @since 9 + */ + function removeRight(deviceName: string): boolean; + + /** + * Add device access permission. + * + * @param bundleName refers to application that require access permissions. + * @param deviceName Device name defined by {@link USBDevice.name}. + * @returns Returns the boolean value to indicate whether the permission is granted. + * @throws {BusinessError} 401 - The parameter types do not match or parameter is not specified. + * @systemapi + * @syscap SystemCapability.USB.USBManager + * @since 9 + */ + function addRight(bundleName: string, deviceName: string): boolean; + + /** + * Converts the string descriptor of a given USB function list to a numeric mask combination. + * + * @param funcs Descriptor of the supported function list. + * @returns Returns the numeric mask combination of the function list. + * @throws {BusinessError} 401 - The parameter types do not match or parameter is not specified. + * @systemapi + * @syscap SystemCapability.USB.USBManager + * @since 9 + */ + function usbFunctionsFromString(funcs: string): number; + + /** + * Converts the numeric mask combination of a given USB function list to a string descriptor. + * + * @param funcs Numeric mask combination of the function list. + * @returns Returns the string descriptor of the supported function list. + * @throws {BusinessError} 401 - The parameter types do not match or parameter is not specified. + * @systemapi + * @syscap SystemCapability.USB.USBManager + * @since 9 + */ + function usbFunctionsToString(funcs: FunctionType): string; + + /** + * Sets the current USB function list in Device mode. + * + * @param funcs Numeric mask combination of the supported function list. + * @returns Returns **true** if the setting is successful; returns **false** otherwise. + * @throws {BusinessError} 401 - The parameter types do not match or parameter is not specified. + * @systemapi + * @syscap SystemCapability.USB.USBManager + * @since 9 + */ + function setCurrentFunctions(funcs: FunctionType): Promise; + + /** + * Obtains the numeric mask combination for the current USB function list in Device mode. + * + * @returns Returns the numeric mask combination for the current USB function list in {@link FunctionType}. + * @systemapi + * @syscap SystemCapability.USB.USBManager + * @since 9 + */ + function getCurrentFunctions(): FunctionType; + + /* usb port functions begin */ + /** + * Obtains the {@link USBPort} list. + * + * @returns Returns the {@link USBPort} list. + * @systemapi + * @syscap SystemCapability.USB.USBManager + * @since 9 + */ + function getPorts(): Array; + + /** + * Gets the mask combination for the supported mode list of the specified {@link USBPort}. + * + * @returns Returns the mask combination for the supported mode list in {@link PortModeType}. + * @throws {BusinessError} 401 - The parameter types do not match or parameter is not specified. + * @systemapi + * @syscap SystemCapability.USB.USBManager + * @since 9 + */ + function getSupportedModes(portId: number): PortModeType; + + /** + * Sets the role types supported by the specified {@link USBPort}, which can be powerRole (for charging) and dataRole (for data transfer). + * + * @param portId Unique ID of the port. + * @param powerRole Charging role defined by {@link PowerRoleType}. + * @param dataRole Data role defined by {@link DataRoleType}. + * @returns Returns the supported role type. + * @throws {BusinessError} 401 - The parameter types do not match or parameter is not specified. + * @systemapi + * @syscap SystemCapability.USB.USBManager + * @since 9 + */ + function setPortRoles(portId: number, powerRole: PowerRoleType, dataRole: DataRoleType): Promise; + + /* usb pipe functions begin */ + /** + * Claims a USB interface. + * + * @param pipe Device pipe defined by {@link USBDevicePipe}, which is used to determine the bus number and device address. + * @param iface USB interface defined by {@link USBInterface}, which is used to determine the interface to claim. + * @param force Optional parameter that determines whether to forcibly claim the USB interface. + * @returns Returns **0** if the USB interface is successfully claimed; returns an error code otherwise. + * @throws {BusinessError} 401 - The parameter types do not match or parameter is not specified. + * @syscap SystemCapability.USB.USBManager + * @since 9 + */ + function claimInterface(pipe: USBDevicePipe, iface: USBInterface, force?: boolean): number; + + /** + * Releases a USB interface. + * + * @param pipe Device pipe defined by {@link USBDevicePipe}, which is used to determine the bus number and device address. + * @param iface USB interface defined by {@link USBInterface}, which is used to determine the interface to release. + * @returns Returns **0** if the USB interface is successfully released; returns an error code otherwise. + * @syscap SystemCapability.USB.USBManager + * @since 9 + */ + function releaseInterface(pipe: USBDevicePipe, iface: USBInterface): number; + + /** + * Sets the device configuration. + * + * @param pipe Device pipe defined by {@link USBDevicePipe}, which is used to determine the bus number and device address. + * @param config Device configuration defined by {@link USBConfig}. + * @returns Returns **0** if the device configuration is successfully set; returns an error code otherwise. + * @throws {BusinessError} 401 - The parameter types do not match or parameter is not specified. + * @syscap SystemCapability.USB.USBManager + * @since 9 + */ + function setConfiguration(pipe: USBDevicePipe, config: USBConfig): number; + + /** + * Sets a USB interface. + * + * @param pipe Device pipe defined by {@link USBDevicePipe}, which is used to determine the bus number and device address. + * @param iface USB interface defined by {@link USBInterface}, which is used to determine the interface to set. + * @returns Returns **0** if the USB interface is successfully set; return an error code otherwise. + * @throws {BusinessError} 401 - The parameter types do not match or parameter is not specified. + * @syscap SystemCapability.USB.USBManager + * @since 9 + */ + function setInterface(pipe: USBDevicePipe, iface: USBInterface): number; + + /** + * Obtains the raw USB descriptor. + * + * @param pipe Device pipe defined by {@link USBDevicePipe}, which is used to determine the bus number and device address. + * @returns Returns the raw descriptor data. + * @throws {BusinessError} 401 - The parameter types do not match or parameter is not specified. + * @syscap SystemCapability.USB.USBManager + * @since 9 + */ + function getRawDescriptor(pipe: USBDevicePipe): Uint8Array; + + /** + * Obtains the file descriptor. + * + * @param pipe Device pipe defined by {@link USBDevicePipe}, which is used to determine the USB device. + * @returns Returns the file descriptor of the USB device. + * @throws {BusinessError} 401 - The parameter types do not match or parameter is not specified. + * @syscap SystemCapability.USB.USBManager + * @since 9 + */ + function getFileDescriptor(pipe: USBDevicePipe): number; + + /** + * Performs control transfer. + * + * @param pipe Device pipe defined by {@link USBDevicePipe}, which is used to determine the USB device. + * @param controlparam Control transfer parameters. + * @param timeout Timeout duration. This parameter is optional. The default value is **0**, indicating no timeout. + * @returns Returns the size of the transmitted or received data block if the control transfer is successful; return **-1** if an exception occurs. + * @throws {BusinessError} 401 - The parameter types do not match or parameter is not specified. + * @syscap SystemCapability.USB.USBManager + * @since 9 + */ + function controlTransfer(pipe: USBDevicePipe, controlparam: USBControlParams, timeout?: number): Promise; + + /** + * Performs bulk transfer. + * + * @param pipe Device pipe defined by {@link USBDevicePipe}, which is used to determine the USB device. + * @param endpoint USB endpoint defined by {@link USBEndpoint}, which is used to determine the USB port for data transfer. + * @param buffer Buffer for writing or reading data. + * @param timeout Timeout duration. This parameter is optional. The default value is **0**, indicating no timeout. + * @returns Returns the size of the transmitted or received data block if the control transfer is successful; return **-1** if an exception occurs. + * @throws {BusinessError} 401 - The parameter types do not match or parameter is not specified. + * @syscap SystemCapability.USB.USBManager + * @since 9 + */ + function bulkTransfer(pipe: USBDevicePipe, endpoint: USBEndpoint, buffer: Uint8Array, + timeout?: number): Promise; + + /** + * Closes a USB device pipe. + * + * @param pipe Device pipe defined by {@link USBDevicePipe}, which is used to determine the USB device. + * @returns Returns **0** if the USB device pipe is closed successfully; return an error code otherwise. + * @throws {BusinessError} 401 - The parameter types do not match or parameter is not specified. + * @syscap SystemCapability.USB.USBManager + * @since 9 + */ + function closePipe(pipe: USBDevicePipe): number; + + /** + * Represents the USB endpoint from which data is sent or received. You can obtain the USB endpoint through {@link USBInterface}. + * + * @typedef USBEndpoint + * @syscap SystemCapability.USB.USBManager + * @since 9 + */ + interface USBEndpoint { + /** + * Endpoint address + * + * @since 9 + */ + address: number; + + /** + * Endpoint attributes + * + * @since 9 + */ + attributes: number; + + /** + * Endpoint interval + * + * @since 9 + */ + interval: number; + + /** + * Maximum size of data packets on the endpoint + * + * @since 9 + */ + maxPacketSize: number; + + /** + * Endpoint direction + * + * @since 9 + */ + direction: USBRequestDirection; + + /** + * Endpoint number + * + * @since 9 + */ + number: number; + + /** + * Endpoint type + * + * @since 9 + */ + type: number; + + /** + * Unique ID defined by {@link USBInterface.id}, which indicates the interface to which the endpoint belongs + * + * @since 9 + */ + interfaceId: number; + } + + + /** + * Represents a USB interface. One config {@link USBConfig} can contain multiple **USBInterface** instances, each providing a specific function. + * + * @typedef USBInterface + * @syscap SystemCapability.USB.USBManager + * @since 9 + */ + interface USBInterface { + /** + * Unique ID of the USB interface + * + * @since 9 + */ + id: number; + + /** + * Interface protocol + * + * @since 9 + */ + protocol: number; + + /** + * Device type + * + * @since 9 + */ + clazz: number; + + /** + * Device subclass + * + * @since 9 + */ + subClass: number; + + /** + * Alternation between descriptors of the same USB interface + * + * @since 9 + */ + alternateSetting: number; + + /** + * Interface name + * + * @since 9 + */ + name: string; + + /** + * {@link USBEndpoint} that belongs to the USB interface + * + * @since 9 + */ + endpoints: Array; + } + + /** + * USB configuration. One {@link USBDevice} can contain multiple USBConfig instances. + * + * @typedef USBConfig + * @syscap SystemCapability.USB.USBManager + * @since 9 + */ + interface USBConfig { + /** + * Unique ID of the USB configuration + * + * @since 9 + * + * + */ + id: number; + + /** + * Configuration attributes + * + * @since 9 + */ + attributes: number; + + /** + * Maximum power consumption, in mA + * + * @since 9 + */ + maxPower: number; + + /** + * Configuration name, which can be left empty + * + * @since 9 + */ + name: string; + + /** + * Support for remote wakeup + * + * @since 9 + */ + isRemoteWakeup: boolean; + + /** + * Support for independent power supplies + * + * @since 9 + */ + isSelfPowered: boolean; + + /** + * Supported interface attributes defined by {@link USBInterface} + * + * @since 9 + */ + interfaces: Array; + } + + /** + * Represents a USB device. + * + * @typedef USBDevice + * @syscap SystemCapability.USB.USBManager + * @since 9 + */ + interface USBDevice { + /** + * Bus address + * + * @since 9 + */ + busNum: number; + + /** + * Device address + * + * @since 9 + */ + devAddress: number; + + /** + * Device SN + * + * @since 9 + */ + serial: string; + + /** + * Device name + * + * @since 9 + */ + name: string; + + /** + * Device manufacturer + * + * @since 9 + */ + manufacturerName: string; + + /** + * Product information + * + * @since 9 + */ + productName: string; + + /** + * Product version + * + * @since 9 + */ + version: string; + + /** + * Vendor ID + * + * @since 9 + */ + vendorId: number; + + /** + * Product ID + * + * @since 9 + */ + productId: number; + + /** + * Device class + * + * @since 9 + */ + clazz: number; + + /** + * Device subclass + * + * @since 9 + */ + subClass: number; + + /** + * Device protocol code + * + * @since 9 + */ + protocol: number; + + /** + * Device configuration descriptor information defined by {@link USBConfig} + * + * @since 9 + */ + configs: Array; + } + + /** + * Represents a USB device pipe, which is used to determine the USB device. + * + * @typedef USBDevicePipe + * @syscap SystemCapability.USB.USBManager + * @since 9 + */ + interface USBDevicePipe { + /** + * Bus address. + * + * @since 9 + */ + busNum: number; + + /** + * Device address + * + * @since 9 + */ + devAddress: number; + } + + /** + * Enumerates power role types. + * + * @enum { number } + * @syscap SystemCapability.USB.USBManager + * @systemapi + * @since 9 + */ + export enum PowerRoleType { + /** + * None + * + * @since 9 + */ + NONE = 0, + + /** + * External power supply + * + * @since 9 + */ + SOURCE = 1, + + /** + * Internal power supply + * + * @since 9 + */ + SINK = 2 + } + + /** + * Enumerates data role types. + * + * @enum { number } + * @syscap SystemCapability.USB.USBManager + * @systemapi + * @since 9 + */ + export enum DataRoleType { + /** + * None + * + * @since 9 + */ + NONE = 0, + + /** + * Host mode + * + * @since 9 + */ + HOST = 1, + + /** + * Device mode + * + * @since 9 + */ + DEVICE = 2 + } + + /** + * Enumerates port mode types + * + * @enum { number } + * @syscap SystemCapability.USB.USBManager + * @systemapi + * @since 9 + */ + export enum PortModeType { + /** + * None + * + * @since 9 + */ + NONE = 0, + + /** + * Upstream facing port, which functions as the sink of power supply + * + * @since 9 + */ + UFP = 1, + + /** + * Downstream facing port, which functions as the source of power supply + * + * @since 9 + */ + DFP = 2, + + /** + * Dynamic reconfiguration port (DRP), which can function as the DFP (host) or UFP (device). It is not supported currently. + * + * @since 9 + */ + DRP = 3, + + /** + * Not supported currently + * + * @since 9 + */ + NUM_MODES = 4 + } + + /** + * Enumerates USB device port roles. + * + * @typedef USBPortStatus + * @syscap SystemCapability.USB.USBManager + * @systemapi + * @since 9 + */ + interface USBPortStatus { + /** + * USB mode + * + * @since 9 + */ + currentMode: number; + + /** + * Power role + * + * @since 9 + */ + currentPowerRole: number; + + /** + * Data role + * + * @since 9 + */ + currentDataRole: number; + } + + /** + * Represents a USB device port. + * + * @typedef USBPort + * @syscap SystemCapability.USB.USBManager + * @systemapi + * @since 9 + */ + interface USBPort { + /** + * Unique ID of the USB port + * + * @since 9 + */ + id: number; + + /** + * Mask combination for the supported mode list of the USB port + * + * @since 9 + */ + supportedModes: PortModeType; + + /** + * USB port role defined by {@link USBPortStatus} + * + * @since 9 + */ + status: USBPortStatus; + } + + /** + * Represents control transfer parameters. + * + * @typedef USBControlParams + * @syscap SystemCapability.USB.USBManager + * @since 9 + */ + interface USBControlParams { + /** + * Request type + * + * @since 9 + */ + request: number; + + /** + * Request target type + * + * @since 9 + */ + target: USBRequestTargetType; + + /** + * Control request type + * + * @since 9 + */ + reqType: USBControlRequestType; + + /** + * Request parameter value + * + * @since 9 + */ + value: number; + + /** + * Index of the parameter value + * + * @since 9 + */ + index: number; + + /** + * Data written to or read from the buffer + * @since 9 + */ + data: Uint8Array; + } + + /** + * Enumerates USB request target types. + * + * @enum { number } + * @syscap SystemCapability.USB.USBManager + * @since 9 + */ + export enum USBRequestTargetType { + /** + * USB device + * + * @since 9 + */ + USB_REQUEST_TARGET_DEVICE = 0, + + /** + * USB interface + * + * @since 9 + */ + USB_REQUEST_TARGET_INTERFACE = 1, + + /** + * Endpoint + * + * @since 9 + */ + USB_REQUEST_TARGET_ENDPOINT = 2, + + /** + * Others + * + * @since 9 + */ + USB_REQUEST_TARGET_OTHER = 3 + } + + /** + * Enumerates control request types. + * + * @enum { number } + * @syscap SystemCapability.USB.USBManager + * @since 9 + */ + export enum USBControlRequestType { + /** + * Standard + * + * @since 9 + */ + USB_REQUEST_TYPE_STANDARD = 0, + + /** + * Class + * + * @since 9 + */ + USB_REQUEST_TYPE_CLASS = 1, + + /** + * Vendor + * + * @since 9 + */ + USB_REQUEST_TYPE_VENDOR = 2 + } + + /** + * Enumerates request directions. + * + * @enum { number } + * @syscap SystemCapability.USB.USBManager + * @since 9 + */ + export enum USBRequestDirection { + /** + * Request for writing data from the host to the device + * + * @since 9 + */ + USB_REQUEST_DIR_TO_DEVICE = 0, + + /** + * Request for reading data from the device to the host + * + * @since 9 + */ + USB_REQUEST_DIR_FROM_DEVICE = 0x80 + } + + /** + * Enumerates function modes. + * + * @enum { number } + * @syscap SystemCapability.USB.USBManager + * @systemapi + * @since 9 + */ + export enum FunctionType { + /** + * None + * + * @since 9 + */ + NONE = 0, + + /** + * Serial port device + * + * @since 9 + */ + ACM = 1, + + /** + * Ethernet port device + * + * @since 9 + */ + ECM = 2, + + /** + * HDC device + * + * @since 9 + */ + HDC = 4, + + /** + * MTP device + * + * @since 9 + */ + MTP = 8, + + /** + * PTP device + * + * @since 9 + */ + PTP = 16, + + /** + * RNDIS device + * + * @since 9 + */ + RNDIS = 32, + + /** + * MIDI device + * + * @since 9 + */ + MIDI = 64, + + /** + * Audio source device + * + * @since 9 + */ + AUDIO_SOURCE = 128, + + /** + * NCM device + * + * @since 9 + */ + NCM = 256 + } + +} + +export default usbV9; diff --git a/api/@ohos.userIAM.faceAuth.d.ts b/api/@ohos.userIAM.faceAuth.d.ts index 391b4b41b6ef238ca7af6dd17f06da90a4d239de..b3026ba67662663910668636c407758deea26709 100644 --- a/api/@ohos.userIAM.faceAuth.d.ts +++ b/api/@ohos.userIAM.faceAuth.d.ts @@ -15,52 +15,40 @@ /** * This module provides the capability to manage face auth. - * + * @namespace faceAuth + * @syscap SystemCapability.UserIAM.UserAuth.FaceAuth * @since 9 */ declare namespace faceAuth { /** * Provides the abilities for face authentication. - * @name FaceAuth - * @since 9 * @syscap SystemCapability.UserIAM.UserAuth.FaceAuth * @systemapi Hide this for inner system use. + * @since 9 */ class FaceAuthManager { /** * Constructor to get the FaceAuthManager class instance. - * - * @since 9 - * @return Returns the FaceAuthManager class instance. + * @returns Returns the FaceAuthManager class instance. + * @syscap SystemCapability.UserIAM.UserAuth.FaceAuth * @systemapi Hide this for inner system use. + * @since 9 */ constructor(); /** * Set XComponent surface id for camera preview during enroll. - * - * @since 9 - * @param surfaceId Indicates surface id for face enroll preview. * @permission ohos.permission.MANAGE_USER_IDM + * @param surfaceId Indicates surface id for face enroll preview. + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 202 - The caller is not a system application. + * @throws { BusinessError } 12700001 - The operation is failed. + * @syscap SystemCapability.UserIAM.UserAuth.FaceAuth * @systemapi Hide this for inner system use. + * @since 9 */ setSurfaceId(surfaceId: string): void; } - - /** - * Indicates the enumeration of operation result code. - * - * @name ResultCode - * @since 9 - * @syscap SystemCapability.UserIAM.UserAuth.FaceAuth - * @systemapi Hide this for inner system use. - */ - enum ResultCode { - /** - * Indicates that operation is fail. - */ - FAIL = 12700001, - } } export default faceAuth; \ No newline at end of file diff --git a/api/@ohos.userIAM.userAuth.d.ts b/api/@ohos.userIAM.userAuth.d.ts index c72b7b01c37297f227e7d0ace53d5e90c94e32e0..f1ca18438f10f23fc093b834e323acc2d3c3a764 100644 --- a/api/@ohos.userIAM.userAuth.d.ts +++ b/api/@ohos.userIAM.userAuth.d.ts @@ -17,73 +17,104 @@ import { AsyncCallback } from './basic'; /** * User authentication - * @since 6 + * @namespace userAuth * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 6 */ declare namespace userAuth { + /** + * Enum for authentication result. + * @enum {number} + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 6 + * @deprecated since 8 + * @useinstead ohos.userIAM.userAuth.ResultCode + */ export enum AuthenticationResult { /** * Indicates that the device does not support authentication. + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 6 * @deprecated since 8 */ NO_SUPPORT = -1, /** * Indicates that authentication is success. + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 6 * @deprecated since 8 */ SUCCESS = 0, /** * Indicates the authenticator fails to identify user. + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 6 * @deprecated since 8 */ COMPARE_FAILURE = 1, /** * Indicates that authentication has been canceled. + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 6 * @deprecated since 8 */ CANCELED = 2, /** * Indicates that authentication has timed out. + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 6 * @deprecated since 8 */ TIMEOUT = 3, /** * Indicates a failure to open the camera. + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 6 * @deprecated since 8 */ CAMERA_FAIL = 4, /** * Indicates that the authentication task is busy. Wait for a few seconds and try again. + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 6 * @deprecated since 8 */ BUSY = 5, /** * Indicates incorrect parameters. + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 6 * @deprecated since 8 */ INVALID_PARAMETERS = 6, /** * Indicates that the authenticator is locked. + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 6 * @deprecated since 8 */ LOCKED = 7, /** * Indicates that the user has not enrolled the authenticator. + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 6 * @deprecated since 8 */ NOT_ENROLLED = 8, /** * Indicates other errors. + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 6 * @deprecated since 8 */ GENERAL_ERROR = 100, @@ -91,24 +122,34 @@ declare namespace userAuth { /** * Auth types + * @since 6 * @deprecated since 8 */ type AuthType = "ALL" | "FACE_ONLY"; /** * Secure levels + * @since 6 * @deprecated since 8 */ type SecureLevel = "S1" | "S2" | "S3" | "S4"; + /** + * Used to initiate authentication. + * @interface Authenticator + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 6 + * @deprecated since 8 + */ interface Authenticator { /** * Execute authentication. - * @syscap SystemCapability.UserIAM.UserAuth.Core * @permission ohos.permission.ACCESS_BIOMETRIC * @param type Indicates the authentication type. * @param level Indicates the security level. - * @return Returns authentication result, which is specified by AuthenticationResult. + * @returns Returns authentication result, which is specified by AuthenticationResult. + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 6 * @deprecated since 8 */ execute(type: AuthType, level: SecureLevel, callback: AsyncCallback): void; @@ -117,23 +158,25 @@ declare namespace userAuth { /** * Get Authenticator instance. + * @returns Returns an Authenticator. * @syscap SystemCapability.UserIAM.UserAuth.Core - * @return Returns an Authenticator. * @deprecated since 8 */ function getAuthenticator(): Authenticator; /** * User authentication. - * @since 8 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.userIAM.userAuth.AuthInstance */ class UserAuth { /** * Constructor to get the UserAuth class instance. - * @since 8 + * @returns Returns the UserAuth class instance. * @syscap SystemCapability.UserIAM.UserAuth.Core - * @return Returns the UserAuth class instance. + * @since 8 * @deprecated since 9 * @useinstead ohos.userIAM.userAuth.getAuthInstance */ @@ -141,10 +184,10 @@ declare namespace userAuth { /** * Get version information. - * @since 8 - * @syscap SystemCapability.UserIAM.UserAuth.Core * @permission ohos.permission.ACCESS_BIOMETRIC - * @return Returns version information. + * @returns Returns version information. + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 * @deprecated since 9 * @useinstead ohos.userIAM.userAuth.getVersion */ @@ -152,12 +195,12 @@ declare namespace userAuth { /** * Check whether the authentication capability is available. - * @since 8 - * @syscap SystemCapability.UserIAM.UserAuth.Core * @permission ohos.permission.ACCESS_BIOMETRIC * @param authType Credential type for authentication. * @param authTrustLevel Trust level of authentication result. - * @return Returns a check result, which is specified by getAvailableStatus. + * @returns Returns a check result, which is specified by getAvailableStatus. + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 * @deprecated since 9 * @useinstead ohos.userIAM.userAuth.getAvailableStatus */ @@ -165,42 +208,50 @@ declare namespace userAuth { /** * Executes authentication. - * @since 8 - * @syscap SystemCapability.UserIAM.UserAuth.Core * @permission ohos.permission.ACCESS_BIOMETRIC - * @param challenge pass in challenge value. - * @param authType type of authentication. + * @param challenge Pass in challenge value. + * @param authType Type of authentication. * @param authTrustLevel Trust level of authentication result. - * @param callback Return result and acquireinfo through callback. - * @return Returns ContextId for cancel. + * @param callback Return result and acquireInfo through callback. + * @returns Returns ContextId for cancel. + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 * @deprecated since 9 * @useinstead ohos.userIAM.userAuth.AuthInstance.start */ auth(challenge: Uint8Array, authType: UserAuthType, authTrustLevel: AuthTrustLevel, callback: IUserAuthCallback): Uint8Array; /** - * Cancels authentication with ContextID. - * @since 8 - * @syscap SystemCapability.UserIAM.UserAuth.Core + * Cancel authentication with ContextID. * @permission ohos.permission.ACCESS_BIOMETRIC * @param contextID Cancel authentication and pass in ContextID. - * @return Returns a number value indicating whether Cancel authentication was successful. + * @returns Returns a number value indicating whether Cancel authentication was successful. + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 * @deprecated since 9 * @useinstead ohos.userIAM.userAuth.AuthInstance.cancel */ cancelAuth(contextID : Uint8Array) : number; } + /** + * Asynchronous callback of authentication operation. + * @interface IUserAuthCallback + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 + * @deprecated since 9 + * @useinstead ohos.userIAM.userAuth.AuthEvent + */ interface IUserAuthCallback { /** * The authentication result code is returned through the callback. - * @since 8 + * If the authentication is passed, the authentication token is returned in extraInfo, + * If the authentication fails, the remaining authentication times are returned in extraInfo, + * If the authentication executor is locked, the freezing time is returned in extraInfo. + * @param result Authentication result code. + * @param extraInfo Pass the specific information for different situation. * @syscap SystemCapability.UserIAM.UserAuth.Core - * @param result authentication result code. - * @param extraInfo pass the specific information for different situation. - * If the authentication is passed, the authentication token is returned in extrainfo, - * If the authentication fails, the remaining authentication times are returned in extrainfo, - * If the authentication executor is locked, the freezing time is returned in extrainfo. + * @since 8 * @deprecated since 9 * @useinstead ohos.userIAM.userAuth.AuthEvent.callback */ @@ -208,11 +259,11 @@ declare namespace userAuth { /** * During an authentication, the TipsCode is returned through the callback. - * @since 8 + * @param module The executor type for authentication. + * @param acquire The tip code for different authentication executor. + * @param extraInfo Reserved parameter. * @syscap SystemCapability.UserIAM.UserAuth.Core - * @param module the executor type for authentication. - * @param acquire the tip code for different authentication executor. - * @param extraInfo reserved parameter. + * @since 8 * @deprecated since 9 * @useinstead ohos.userIAM.userAuth.AuthEvent.callback */ @@ -221,291 +272,322 @@ declare namespace userAuth { /** * Authentication result: authentication token, remaining authentication times, freezing time. - * @since 8 + * @typedef AuthResult * @syscap SystemCapability.UserIAM.UserAuth.Core - * @param token pass the authentication result if the authentication is passed. - * @param remainTimes return the remaining authentication times if the authentication fails. - * @param freezingTime return the freezing time if the authectication executor is locked. + * @since 8 * @deprecated since 9 * @useinstead ohos.userIAM.userAuth.AuthResultInfo */ interface AuthResult { + /** + * The authentication result if the authentication is passed. + * @type {Uint8Array} + * @since 8 + */ token ?: Uint8Array; + + /** + * The remaining authentication times if the authentication fails. + * @type {number} + * @since 8 + */ remainTimes ?: number; + + /** + * The freezing time if the authentication executor is locked. + * @type {number} + * @since 8 + */ freezingTime ?: number; } /** - * Result code. - * @since 8 + * Enum for operation result. + * @enum {number} * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 * @deprecated since 9 * @useinstead ohos.userIAM.userAuth.ResultCodeV9 */ enum ResultCode { /** * Indicates that the result is success or ability is supported. - * @since 8 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 + * @deprecated since 9 */ SUCCESS = 0, /** * Indicates the the result is failure or ability is not supported. - * @since 8 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 + * @deprecated since 9 */ FAIL = 1, /** * Indicates other errors. - * @since 8 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 + * @deprecated since 9 */ GENERAL_ERROR = 2, /** * Indicates that this operation has been canceled. - * @since 8 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 + * @deprecated since 9 */ CANCELED = 3, /** * Indicates that this operation has timed out. - * @since 8 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 + * @deprecated since 9 */ TIMEOUT = 4, /** * Indicates that this authentication type is not supported. - * @since 8 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 + * @deprecated since 9 */ TYPE_NOT_SUPPORT = 5, /** * Indicates that the authentication trust level is not supported. - * @since 8 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 + * @deprecated since 9 */ TRUST_LEVEL_NOT_SUPPORT = 6, /** * Indicates that the authentication task is busy. Wait for a few seconds and try again. - * @since 8 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 + * @deprecated since 9 */ BUSY = 7, /** * Indicates incorrect parameters. - * @since 8 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 + * @deprecated since 9 */ INVALID_PARAMETERS = 8, /** * Indicates that the authenticator is locked. - * @since 8 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 + * @deprecated since 9 */ LOCKED = 9, /** * Indicates that the user has not enrolled the authenticator. - * @since 8 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 + * @deprecated since 9 */ NOT_ENROLLED = 10 } /** - * Indicates the enumeration of prompt codes in the process of face authentication. - * @since 8 + * The enumeration of prompt codes in the process of face authentication. + * @enum {number} * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 */ enum FaceTips { /** * Indicates that the obtained facial image is too bright due to high illumination. - * @since 8 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 */ FACE_AUTH_TIP_TOO_BRIGHT = 1, /** * Indicates that the obtained facial image is too dark due to low illumination. - * @since 8 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 */ FACE_AUTH_TIP_TOO_DARK = 2, /** * Indicates that the face is too close to the device. - * @since 8 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 */ FACE_AUTH_TIP_TOO_CLOSE = 3, /** * Indicates that the face is too far away from the device. - * @since 8 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 */ FACE_AUTH_TIP_TOO_FAR = 4, /** * Indicates that the device is too high, and that only the upper part of the face is captured. - * @since 8 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 */ FACE_AUTH_TIP_TOO_HIGH = 5, /** * Indicates that the device is too low, and that only the lower part of the face is captured. - * @since 8 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 */ FACE_AUTH_TIP_TOO_LOW = 6, /** * Indicates that the device is deviated to the right, and that only the right part of the face is captured. - * @since 8 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 */ FACE_AUTH_TIP_TOO_RIGHT = 7, /** * Indicates that the device is deviated to the left, and that only the left part of the face is captured. - * @since 8 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 */ FACE_AUTH_TIP_TOO_LEFT = 8, /** * Indicates that the face moves too fast during facial information collection. - * @since 8 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 */ FACE_AUTH_TIP_TOO_MUCH_MOTION = 9, /** * Indicates that the face is not facing the device. - * @since 8 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 */ FACE_AUTH_TIP_POOR_GAZE = 10, /** * Indicates that no face is detected. - * @since 8 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 */ FACE_AUTH_TIP_NOT_DETECTED = 11, } /** - * Indicates the enumeration of prompt codes in the process of fingerprint authentication. - * @since 8 + * The enumeration of prompt codes in the process of fingerprint authentication. + * @enum {number} * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 */ enum FingerprintTips { /** * Indicates that the image acquired is good. - * @since 8 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 */ FINGERPRINT_AUTH_TIP_GOOD = 0, /** * Indicates that the fingerprint image is too noisy due to suspected or detected dirt on sensor. - * @since 8 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 */ FINGERPRINT_AUTH_TIP_DIRTY = 1, /** * Indicates that the fingerprint image is too noisy to process due to a detected condition. - * @since 8 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 */ FINGERPRINT_AUTH_TIP_INSUFFICIENT = 2, /** * Indicates that only a partial fingerprint image is detected. - * @since 8 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 */ FINGERPRINT_AUTH_TIP_PARTIAL = 3, /** * Indicates that the fingerprint image is incomplete due to quick motion. - * @since 8 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 */ FINGERPRINT_AUTH_TIP_TOO_FAST = 4, /** * Indicates that the fingerprint image is unreadable due to lack of motion. - * @since 8 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 */ FINGERPRINT_AUTH_TIP_TOO_SLOW = 5 } /** * Credential type for authentication. - * @since 8 + * @enum {number} * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 */ enum UserAuthType { /** * Authentication type face. - * @since 8 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 */ FACE = 2, /** * Authentication type fingerprint. - * @since 8 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 */ FINGERPRINT = 4 } /** * Trust level of authentication results. - * @since 8 + * @enum {number} * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 */ enum AuthTrustLevel { /** * Authentication result trusted level 1. - * @since 8 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 */ ATL1 = 10000, /** * Authentication result trusted level 2. - * @since 8 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 */ ATL2 = 20000, /** * Authentication result trusted level 3. - * @since 8 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 */ ATL3 = 30000, /** * Authentication result trusted level 4. - * @since 8 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 8 */ ATL4 = 40000 } @@ -518,215 +600,255 @@ declare namespace userAuth { /** * Return information of Authentication events. - * @since 9 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 9 */ type EventInfo = AuthResultInfo | TipInfo; + /** + * Asynchronous callback of authentication event. + * @interface AuthEvent + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 9 + */ interface AuthEvent { /** * The authentication event callback. - * @since 9 - * @syscap SystemCapability.UserIAM.UserAuth.Core * @param result Event info. + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 9 */ callback(result: EventInfo): void; } /** - * Authentication result: authentication token, remaining authentication attempts, lockout duration. - * @since 9 + * Authentication result information. + * @typedef AuthResultInfo * @syscap SystemCapability.UserIAM.UserAuth.Core - * @param result Authentication result. - * @param token Pass the authentication token if the authentication is passed. - * @param remainAttempts Return the remaining authentication attempts if the authentication fails. - * @param lockoutDuration Return the lockout duration if the authectication executor is locked. + * @since 9 */ interface AuthResultInfo { + /** + * The authentication result. + * @type {number} + * @since 9 + */ result : number; + + /** + * The authentication token if the authentication is passed. + * @type {Uint8Array} + * @since 9 + */ token ?: Uint8Array; + + /** + * The remaining authentication attempts if the authentication fails. + * @type {number} + * @since 9 + */ remainAttempts ?: number; + + /** + * The lockout duration if the authentication executor is locked. + * @type {number} + * @since 9 + */ lockoutDuration ?: number; } /** * Authentication tip info. - * @since 9 + * @typedef TipInfo * @syscap SystemCapability.UserIAM.UserAuth.Core - * @param module Authentication module. - * @param tip Tip information, used to prompt the business to perform some operations. + * @since 9 */ interface TipInfo { + /** + * The authentication module of sending tip information. + * @type {number} + * @since 9 + */ module : number; + + /** + * Tip information, used to prompt the business to perform some operations. + * @type {number} + * @since 9 + */ tip : number; } /** - * Authentication instance, used to initiate a complete authentication - * @since 9 + * Authentication instance, used to initiate a complete authentication. + * @interface AuthInstance * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 9 */ interface AuthInstance { /** * Turn on authentication event listening. - * @since since 9 - * @syscap SystemCapability.UserIAM.UserAuth.Core * @param name Event name. * @param callback Event information return. + * @throws { BusinessError } 401 - Incorrect parameters. * @throws { BusinessError } 12500002 - General operation error. - * @throws { BusinessError } 12500008 - Incorrect parameters. + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since since 9 */ on: (name: AuthEventKey, callback: AuthEvent) => void; /** * Turn off authentication event listening. - * @since since 9 - * @syscap SystemCapability.UserIAM.UserAuth.Core * @param name Event name. + * @throws { BusinessError } 401 - Incorrect parameters. * @throws { BusinessError } 12500002 - General operation error. - * @throws { BusinessError } 12500008 - Incorrect parameters. + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since since 9 */ off: (name: AuthEventKey) => void; /** * Start this authentication, an instance can only perform authentication once. - * @since since 9 - * @syscap SystemCapability.UserIAM.UserAuth.Core * @permission ohos.permission.ACCESS_BIOMETRIC - * @throws { BusinessError } 12500001 - Execution failed. + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 401 - Incorrect parameters. * @throws { BusinessError } 12500002 - General operation error. - * @throws { BusinessError } 12500008 - Incorrect parameters. + * @throws { BusinessError } 12500005 - The authentication type is not supported. + * @throws { BusinessError } 12500006 - The authentication trust level is not supported. + * @throws { BusinessError } 12500010 - The type of credential has not been enrolled. + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since since 9 */ start: () => void; /** * Cancel this authentication. - * @since since 9 - * @syscap SystemCapability.UserIAM.UserAuth.Core * @permission ohos.permission.ACCESS_BIOMETRIC - * @throws { BusinessError } 12500001 - Execution failed. + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 401 - Incorrect parameters. * @throws { BusinessError } 12500002 - General operation error. + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since since 9 */ cancel: () => void; } /** * Get version information. - * @since 9 - * @syscap SystemCapability.UserIAM.UserAuth.Core * @permission ohos.permission.ACCESS_BIOMETRIC - * @return Returns version information. + * @returns Returns version information. + * @throws { BusinessError } 201 - Permission verification failed. * @throws { BusinessError } 12500002 - General operation error. + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 9 */ function getVersion(): number; /** * Check whether the authentication capability is available. - * @since 9 - * @syscap SystemCapability.UserIAM.UserAuth.Core * @permission ohos.permission.ACCESS_BIOMETRIC * @param authType Credential type for authentication. * @param authTrustLevel Trust level of authentication result. - * @throws { BusinessError } 12500001 - Execution failed. + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 401 - Incorrect parameters. * @throws { BusinessError } 12500002 - General operation error. * @throws { BusinessError } 12500005 - The authentication type is not supported. * @throws { BusinessError } 12500006 - The authentication trust level is not supported. - * @throws { BusinessError } 12500008 - Incorrect parameters. + * @throws { BusinessError } 12500010 - The type of credential has not been enrolled. + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 9 */ function getAvailableStatus(authType : UserAuthType, authTrustLevel : AuthTrustLevel): void; /** * Get Authentication instance. - * @since 9 - * @syscap SystemCapability.UserIAM.UserAuth.Core - * @return Returns an authentication instance. + * @param challenge Pass in challenge value. + * @param authType Credential type for authentication. + * @param authTrustLevel Trust level of authentication result. + * @returns Returns an authentication instance. + * @throws { BusinessError } 401 - Incorrect parameters. * @throws { BusinessError } 12500002 - General operation error. * @throws { BusinessError } 12500005 - The authentication type is not supported. * @throws { BusinessError } 12500006 - The authentication trust level is not supported. - * @throws { BusinessError } 12500008 - Incorrect parameters. + * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 9 */ function getAuthInstance(challenge : Uint8Array, authType : UserAuthType, authTrustLevel : AuthTrustLevel): AuthInstance; /** - * Result code. - * @since 9 + * Enum for operation result. + * @enum {number} * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 9 */ enum ResultCodeV9 { /** * Indicates that the result is success or ability is supported. - * @since 9 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 9 */ SUCCESS = 12500000, /** * Indicates the result is failure or ability is not supported. - * @since 9 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 9 */ FAIL = 12500001, /** * Indicates other errors. - * @since 9 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 9 */ GENERAL_ERROR = 12500002, /** * Indicates that this operation is canceled. - * @since 9 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 9 */ CANCELED = 12500003, /** * Indicates that this operation is time-out. - * @since 9 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 9 */ TIMEOUT = 12500004, /** * Indicates that this authentication type is not supported. - * @since 9 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 9 */ TYPE_NOT_SUPPORT = 12500005, /** * Indicates that the authentication trust level is not supported. - * @since 9 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 9 */ TRUST_LEVEL_NOT_SUPPORT = 12500006, /** * Indicates that the authentication task is busy. Wait for a few seconds and try again. - * @since 9 * @syscap SystemCapability.UserIAM.UserAuth.Core - */ - BUSY = 12500007, - - /** - * Indicates incorrect parameters. * @since 9 - * @syscap SystemCapability.UserIAM.UserAuth.Core */ - INVALID_PARAMETERS = 12500008, + BUSY = 12500007, /** * Indicates that the authenticator is locked. - * @since 9 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 9 */ LOCKED = 12500009, /** * Indicates that the user has not enrolled the authenticator. - * @since 9 * @syscap SystemCapability.UserIAM.UserAuth.Core + * @since 9 */ NOT_ENROLLED = 12500010 } diff --git a/api/@ohos.util.ArrayList.d.ts b/api/@ohos.util.ArrayList.d.ts index ac7174e4977125fb5714fad3183010d4622794f7..4e5a2e0a4c252037fad72e7e55d501deab31f5a4 100644 --- a/api/@ohos.util.ArrayList.d.ts +++ b/api/@ohos.util.ArrayList.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 @@ -12,9 +12,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + declare class ArrayList { /** * A constructor used to create a ArrayList object. + * @throws { BusinessError } 10200012 - The ArrayList's constructor cannot be directly invoked. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -29,6 +31,7 @@ declare class ArrayList { * Appends the specified element to the end of this arraylist. * @param element to be appended to this arraylist * @returns the boolean type, returns true if the addition is successful, and returns false if it fails. + * @throws { BusinessError } 10200011 - The add method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -39,7 +42,9 @@ declare class ArrayList { * any subsequent elements to the right (adds one to their index). * @param index index at which the specified element is to be inserted * @param element element to be inserted - * @throws If index is greater than or equal to length, or less than 0, an exception is thrown and cannot be inserted + * @throws { BusinessError } 10200001 - The type of parameters are out of range. + * @throws { BusinessError } 10200011 - The insert method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -47,7 +52,8 @@ declare class ArrayList { /** * Check if arraylist contains the specified element * @param element element to be contained - * @return the boolean type,if arraylist contains the specified element,return true,else return false + * @returns the boolean type,if arraylist contains the specified element,return true,else return false + * @throws { BusinessError } 10200011 - The has method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -56,7 +62,8 @@ declare class ArrayList { * Returns the index of the first occurrence of the specified element * in this arraylist, or -1 if this arraylist does not contain the element. * @param element element to be contained - * @return the number type ,returns the lowest index such that or -1 if there is no such index. + * @returns the number type ,returns the lowest index such that or -1 if there is no such index. + * @throws { BusinessError } 10200011 - The getIndexOf method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -65,8 +72,10 @@ declare class ArrayList { * Find the corresponding element according to the index, * delete the element, and move the index of all elements to the right of the element forward by one. * @param index the index in the arraylist - * @return the T type ,returns undefined if arraylist is empty,If the index is - * out of bounds (greater than or equal to length or less than 0), throw an exception + * @returns the T type ,returns undefined if arraylist is empty,If the index is + * @throws { BusinessError } 10200001 - The type of parameters are out of range. + * @throws { BusinessError } 10200011 - The removeByIndex method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -76,7 +85,8 @@ declare class ArrayList { * if it is present. If the arraylist does not contain the element, it is * unchanged. More formally, removes the element with the lowest index * @param element element to remove - * @return the boolean type ,If there is no such element, return false + * @returns the boolean type ,If there is no such element, return false + * @throws { BusinessError } 10200011 - The remove method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -85,7 +95,8 @@ declare class ArrayList { * Returns in the index of the last occurrence of the specified element in this arraylist , * or -1 if the arraylist does not contain the element. * @param element element to find - * @return the number type + * @returns the number type + * @throws { BusinessError } 10200011 - The getLastIndexOf method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -94,8 +105,9 @@ declare class ArrayList { * Removes from this arraylist all of the elements whose index is between fromIndex,inclusive,and toIndex ,exclusive. * @param fromIndex The starting position of the index, containing the value at that index position * @param toIndex the end of the index, excluding the value at that index - * @throws If the fromIndex is out of range (greater than or equal to length or less than 0), - * or if toIndex is less than fromIndex, an IndexOutOfBoundException is thrown + * @throws { BusinessError } 10200001 - The type of parameters are out of range. + * @throws { BusinessError } 10200011 - The removeByRange method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -109,11 +121,13 @@ declare class ArrayList { * @param arrlist (Optional) The arraylist object to which the current element belongs. * @param thisArg (Optional) The value passed to the function generally uses the "this" value. * If this parameter is empty, "undefined" will be passed to the "this" value + * @throws { BusinessError } 10200011 - The replaceAllElements method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ replaceAllElements(callbackfn: (value: T, index?: number, arrlist?: ArrayList) => T, - thisArg?: Object): void; + thisArg?: Object): void; /** * Executes a provided function once for each value in the arraylist object. * @param callbackfn (required) A function that accepts up to four arguments.The function to @@ -123,6 +137,8 @@ declare class ArrayList { * @param arrlist (Optional) The arraylist object to which the current element belongs. * @param thisArg (Optional) The value passed to the function generally uses the "this" value. * If this parameter is empty, "undefined" will be passed to the "this" value + * @throws { BusinessError } 10200011 - The forEach method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -137,6 +153,8 @@ declare class ArrayList { * @param firstValue (Optional) previous element * @param secondValue (Optional) next elements * If this parameter is empty, it will default to ASCII sorting + * @throws { BusinessError } 10200011 - The sort method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -145,8 +163,10 @@ declare class ArrayList { * Returns a view of the portion of this arraylist between the specified fromIndex,inclusize,and toIndex,exclusive * @param fromIndex The starting position of the index, containing the value at that index position * @param toIndex the end of the index, excluding the value at that index - * @throws If the fromIndex or toIndex index is out of range (greater than or equal to length or less than 0), - * or if toIndex is less than fromIndex, an IndexOutOfBoundException is thrown + * @throws { BusinessError } 10200001 - The type of parameters are out of range. + * @throws { BusinessError } 10200011 - The subArrayList method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. + * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -154,34 +174,39 @@ declare class ArrayList { /** * Removes all of the elements from this arraylist.The arraylist will * be empty after this call returns.length becomes 0 + * @throws { BusinessError } 10200011 - The clear method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ clear(): void; /** * Returns a shallow copy of this instance. (The elements themselves are not copied.) - * @return this arraylist instance + * @returns this arraylist instance + * @throws { BusinessError } 10200011 - The clone method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ clone(): ArrayList; /** * returns the capacity of this arraylist - * @return the number type + * @returns the number type + * @throws { BusinessError } 10200011 - The getCapacity method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ getCapacity(): number; /** * convert arraylist to array - * @return the Array type + * @returns the Array type + * @throws { BusinessError } 10200011 - The convertToArray method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ convertToArray(): Array; /** * Determine whether arraylist is empty and whether there is an element - * @return the boolean type + * @returns the boolean type + * @throws { BusinessError } 10200011 - The isEmpty method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -189,18 +214,22 @@ declare class ArrayList { /** * If the newCapacity provided by the user is greater than or equal to length, * change the capacity of the arraylist to newCapacity, otherwise the capacity will not be changed + * @throws { BusinessError } 10200011 - The increaseCapacityTo method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ increaseCapacityTo(newCapacity: number): void; /** * Limit the capacity to the current length + * @throws { BusinessError } 10200011 - The trimToCurrentLength method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ trimToCurrentLength(): void; /** * returns an iterator.Each item of the iterator is a Javascript Object + * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ diff --git a/api/@ohos.util.Deque.d.ts b/api/@ohos.util.Deque.d.ts index b8b284b44a2d6abcc82c9f3f845a7daf743870cf..8591d7d411377cd3dbf4e8580be96219ae220076 100644 --- a/api/@ohos.util.Deque.d.ts +++ b/api/@ohos.util.Deque.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 @@ -12,9 +12,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + declare class Deque { /** * A constructor used to create a Deque object. + * @throws { BusinessError } 10200012 - The Deque's constructor cannot be directly invoked. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -28,6 +30,7 @@ declare class Deque { /** * Inserts an element into the deque header. * @param element to be appended to this deque + * @throws { BusinessError } 10200011 - The insertFront method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -35,6 +38,7 @@ declare class Deque { /** * Inserting an element at the end of a deque * @param element to be appended to this deque + * @throws { BusinessError } 10200011 - The insertEnd method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -42,38 +46,40 @@ declare class Deque { /** * Check if deque contains the specified element * @param element element to be contained - * @return the boolean type,if deque contains the specified element,return true,else return false + * @returns the boolean type,if deque contains the specified element,return true,else return false + * @throws { BusinessError } 10200011 - The has method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ has(element: T): boolean; /** * Obtains the header element of a deque. - * @return the T type + * @returns the T type + * @throws { BusinessError } 10200011 - The getFirst method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ getFirst(): T; /** * Obtains the end element of a deque. - * @return the T type - * @throws an exception if the queue is empty + * @returns the T type + * @throws { BusinessError } 10200011 - The getLast method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ getLast(): T; /** * Obtains the header element of a deque and delete the element. - * @return the T type - * @throws an exception if the deque is empty + * @returns the T type + * @throws { BusinessError } 10200011 - The popFirst method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ popFirst(): T; /** * Obtains the end element of a deque and delete the element. - * @return the T type - * @throws an exception if the deque is empty + * @returns the T type + * @throws { BusinessError } 10200011 - The popLast method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -86,6 +92,8 @@ declare class Deque { * @param deque (Optional) The deque object to which the current element belongs. * @param thisArg (Optional) The value passed to the function generally uses the "this" value. * If this parameter is empty, "undefined" will be passed to the "this" value + * @throws { BusinessError } 401 - The type of parameters are invalid. + * @throws { BusinessError } 10200011 - The forEach method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -93,6 +101,7 @@ declare class Deque { thisArg?: Object): void; /** * returns an iterator.Each item of the iterator is a Javascript Object + * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ diff --git a/api/@ohos.util.HashMap.d.ts b/api/@ohos.util.HashMap.d.ts index db6a86247baa4b3e78694a1eb9ba067168dc6964..e565fbd938e43af30e1bfb137b726700dcba18f6 100644 --- a/api/@ohos.util.HashMap.d.ts +++ b/api/@ohos.util.HashMap.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 @@ -12,9 +12,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + declare class HashMap { /** * A constructor used to create a HashMap object. + * @throws { BusinessError } 10200012 - The HashMap's constructor cannot be directly invoked. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -27,7 +29,8 @@ declare class HashMap { length: number; /** * Returns whether the Map object contains elements - * @return the boolean type + * @returns the boolean type + * @throws { BusinessError } 10200011 - The isEmpty method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -35,7 +38,8 @@ declare class HashMap { /** * Returns whether a key is contained in this map * @param key need to determine whether to include the key - * @return the boolean type + * @returns the boolean type + * @throws { BusinessError } 10200011 - The hasKey method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -43,7 +47,8 @@ declare class HashMap { /** * Returns whether a value is contained in this map * @param value need to determine whether to include the value - * @return the boolean type + * @returns the boolean type + * @throws { BusinessError } 10200011 - The hasValue method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -51,7 +56,8 @@ declare class HashMap { /** * Returns a specified element in a Map object, or null if there is no corresponding element * @param key the index in HashMap - * @return value or null + * @returns value or null + * @throws { BusinessError } 10200011 - The get method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -59,6 +65,8 @@ declare class HashMap { /** * Adds all element groups in one map to another map * @param map the Map object to add members + * @throws { BusinessError } 10200011 - The setAll method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -68,6 +76,8 @@ declare class HashMap { * @param key Added or updated targets * @param value Added or updated value * @returns the map object after set + * @throws { BusinessError } 10200011 - The set method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -75,25 +85,29 @@ declare class HashMap { /** * Remove a specified element from a Map object * @param key Target to be deleted - * @return Target mapped value + * @returns Target mapped value + * @throws { BusinessError } 10200011 - The remove method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ remove(key: K): V; /** * Clear all element groups in the map + * @throws { BusinessError } 10200011 - The clear method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ clear(): void; /** * Returns a new Iterator object that contains the keys contained in this map + * @throws { BusinessError } 10200011 - The keys method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ keys(): IterableIterator; /** * Returns a new Iterator object that contains the values contained in this map + * @throws { BusinessError } 10200011 - The values method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -103,6 +117,7 @@ declare class HashMap { * @param key Updated targets * @param newValue Updated the target mapped value * @returns the boolean type(Is there a target pointed to by the key) + * @throws { BusinessError } 10200011 - The replace method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -110,6 +125,8 @@ declare class HashMap { /** * Executes the given callback function once for each real key in the map. * It does not perform functions on deleted keys + * @throws { BusinessError } 10200011 - The forEach method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -117,12 +134,14 @@ declare class HashMap { thisArg?: Object): void; /** * Returns a new Iterator object that contains the [key, value] pairs for each element in the Map object in insertion order + * @throws { BusinessError } 10200011 - The entries method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ entries(): IterableIterator<[K, V]>; /** * returns an iterator.Each item of the iterator is a Javascript Object + * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ diff --git a/api/@ohos.util.HashSet.d.ts b/api/@ohos.util.HashSet.d.ts index 88c292927a8e856c7d133e020cc42fe3ed8a9204..4d270bf8210cd17314956e8778d1036568f2e892 100644 --- a/api/@ohos.util.HashSet.d.ts +++ b/api/@ohos.util.HashSet.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 @@ -12,9 +12,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + declare class HashSet { /** * A constructor used to create a HashSet object. + * @throws { BusinessError } 10200012 - The HashSet's constructor cannot be directly invoked. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -27,7 +29,8 @@ declare class HashSet { length: number; /** * Returns whether the Set object contains elements - * @return the boolean type + * @returns the boolean type + * @throws { BusinessError } 10200011 - The isEmpty method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -35,7 +38,9 @@ declare class HashSet { /** * Returns whether the Set object contain s the elements * @param value need to determine whether to include the element - * @return the boolean type + * @returns the boolean type + * @throws { BusinessError } 10200011 - The has method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -44,6 +49,8 @@ declare class HashSet { * If the set does not contain the element, the specified element is added * @param value Added element * @returns the boolean type(Is there contain this element) + * @throws { BusinessError } 10200011 - The add method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -51,19 +58,24 @@ declare class HashSet { /** * Remove a specified element from a Set object * @param value Target to be deleted - * @return the boolean type(Is there contain this element) + * @returns the boolean type(Is there contain this element) + * @throws { BusinessError } 10200011 - The remove method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ - remove(value: T): boolean; + remove(value: T): boolean; /** * Clears all element groups in a set + * @throws { BusinessError } 10200011 - The clear method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ clear(): void; /** * Executes a provided function once for each value in the Set object. + * @throws { BusinessError } 10200011 - The forEach method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -71,18 +83,21 @@ declare class HashSet { thisArg?: Object): void; /** * Returns a new Iterator object that contains the values contained in this set + * @throws { BusinessError } 10200011 - The values method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ values(): IterableIterator; /** * Returns a new Iterator object that contains the [key, value] pairs for each element in the Set object in insertion order + * @throws { BusinessError } 10200011 - The entries method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ entries(): IterableIterator<[T, T]>; /** * returns an iterator.Each item of the iterator is a Javascript Object + * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ diff --git a/api/@ohos.util.LightWeightMap.d.ts b/api/@ohos.util.LightWeightMap.d.ts index cc34b5dfbf3ce63e4f09c309eef727a14da94b55..e8e29b62d1c7c5841f5158e0d3484043e06bc8df 100644 --- a/api/@ohos.util.LightWeightMap.d.ts +++ b/api/@ohos.util.LightWeightMap.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 @@ -12,9 +12,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + declare class LightWeightMap { /** * A constructor used to create a LightWeightMap object. + * @throws { BusinessError } 10200012 - The LightWeightMap's constructor cannot be directly invoked. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -28,7 +30,9 @@ declare class LightWeightMap { /** * Returns whether this map has all the object in a specified map * @param map the Map object to compare - * @return the boolean type + * @returns the boolean type + * @throws { BusinessError } 401 - The type of parameters are invalid. + * @throws { BusinessError } 10200011 - The hasAll method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -36,7 +40,8 @@ declare class LightWeightMap { /** * Returns whether a key is contained in this map * @param key need to determine whether to include the key - * @return the boolean type + * @returns the boolean type + * @throws { BusinessError } 10200011 - The hasKey method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -44,7 +49,8 @@ declare class LightWeightMap { /** * Returns whether a value is contained in this map * @param value need to determine whether to include the value - * @return the boolean type + * @returns the boolean type + * @throws { BusinessError } 10200011 - The hasValue method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -53,12 +59,15 @@ declare class LightWeightMap { * Ensures that the capacity of an LightWeightMap container is greater than or equal to a apecified value, * and that the container has all the original objects after capacity expansion * @param minimumCapacity Minimum capacity to be reserved + * @throws { BusinessError } 10200011 - The increaseCapacityTo method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ increaseCapacityTo(minimumCapacity: number): void; /** * Returns a new Iterator object that contains the [key, value] pairs for each element in the Map object in insertion order + * @throws { BusinessError } 10200011 - The entries method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -66,7 +75,8 @@ declare class LightWeightMap { /** * Returns the value to which the specified key is mapped, or undefined if this map contains no mapping for the key * @param key the index in LightWeightMap - * @return value or undefined + * @returns value or undefined + * @throws { BusinessError } 10200011 - The get method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -74,7 +84,8 @@ declare class LightWeightMap { /** * Obtains the index of the key equal to a specified key in an LightWeightMap container * @param key Looking for goals - * @return Subscript corresponding to target + * @returns Subscript corresponding to target + * @throws { BusinessError } 10200011 - The getIndexOfKey method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -82,28 +93,34 @@ declare class LightWeightMap { /** * Obtains the index of the value equal to a specified value in an LightWeightMap container * @param value Looking for goals - * @return Subscript corresponding to target + * @returns Subscript corresponding to target + * @throws { BusinessError } 10200011 - The getIndexOfValue method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ getIndexOfValue(value: V): number; /** * Returns whether the Map object contains elements - * @return the boolean type + * @returns the boolean type + * @throws { BusinessError } 10200011 - The isEmpty method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ isEmpty(): boolean; /** - * Obtains the key at the loaction identified by index in an LightWeightMap container + * Obtains the key at the location identified by index in an LightWeightMap container * @param index Target subscript for search - * @return the key of key-value pairs + * @returns the key of key-value pairs + * @throws { BusinessError } 10200011 - The getKeyAt method cannot be bound. + * @throws { BusinessError } 10200001 - The type of parameters are out of range. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ getKeyAt(index: number): K; /** * Obtains a ES6 iterator that contains all the keys of an LightWeightMap container + * @throws { BusinessError } 10200011 - The keys method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -111,6 +128,8 @@ declare class LightWeightMap { /** * Adds all element groups in one map to another map * @param map the Map object to add members + * @throws { BusinessError } 10200011 - The setAll method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -120,6 +139,7 @@ declare class LightWeightMap { * @param key Added or updated targets * @param value Added or updated value * @returns the map object after set + * @throws { BusinessError } 10200011 - The set method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -127,15 +147,18 @@ declare class LightWeightMap { /** * Remove the mapping for this key from this map if present * @param key Target to be deleted - * @return Target mapped value + * @returns Target mapped value + * @throws { BusinessError } 10200011 - The remove method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ remove(key: K): V; /** - * Deletes a key-value pair at the loaction identified by index from an LightWeightMap container + * Deletes a key-value pair at the location identified by index from an LightWeightMap container * @param index Target subscript for search - * @return the boolean type(Is there a delete value) + * @returns the boolean type(Is there a delete value) + * @throws { BusinessError } 10200011 - The removeAt method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -143,6 +166,7 @@ declare class LightWeightMap { /** * Removes all of the mapping from this map * The map will be empty after this call returns + * @throws { BusinessError } 10200011 - The clear method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -151,7 +175,10 @@ declare class LightWeightMap { * Sets the value identified by index in an LightWeightMap container to a specified value * @param index Target subscript for search * @param value Updated the target mapped value - * @return the boolean type(Is there a value corresponding to the subscript) + * @returns the boolean type(Is there a value corresponding to the subscript) + * @throws { BusinessError } 10200011 - The setValueAt method cannot be bound. + * @throws { BusinessError } 10200001 - The type of parameters are out of range. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -159,6 +186,8 @@ declare class LightWeightMap { /** * Executes the given callback function once for each real key in the map. * It does not perform functions on deleted keys + * @throws { BusinessError } 10200011 - The forEach method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -166,12 +195,14 @@ declare class LightWeightMap { thisArg?: Object): void; /** * returns an ES6 iterator.Each item of the iterator is a Javascript Object + * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ [Symbol.iterator](): IterableIterator<[K, V]>; /** * Obtains a string that contains all the keys and values in an LightWeightMap container + * @throws { BusinessError } 10200011 - The toString method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -179,13 +210,17 @@ declare class LightWeightMap { /** * Obtains the value identified by index in an LightWeightMap container * @param index Target subscript for search - * @return the value of key-value pairs + * @returns the value of key-value pairs + * @throws { BusinessError } 10200011 - The getValueAt method cannot be bound. + * @throws { BusinessError } 10200001 - The type of parameters are out of range. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ getValueAt(index: number): V; /** * Returns an iterator of the values contained in this map + * @throws { BusinessError } 10200011 - The values method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ diff --git a/api/@ohos.util.LightWeightSet.d.ts b/api/@ohos.util.LightWeightSet.d.ts index e882104ee87cb7c09e99f1c70d8670d9ba7cac29..236e4140ef501f68fb56b4f7adc7871cd7accfee 100644 --- a/api/@ohos.util.LightWeightSet.d.ts +++ b/api/@ohos.util.LightWeightSet.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 @@ -12,9 +12,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + declare class LightWeightSet { /** * A constructor used to create a LightWeightSet object. + * @throws { BusinessError } 10200012 - The LightWeightSet's constructor cannot be directly invoked. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -29,6 +31,7 @@ declare class LightWeightSet { * If the set does not contain the element, the specified element is added * @param value Added element * @returns the boolean type(Is there contain this element) + * @throws { BusinessError } 10200011 - The add method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -37,6 +40,8 @@ declare class LightWeightSet { * Adds all the objects in a specified LightWeightSet container to the current LightWeightSet container * @param set the Set object to provide the added element * @returns the boolean type(Is there any new data added successfully) + * @throws { BusinessError } 10200011 - The addAll method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -44,7 +49,9 @@ declare class LightWeightSet { /** * Returns whether this set has all the object in a specified set * @param set the Set object to compare - * @return the boolean type + * @returns the boolean type + * @throws { BusinessError } 10200011 - The hasAll method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -52,7 +59,8 @@ declare class LightWeightSet { /** * Checks whether an LightWeightSet container has a specified key * @param key need to determine whether to include the key - * @return the boolean type + * @returns the boolean type + * @throws { BusinessError } 10200011 - The has method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -60,7 +68,8 @@ declare class LightWeightSet { /** * Checks whether an the objects of an LightWeighSet containeer are of the same type as a specified Object LightWeightSet * @param obj need to determine whether to include the obj - * @return the boolean type + * @returns the boolean type + * @throws { BusinessError } 10200011 - The equal method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -69,6 +78,9 @@ declare class LightWeightSet { * Ensures that the capacity of an LightWeightSet container is greater than or equal to a apecified value, * and that the container has all the original objects after capacity expansion * @param minimumCapacity Minimum capacity to be reserved + * @throws { BusinessError } 10200011 - The increaseCapacityTo method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. + * @throws { BusinessError } 10200001 - The type of parameters are out of range. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -76,7 +88,8 @@ declare class LightWeightSet { /** * Obtains the index of s key of a specified Object type in an LightWeightSet container * @param key Looking for goals - * @return Subscript corresponding to target + * @returns Subscript corresponding to target + * @throws { BusinessError } 10200011 - The getIndexOf method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -84,15 +97,18 @@ declare class LightWeightSet { /** * Deletes an object of a specified Object type from an LightWeightSet container * @param key Target to be deleted - * @return Target element + * @returns Target element + * @throws { BusinessError } 10200011 - The remove method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ remove(key: T): T; /** - * Deletes an object at the loaction identified by index from an LightWeightSet container + * Deletes an object at the location identified by index from an LightWeightSet container * @param index Target subscript for search - * @return the boolean type(Is there a delete value) + * @returns the boolean type(Is there a delete value) + * @throws { BusinessError } 10200011 - The removeAt method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -100,6 +116,7 @@ declare class LightWeightSet { /** * Removes all of the mapping from this map * The map will be empty after this call returns + * @throws { BusinessError } 10200011 - The clear method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -107,6 +124,8 @@ declare class LightWeightSet { /** * Executes the given callback function once for each real key in the map. * It does not perform functions on deleted keys + * @throws { BusinessError } 10200011 - The forEach method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -114,6 +133,7 @@ declare class LightWeightSet { thisArg?: Object): void; /** * returns an ES6 iterator.Each item of the iterator is a Javascript Object + * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -126,6 +146,7 @@ declare class LightWeightSet { toString(): String; /** * Obtains an Array that contains all the objects of an LightWeightSet container. + * @throws { BusinessError } 10200011 - The toArray method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -133,25 +154,30 @@ declare class LightWeightSet { /** * Obtains the object at the location identified by index in an LightWeightSet container * @param index Target subscript for search - * @return the value of key-value pairs + * @returns the value of key-value pairs + * @throws { BusinessError } 10200011 - The getValueAt method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ getValueAt(index: number): T; /** * Returns a ES6 iterator of the values contained in this Set + * @throws { BusinessError } 10200011 - The values method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ values(): IterableIterator; /** * Returns a Iterator object that contains the [key, value] pairs for each element in the Set object in insertion order + * @throws { BusinessError } 10200011 - The entries method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ entries(): IterableIterator<[T, T]>; /** * Returns whether the set object contains elements + * @throws { BusinessError } 10200011 - The isEmpty method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ diff --git a/api/@ohos.util.LinkedList.d.ts b/api/@ohos.util.LinkedList.d.ts index e81ef5c4d2404ddac05c66bf8de1068439ccab00..755a9b17e28b771444ea1068bdb11b1bb8fc855e 100644 --- a/api/@ohos.util.LinkedList.d.ts +++ b/api/@ohos.util.LinkedList.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 @@ -12,9 +12,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + declare class LinkedList { /** * A constructor used to create a LinkedList object. + * @throws { BusinessError } 10200012 - The LinkedList's constructor cannot be directly invoked. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -29,6 +31,7 @@ declare class LinkedList { * Appends the specified element to the end of this linkedlist. * @param element to be appended to this linkedlist * @returns the boolean type, returns true if the addition is successful, and returns false if it fails. + * @throws { BusinessError } 10200011 - The add method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -37,7 +40,9 @@ declare class LinkedList { * Inserts the specified element at the specified position in this linkedlist. * @param index index at which the specified element is to be inserted * @param element element to be inserted - * @throws If index is greater than or equal to length, or less than 0, an exception is thrown and cannot be inserted + * @throws { BusinessError } 10200011 - The insert method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. + * @throws { BusinessError } 10200001 - The type of parameters are out of range. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -46,7 +51,9 @@ declare class LinkedList { * Returns the element at the specified position in this linkedlist, * or returns undefined if this linkedlist is empty * @param index specified position - * @return the T type + * @returns the T type + * @throws { BusinessError } 10200011 - The get method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -54,31 +61,34 @@ declare class LinkedList { /** * Inserts the specified element at the beginning of this LinkedList. * @param element the element to add + * @throws { BusinessError } 10200011 - The addFirst method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ addFirst(element: T): void; /** * Retrieves and removes the head (first element) of this linkedlist. - * @return the head of this list - * @throws NoSuchElementException if this linkedlist is empty + * @returns the head of this list + * @throws { BusinessError } 10200011 - The removeFirst method cannot be bound. + * @throws { BusinessError } 10200010 - Container is empty. * @since 8 * @syscap SystemCapability.Utils.Lang */ removeFirst(): T; /** * Removes and returns the last element from this linkedlist. - * @return the head of this list - * @throws NoSuchElementException if this linkedlist is empty + * @returns the head of this list + * @throws { BusinessError } 10200011 - The removeLast method cannot be bound. + * @throws { BusinessError } 10200010 - Container is empty. * @since 8 * @syscap SystemCapability.Utils.Lang - * */ removeLast(): T; /** * Check if linkedlist contains the specified element * @param element element to be contained - * @return the boolean type,if linkedList contains the specified element,return true,else return false + * @returns the boolean type,if linkedList contains the specified element,return true,else return false + * @throws { BusinessError } 10200011 - The has method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -87,7 +97,8 @@ declare class LinkedList { * Returns the index of the first occurrence of the specified element * in this linkedlist, or -1 if this linkedlist does not contain the element. * @param element element to be contained - * @return the number type ,returns the lowest index such that or -1 if there is no such index. + * @returns the number type ,returns the lowest index such that or -1 if there is no such index. + * @throws { BusinessError } 10200011 - The getIndexOf method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -95,8 +106,11 @@ declare class LinkedList { /** * Find the corresponding element according to the index, * @param index the index in the linkedlist - * @return the T type ,returns undefined if linkedlist is empty,If the index is + * @returns the T type ,returns undefined if linkedlist is empty,If the index is * out of bounds (greater than or equal to length or less than 0), throw an exception + * @throws { BusinessError } 10200011 - The removeByIndex method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. + * @throws { BusinessError } 10200001 - The type of parameters are out of range. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -106,7 +120,8 @@ declare class LinkedList { * if it is present. If the linkedlist does not contain the element, it is * unchanged. More formally, removes the element with the lowest index * @param element element to remove - * @return the boolean type ,If there is no such element, return false + * @returns the boolean type ,If there is no such element, return false + * @throws { BusinessError } 10200011 - The remove method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -116,7 +131,9 @@ declare class LinkedList { * if it is present. If the linkedlist does not contain the element, it is * unchanged. More formally, removes the element with the lowest index * @param element element to remove - * @return the boolean type ,If there is no such element, return false + * @returns the boolean type ,If there is no such element, return false + * @throws { BusinessError } 10200011 - The removeFirstFound method cannot be bound. + * @throws { BusinessError } 10200010 - Container is empty. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -126,7 +143,9 @@ declare class LinkedList { * if it is present. If the linkedlist does not contain the element, it is * unchanged. More formally, removes the element with the lowest index * @param element element to remove - * @return the boolean type ,If there is no such element, return false + * @returns the boolean type ,If there is no such element, return false + * @throws { BusinessError } 10200011 - The removeLastFound method cannot be bound. + * @throws { BusinessError } 10200010 - Container is empty. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -135,7 +154,8 @@ declare class LinkedList { * Returns in the index of the last occurrence of the specified element in this linkedlist , * or -1 if the linkedlist does not contain the element. * @param element element to find - * @return the number type + * @returns the number type + * @throws { BusinessError } 10200011 - The getLastIndexOf method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -143,7 +163,8 @@ declare class LinkedList { /** * Returns the first element (the item at index 0) of this linkedlist. * or returns undefined if linkedlist is empty - * @return the T type ,returns undefined if linkedList is empty + * @returns the T type ,returns undefined if linkedList is empty + * @throws { BusinessError } 10200011 - The getFirst method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -151,7 +172,8 @@ declare class LinkedList { /** * Returns the Last element (the item at index length-1) of this linkedlist. * or returns undefined if linkedlist is empty - * @return the T type ,returns undefined if linkedList is empty + * @returns the T type ,returns undefined if linkedList is empty + * @throws { BusinessError } 10200011 - The getLast method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -160,7 +182,10 @@ declare class LinkedList { * Replaces the element at the specified position in this Vector with the specified element * @param element replaced element * @param index index to find - * @return the T type ,returns undefined if linkedList is empty + * @returns the T type ,returns undefined if linkedList is empty + * @throws { BusinessError } 10200011 - The set method cannot be bound. + * @throws { BusinessError } 10200001 - The type of parameters are out of range. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -174,6 +199,8 @@ declare class LinkedList { * @param LinkedList (Optional) The linkedlist object to which the current element belongs. * @param thisArg (Optional) The value passed to the function generally uses the "this" value. * If this parameter is empty, "undefined" will be passed to the "this" value + * @throws { BusinessError } 10200011 - The forEach method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -182,26 +209,30 @@ declare class LinkedList { /** * Removes all of the elements from this linkedlist.The linkedlist will * be empty after this call returns.length becomes 0 + * @throws { BusinessError } 10200011 - The clear method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ clear(): void; /** * Returns a shallow copy of this instance. (The elements themselves are not copied.) - * @return this linkedlist instance + * @returns this linkedlist instance + * @throws { BusinessError } 10200011 - The clone method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ clone(): LinkedList; /** * convert linkedlist to array - * @return the Array type + * @returns the Array type + * @throws { BusinessError } 10200011 - The convertToArray method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ convertToArray(): Array; /** * returns an iterator.Each item of the iterator is a Javascript Object + * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ diff --git a/api/@ohos.util.List.d.ts b/api/@ohos.util.List.d.ts index fa79586ecab781eea468a9c5ecab8cd710371a8d..657f82992ce096c3c50b2148d4cb70d05968a4aa 100644 --- a/api/@ohos.util.List.d.ts +++ b/api/@ohos.util.List.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 @@ -12,9 +12,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + declare class List { /** * A constructor used to create a List object. + * @throws { BusinessError } 10200012 - The List's constructor cannot be directly invoked. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -29,6 +31,7 @@ declare class List { * Appends the specified element to the end of this list. * @param element to be appended to this list * @returns the boolean type, returns true if the addition is successful, and returns false if it fails. + * @throws { BusinessError } 10200011 - The add method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -37,7 +40,9 @@ declare class List { * Inserts the specified element at the specified position in this list. * @param index index at which the specified element is to be inserted * @param element element to be inserted - * @throws If index is greater than or equal to length, or less than 0, an exception is thrown and cannot be inserted + * @throws { BusinessError } 10200011 - The insert method cannot be bound. + * @throws { BusinessError } 10200001 - The type of parameters are out of range. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -46,7 +51,9 @@ declare class List { * Returns the element at the specified position in this list, * or returns undefined if this list is empty * @param index specified position - * @return the T type + * @returns the T type + * @throws { BusinessError } 10200011 - The get method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -54,7 +61,8 @@ declare class List { /** * Check if list contains the specified element * @param element element to be contained - * @return the boolean type,if list contains the specified element,return true,else return false + * @returns the boolean type,if list contains the specified element,return true,else return false + * @throws { BusinessError } 10200011 - The has method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -63,7 +71,8 @@ declare class List { * Returns the index of the first occurrence of the specified element * in this list, or -1 if this list does not contain the element. * @param element element to be contained - * @return the number type ,returns the lowest index such that or -1 if there is no such index. + * @returns the number type ,returns the lowest index such that or -1 if there is no such index. + * @throws { BusinessError } 10200011 - The getIndexOf method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -71,8 +80,11 @@ declare class List { /** * Find the corresponding element according to the index, * @param index the index in the list - * @return the T type ,returns undefined if list is empty,If the index is + * @returns the T type ,returns undefined if list is empty,If the index is * out of bounds (greater than or equal to length or less than 0), throw an exception + * @throws { BusinessError } 10200011 - The removeByIndex method cannot be bound. + * @throws { BusinessError } 10200001 - The type of parameters are out of range. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -82,7 +94,8 @@ declare class List { * if it is present. If the list does not contain the element, it is * unchanged. More formally, removes the element with the lowest index * @param element element to remove - * @return the boolean type ,If there is no such element, return false + * @returns the boolean type ,If there is no such element, return false + * @throws { BusinessError } 10200011 - The remove method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -91,7 +104,8 @@ declare class List { * Returns in the index of the last occurrence of the specified element in this list , * or -1 if the list does not contain the element. * @param element element to find - * @return the number type + * @returns the number type + * @throws { BusinessError } 10200011 - The getLastIndexOf method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -99,7 +113,8 @@ declare class List { /** * Returns the first element (the item at index 0) of this list. * or returns undefined if list is empty - * @return the T type ,returns undefined if list is empty + * @returns the T type ,returns undefined if list is empty + * @throws { BusinessError } 10200011 - The getFirst method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -107,7 +122,8 @@ declare class List { /** * Returns the Last element (the item at index length-1) of this list. * or returns undefined if list is empty - * @return the T type ,returns undefined if list is empty + * @returns the T type ,returns undefined if list is empty + * @throws { BusinessError } 10200011 - The getLast method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -116,7 +132,10 @@ declare class List { * Replaces the element at the specified position in this List with the specified element * @param element replaced element * @param index index to find - * @return the T type + * @returns the T type + * @throws { BusinessError } 10200011 - The set method cannot be bound. + * @throws { BusinessError } 10200001 - The type of parameters are out of range. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -125,7 +144,8 @@ declare class List { * Compares the specified object with this list for equality.if the object are the same as this list * return true, otherwise return false. * @param obj Compare objects - * @return the boolean type + * @returns the boolean type + * @throws { BusinessError } 10200011 - The equal method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -139,6 +159,8 @@ declare class List { * @param List (Optional) The list object to which the current element belongs. * @param thisArg (Optional) The value passed to the function generally uses the "this" value. * If this parameter is empty, "undefined" will be passed to the "this" value + * @throws { BusinessError } 10200011 - The forEach method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -152,6 +174,8 @@ declare class List { * minus firstValue, it returns an list sorted in descending order; * @param firstValue (Optional) previous element * @param secondValue (Optional) next elements + * @throws { BusinessError } 401 - The type of parameters are invalid. + * @throws { BusinessError } 10200011 - The sort method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -159,6 +183,7 @@ declare class List { /** * Removes all of the elements from this list.The list will * be empty after this call returns.length becomes 0 + * @throws { BusinessError } 10200011 - The clear method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -167,8 +192,9 @@ declare class List { * Returns a view of the portion of this list between the specified fromIndex,inclusize,and toIndex,exclusive * @param fromIndex The starting position of the index, containing the value at that index position * @param toIndex the end of the index, excluding the value at that index - * @throws If the fromIndex or toIndex index is out of range (greater than or equal to length or less than 0), - * or if toIndex is less than fromIndex, an IndexOutOfBoundException is thrown + * @throws { BusinessError } 10200011 - The getSubList method cannot be bound. + * @throws { BusinessError } 10200001 - The type of parameters are out of range. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -182,27 +208,32 @@ declare class List { * @param list (Optional) The list object to which the current element belongs. * @param thisArg (Optional) The value passed to the function generally uses the "this" value. * If this parameter is empty, "undefined" will be passed to the "this" value + * @throws { BusinessError } 10200011 - The replaceAllElements method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ replaceAllElements(callbackfn: (value: T, index?: number, list?: List) => T, - thisArg?: Object): void; + thisArg?: Object): void; /** * convert list to array - * @return the Array type + * @returns the Array type + * @throws { BusinessError } 10200011 - The convertToArray method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ convertToArray(): Array; /** * Determine whether list is empty and whether there is an element - * @return the boolean type + * @returns the boolean type + * @throws { BusinessError } 10200011 - The isEmpty method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ isEmpty(): boolean; /** * returns an iterator.Each item of the iterator is a Javascript Object + * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ diff --git a/api/@ohos.util.PlainArray.d.ts b/api/@ohos.util.PlainArray.d.ts index 37012f6ad2a22f9b0648ae87ee8e4cbbd40609f4..1f7371770c5ebfa263264684f502f1f78fb47cd8 100644 --- a/api/@ohos.util.PlainArray.d.ts +++ b/api/@ohos.util.PlainArray.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 @@ -12,9 +12,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + declare class PlainArray { /** * A constructor used to create a PlainArray object. + * @throws { BusinessError } 10200012 - The PlainArray's constructor cannot be directly invoked. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -29,19 +31,22 @@ declare class PlainArray { * Appends a key-value pair to PlainArray * @param key Added the key of key-value * @param value Added the value of key-value - * @throws Throws this exception if input is invaild + * @throws { BusinessError } 10200011 - The add method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ add(key: number, value: T): void; /** * Clears the current PlainArray object + * @throws { BusinessError } 10200011 - The clear method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ clear(): void; /** * Obtains a clone of the current PlainArray object + * @throws { BusinessError } 10200011 - The clone method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -49,7 +54,9 @@ declare class PlainArray { /** * Checks whether the current PlainArray object contains the specified key * @param key need to determine whether to include the key - * @return the boolean type + * @returns the boolean type + * @throws { BusinessError } 10200011 - The has method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -57,7 +64,9 @@ declare class PlainArray { /** * Queries the value associated with the specified key * @param key Looking for goals - * @return the value of key-value pairs + * @returns the value of key-value pairs + * @throws { BusinessError } 10200011 - The get method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -65,22 +74,26 @@ declare class PlainArray { /** * Queries the index for a specified key * @param key Looking for goals - * @return Subscript corresponding to target + * @returns Subscript corresponding to target + * @throws { BusinessError } 10200011 - The getIndexOfKey method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ getIndexOfKey(key: number): number; /** - * Queries the index for a specified value - * @param value Looking for goals - * @return Subscript corresponding to target - * @since 8 - * @syscap SystemCapability.Utils.Lang - */ + * Queries the index for a specified value + * @param value Looking for goals + * @returns Subscript corresponding to target + * @throws { BusinessError } 10200011 - The getIndexOfValue method cannot be bound. + * @since 8 + * @syscap SystemCapability.Utils.Lang + */ getIndexOfValue(value: T): number; /** * Checks whether the current PlainArray object is empty - * @return the boolean type + * @returns the boolean type + * @throws { BusinessError } 10200011 - The isEmpty method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -88,7 +101,9 @@ declare class PlainArray { /** * Queries the key at a specified index * @param index Target subscript for search - * @return the key of key-value pairs + * @returns the key of key-value pairs + * @throws { BusinessError } 10200011 - The getKeyAt method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -96,7 +111,9 @@ declare class PlainArray { /** * Remove the key-value pair based on a specified key if it exists and return the value * @param key Target to be deleted - * @return Target mapped value + * @returns Target mapped value + * @throws { BusinessError } 10200011 - The remove method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -104,7 +121,9 @@ declare class PlainArray { /** * Remove the key-value pair at a specified index if it exists and return the value * @param index Target subscript for search - * @return the T type + * @returns the T type + * @throws { BusinessError } 10200011 - The removeAt method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -113,7 +132,10 @@ declare class PlainArray { * Remove a group of key-value pairs from a specified index * @param index remove start index * @param size Expected deletion quantity - * @return Actual deleted quantity + * @returns Actual deleted quantity + * @throws { BusinessError } 10200011 - The removeRangeFrom method cannot be bound. + * @throws { BusinessError } 10200001 - The type of parameters are out of range. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -122,12 +144,16 @@ declare class PlainArray { * Update value on specified index * @param index Target subscript for search * @param value Updated the target mapped value + * @throws { BusinessError } 10200011 - The setValueAt method cannot be bound. + * @throws { BusinessError } 10200001 - The type of parameters are out of range. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ setValueAt(index: number, value: T): void; /** * Obtains the string representation of the PlainArray object + * @throws { BusinessError } 10200011 - The toString method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -135,13 +161,18 @@ declare class PlainArray { /** * Queries the value at a specified index * @param index Target subscript for search - * @return the value of key-value pairs + * @returns the value of key-value pairs + * @throws { BusinessError } 10200011 - The getValueAt method cannot be bound. + * @throws { BusinessError } 10200001 - The type of parameters are out of range. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ getValueAt(index: number): T; /** * Executes a provided function once for each value in the PlainArray object. + * @throws { BusinessError } 10200011 - The forEach method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -149,6 +180,7 @@ declare class PlainArray { thisArg?: Object): void; /** * returns an iterator.Each item of the iterator is a Javascript Object + * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ diff --git a/api/@ohos.util.Queue.d.ts b/api/@ohos.util.Queue.d.ts index 69c2762bd43935e6c3daa47b1505bfc369257a2a..7a5795e56abd0fb01dd2e66c1a23c8fbfd9dfd24 100644 --- a/api/@ohos.util.Queue.d.ts +++ b/api/@ohos.util.Queue.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 @@ -12,9 +12,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + declare class Queue { /** * A constructor used to create a Queue object. + * @throws { BusinessError } 10200012 - The Queue's constructor cannot be directly invoked. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -29,23 +31,24 @@ declare class Queue { * Inserting specified element at the end of a queue if it is possible to do * so immediately without violating capacity restrictions. * @param element to be appended to this queue - * @return the boolean type + * @returns the boolean type + * @throws { BusinessError } 10200011 - The add method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ add(element: T): boolean; /** * Obtains the header element of a queue. - * @return the T type - * @throws an exception if the queue is empty + * @returns the T type + * @throws { BusinessError } 10200011 - The getFirst method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ getFirst(): T; /** * Retrieves and removes the head of this queue - * @return the T type - * @throws an exception if the queue is empty + * @returns the T type + * @throws { BusinessError } 10200011 - The pop method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -59,6 +62,8 @@ declare class Queue { * @param Queue (Optional) The queue object to which the current element belongs. * @param thisArg (Optional) The value passed to the function generally uses the "this" value. * If this parameter is empty, "undefined" will be passed to the "this" value + * @throws { BusinessError } 10200011 - The forEach method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -66,6 +71,7 @@ declare class Queue { thisArg?: Object): void; /** * returns an iterator.Each item of the iterator is a Javascript Object + * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ diff --git a/api/@ohos.util.Stack.d.ts b/api/@ohos.util.Stack.d.ts index 59ef60e5d47745ca24830a0eadbadfea0a8ae659..b3113cebfdfa9630edab8e91a245efc87a9a5d8c 100644 --- a/api/@ohos.util.Stack.d.ts +++ b/api/@ohos.util.Stack.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 @@ -12,9 +12,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + declare class Stack { /** * A constructor used to create a Stack object. + * @throws { BusinessError } 10200012 - The Stack's constructor cannot be directly invoked. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -27,15 +29,17 @@ declare class Stack { length: number; /** * Tests if this stack is empty - * @return the boolean type + * @returns the boolean type + * @throws { BusinessError } 10200011 - The isEmpty method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ isEmpty(): boolean; /** * Looks at the object at the top of this stack without removing it from the stack - * Return undfined if this stack is empty - * @return the top value or undefined + * Return undefined if this stack is empty + * @returns the top value or undefined + * @throws { BusinessError } 10200011 - The peek method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -44,6 +48,7 @@ declare class Stack { * Removes the object at the top of this stack and returns that object as the value of this function * an exception if the stack is empty * @returns Stack top value or undefined + * @throws { BusinessError } 10200011 - The pop method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -52,6 +57,7 @@ declare class Stack { * Pushes an item onto the top of this stack * @param item to be appended to this Stack * @returns the T type + * @throws { BusinessError } 10200011 - The push method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -60,6 +66,7 @@ declare class Stack { * Returns the 1-based position where an object is on this stack * @param element Target to be deleted * @returns the T type,If there is no such element, return -1 + * @throws { BusinessError } 10200011 - The locate method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -73,6 +80,8 @@ declare class Stack { * @param stack (Optional) The Stack object to which the current element belongs. * @param thisArg (Optional) The value passed to the function generally uses the "this" value. * If this parameter is empty, "undefined" will be passed to the "this" value + * @throws { BusinessError } 10200011 - The forEach method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -80,6 +89,7 @@ declare class Stack { thisArg?: Object): void; /** * returns an ES6 iterator.Each item of the iterator is a Javascript Object + * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ diff --git a/api/@ohos.util.TreeMap.d.ts b/api/@ohos.util.TreeMap.d.ts index 2b4647f18f5ec284cb51099c245152dd708c5f27..194a5af1517d74c7c5967e2d9065ba7638a29e65 100644 --- a/api/@ohos.util.TreeMap.d.ts +++ b/api/@ohos.util.TreeMap.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 @@ -12,12 +12,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + declare class TreeMap { + /** * A constructor used to create a TreeMap object. * @param comparator (Optional) User-defined comparison functions * @param firstValue (Optional) previous element * @param secondValue (Optional) next element + * @throws { BusinessError } 10200012 - The TreeMap's constructor cannot be directly invoked. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -30,7 +34,8 @@ declare class TreeMap { length: number; /** * Returns whether the Map object contains elements - * @return the boolean type + * @returns the boolean type + * @throws { BusinessError } 10200011 - The isEmpty method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -38,7 +43,8 @@ declare class TreeMap { /** * Returns whether a key is contained in this map * @param key need to determine whether to include the key - * @return the boolean type + * @returns the boolean type + * @throws { BusinessError } 10200011 - The hasKey method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -46,7 +52,8 @@ declare class TreeMap { /** * Returns whether a value is contained in this map * @param value need to determine whether to include the value - * @return the boolean type + * @returns the boolean type + * @throws { BusinessError } 10200011 - The hasValue method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -54,7 +61,8 @@ declare class TreeMap { /** * Returns a specified element in a Map object, or null if there is no corresponding element * @param key the index in TreeMap - * @return value or null + * @returns value or null + * @throws { BusinessError } 10200011 - The get method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -62,7 +70,8 @@ declare class TreeMap { /** * Obtains the first sorted key in the treemap. * Or returns undefined if tree map is empty - * @return value or undefined + * @returns value or undefined + * @throws { BusinessError } 10200011 - The getFirstKey method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -70,7 +79,8 @@ declare class TreeMap { /** * Obtains the last sorted key in the treemap. * Or returns undefined if tree map is empty - * @return value or undefined + * @returns value or undefined + * @throws { BusinessError } 10200011 - The getLastKey method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -78,6 +88,8 @@ declare class TreeMap { /** * Adds all element groups in one map to another map * @param map the Map object to add members + * @throws { BusinessError } 10200011 - The setAll method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -87,6 +99,8 @@ declare class TreeMap { * @param key Added or updated targets * @param value Added or updated value * @returns the map object after set + * @throws { BusinessError } 10200011 - The set method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -94,43 +108,49 @@ declare class TreeMap { /** * Remove a specified element from a Map object * @param key Target to be deleted - * @return Target mapped value + * @throws { BusinessError } 10200011 - The remove method cannot be bound. + * @returns Target mapped value * @since 8 * @syscap SystemCapability.Utils.Lang */ remove(key: K): V; /** * Clear all element groups in the map + * @throws { BusinessError } 10200011 - The clear method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ clear(): void; /** * Returns the greatest element smaller than or equal to the specified key - * if the key does not exist, undefied is returned + * if the key does not exist, undefined is returned * @param key Objective of comparison - * @return key or undefined + * @throws { BusinessError } 10200011 - The getLowerKey method cannot be bound. + * @returns key or undefined * @since 8 * @syscap SystemCapability.Utils.Lang */ getLowerKey(key: K): K; /** * Returns the least element greater than or equal to the specified key - * if the key does not exist, undefied is returned + * if the key does not exist, undefined is returned * @param key Objective of comparison - * @return key or undefined + * @returns key or undefined + * @throws { BusinessError } 10200011 - The getHigherKey method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ getHigherKey(key: K): K; /** * Returns a new Iterator object that contains the keys contained in this map + * @throws { BusinessError } 10200011 - The keys method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ keys(): IterableIterator; /** * Returns a new Iterator object that contains the values contained in this map + * @throws { BusinessError } 10200011 - The values method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -140,6 +160,7 @@ declare class TreeMap { * @param key Updated targets * @param value Updated the target mapped value * @returns the boolean type(Is there a target pointed to by the key) + * @throws { BusinessError } 10200011 - The replace method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -147,6 +168,8 @@ declare class TreeMap { /** * Executes the given callback function once for each real key in the map. * It does not perform functions on deleted keys + * @throws { BusinessError } 10200011 - The forEach method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -154,12 +177,14 @@ declare class TreeMap { thisArg?: Object): void; /** * Returns a new Iterator object that contains the [key, value] pairs for each element in the Map object in insertion order + * @throws { BusinessError } 10200011 - The entries method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ entries(): IterableIterator<[K, V]>; /** * returns an ES6 iterator.Each item of the iterator is a Javascript Object + * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ diff --git a/api/@ohos.util.TreeSet.d.ts b/api/@ohos.util.TreeSet.d.ts index a71ef36bf015f787b3d791c05ac4f84e805fbeb0..4e04894074f9f7650e79a652d4a26950f758be85 100644 --- a/api/@ohos.util.TreeSet.d.ts +++ b/api/@ohos.util.TreeSet.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 @@ -12,12 +12,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + declare class TreeSet { /** * A constructor used to create a TreeSet object. * @param comparator (Optional) User-defined comparison functions * @param firstValue (Optional) previous element * @param secondValue (Optional) next element + * @throws { BusinessError } 10200012 - The TreeSet's constructor cannot be directly invoked. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -30,7 +33,8 @@ declare class TreeSet { length: number; /** * Returns whether the Set object contains elements - * @return the boolean type + * @returns the boolean type + * @throws { BusinessError } 10200011 - The isEmpty method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -38,7 +42,8 @@ declare class TreeSet { /** * Returns whether the Set object contain s the elements * @param value need to determine whether to include the element - * @return the boolean type + * @returns the boolean type + * @throws { BusinessError } 10200011 - The has method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -47,6 +52,8 @@ declare class TreeSet { * If the set does not contain the element, the specified element is added * @param value Added element * @returns the boolean type(Is there contain this element) + * @throws { BusinessError } 401 - The type of parameters are invalid. + * @throws { BusinessError } 10200011 - The add method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -54,65 +61,77 @@ declare class TreeSet { /** * Remove a specified element from a Set object * @param value Target to be deleted - * @return the boolean type(Is there contain this element) + * @returns the boolean type(Is there contain this element) + * @throws { BusinessError } 10200011 - The remove method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ remove(value: T): boolean; /** * Clears all element groups in a set + * @throws { BusinessError } 10200011 - The clear method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ clear(): void; /** * Gets the first elements in a set - * @return value or undefined + * @returns value or undefined + * @throws { BusinessError } 10200011 - The getFirstValue method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ getFirstValue(): T; /** * Gets the last elements in a set - * @return value or undefined + * @returns value or undefined + * @throws { BusinessError } 10200011 - The getLastValue method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ getLastValue(): T; /** * Returns the greatest element smaller than or equal to the specified key - * if the key does not exist, undefied is returned + * if the key does not exist, undefined is returned * @param key Objective of comparison - * @return key or undefined + * @returns key or undefined + * @throws { BusinessError } 10200011 - The getLowerValue method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ getLowerValue(key: T): T; /** * Returns the least element greater than or equal to the specified key - * if the key does not exist, undefied is returned + * if the key does not exist, undefined is returned * @param key Objective of comparison - * @return key or undefined + * @returns key or undefined + * @throws { BusinessError } 10200011 - The getHigherValue method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ getHigherValue(key: T): T; /** * Return and delete the first element, returns undefined if tree set is empty - * @return first value or undefined + * @returns first value or undefined + * @throws { BusinessError } 10200011 - The popFirst method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ popFirst(): T; /** * Return and delete the last element, returns undefined if tree set is empty - * @return last value or undefined + * @returns last value or undefined + * @throws { BusinessError } 10200011 - The popLast method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ popLast(): T; /** * Executes a provided function once for each value in the Set object. + * @throws { BusinessError } 10200011 - The forEach method cannot be bound. + * @throws { BusinessError } 401 - The type of parameters are invalid. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -120,18 +139,21 @@ declare class TreeSet { thisArg?: Object): void; /** * Returns a new Iterator object that contains the values contained in this set + * @throws { BusinessError } 10200011 - The values method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ values(): IterableIterator; /** * Returns a new Iterator object that contains the [key, value] pairs for each element in the Set object in insertion order + * @throws { BusinessError } 10200011 - The entries method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ entries(): IterableIterator<[T, T]>; /** * returns an ES6 iterator.Each item of the iterator is a Javascript Object + * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound. * @since 8 * @syscap SystemCapability.Utils.Lang */ diff --git a/api/@ohos.util.Vector.d.ts b/api/@ohos.util.Vector.d.ts index 67d310c7b500224b7144697ce465ce1991beac8e..febbedd86e9d768edc26d9d944b496e290b6f26b 100644 --- a/api/@ohos.util.Vector.d.ts +++ b/api/@ohos.util.Vector.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 @@ -12,6 +12,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +/** + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.ArrayList + */ declare class Vector { /** * A constructor used to create a Vector object. @@ -47,7 +54,7 @@ declare class Vector { /** * Check if vector contains the specified element * @param element element to be contained - * @return the boolean type,if vector contains the specified element,return true,else return false + * @returns the boolean type,if vector contains the specified element,return true,else return false * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -55,7 +62,7 @@ declare class Vector { /** * Returns the element at the specified position in this Vector,or returns undefined if vector is empty * @param element element to be contained - * @return the number type ,returns the lowest index such that or -1 if there is no such index. + * @returns the number type ,returns the lowest index such that or -1 if there is no such index. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -64,7 +71,7 @@ declare class Vector { * Returns the index of the first occurrence of the specified element * in this vector, or -1 if this vector does not contain the element. * @param element current index - * @return the number type + * @returns the number type * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -72,7 +79,7 @@ declare class Vector { /** * Returns the first component (the item at index 0) of this vector. * or returns undefined if vector is empty - * @return the T type ,returns undefined if vector is empty + * @returns the T type ,returns undefined if vector is empty * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -80,7 +87,7 @@ declare class Vector { /** * Returns the Last component (the item at index length-1) of this vector. * or returns undefined if vector is empty - * @return the T type ,returns undefined if vector is empty + * @returns the T type ,returns undefined if vector is empty * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -89,7 +96,7 @@ declare class Vector { * Find the corresponding element according to the index, * delete the element, and move the index of all elements to the right of the element forward by one. * @param index the index in the vector - * @return the T type ,returns undefined if vector is empty,If the index is + * @returns the T type ,returns undefined if vector is empty,If the index is * out of bounds (greater than or equal to length or less than 0), throw an exception * @since 8 * @syscap SystemCapability.Utils.Lang @@ -100,7 +107,7 @@ declare class Vector { * if it is present. If the vector does not contain the element, it is * unchanged. More formally, removes the element with the lowest index * @param element element to remove - * @return the boolean type ,If there is no such element, return false + * @returns the boolean type ,If there is no such element, return false * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -109,7 +116,7 @@ declare class Vector { * Replaces the element at the specified position in this Vector with the specified element * @param element replaced element * @param index index to find - * @return the T type + * @returns the T type * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -118,7 +125,7 @@ declare class Vector { * Returns in the index of the last occurrence of the specified element in this vector , * or -1 if the vector does not contain the element. * @param element element to find - * @return the number type + * @returns the number type * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -128,7 +135,7 @@ declare class Vector { * or returns -1 if the element is not found,or -1 if there is no such index * @param element element to find * @param index start index - * @return the number type + * @returns the number type * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -138,7 +145,7 @@ declare class Vector { * or returns -1 if the element is not found,or -1 if there is no such index * @param element element to find * @param index start index - * @return the number type + * @returns the number type * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -213,7 +220,7 @@ declare class Vector { clear(): void; /** * Returns a shallow copy of this instance. (The elements themselves are not copied.) - * @return this vector instance + * @returns this vector instance * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -226,21 +233,21 @@ declare class Vector { setLength(newSize: number): void; /** * returns the capacity of this vector - * @return the number type + * @returns the number type * @since 8 * @syscap SystemCapability.Utils.Lang */ getCapacity(): number; /** * convert vector to array - * @return the Array type + * @returns the Array type * @since 8 * @syscap SystemCapability.Utils.Lang */ convertToArray(): Array; /** * Determine whether vector is empty and whether there is an element - * @return the boolean type + * @returns the boolean type * @since 8 * @syscap SystemCapability.Utils.Lang */ diff --git a/api/@ohos.util.d.ts b/api/@ohos.util.d.ts index f4202b0e73352c42ff8330cadbd634598f2f4e65..a5f95ed44f06e7ca7e222be4d7d8e7e1c0abf0fd 100644 --- a/api/@ohos.util.d.ts +++ b/api/@ohos.util.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 @@ -39,28 +39,69 @@ declare namespace util { * %c: CSS. This specifier is ignored and will skip any CSS passed in. * %%: single percent sign ('%'). This does not consume an argument.Returns: The formatted string. * @since 7 + * @deprecated since 9 + * @useinstead ohos.util.format * @syscap SystemCapability.Utils.Lang - * @param format styled string - * @param args data to be formatted - * @return Return the character string formatted in a specific format + * @param format Styled string + * @param args Data to be formatted + * @returns Return the character string formatted in a specific format */ function printf(format: string, ...args: Object[]): string; + /** + * %s: String will be used to convert all values except BigInt, Object and -0. BigInt values will be represented + * with an n and Objects that have no user defined toString function are inspected using util.inspect() with + * options { depth: 0, colors: false, compact: 3 }. + * %d: Number will be used to convert all values except BigInt and Symbol. + * %i: parseInt(value, 10) is used for all values except BigInt and Symbol. + * %f: parseFloat(value) is used for all values except Bigint and Symbol. + * %j: JSON. Replaced with the string '[Circular]' if the argument contains circular references. + * %o: Object. A string representation of an object with generic JavaScript object formatting.Similar to + * util.inspect() with options { showHidden: true, showProxy: true}. This will show the full object including + * non-enumerable properties and proxies. + * %O: Object. A string representation of an object with generic JavaScript object formatting. + * %O: Object. A string representation of an object with generic JavaScript object formatting.Similar to + * util.inspect() without options. This will show the full object not including non-enumerable properties and + * proxies. + * %c: CSS. This specifier is ignored and will skip any CSS passed in. + * %%: single percent sign ('%'). This does not consume an argument.Returns: The formatted string. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param format Styled string + * @param args Data to be formatted + * @returns Return the character string formatted in a specific format + * @throws {BusinessError} 401 - if the input parameters are invalid. + */ + function format(format: string, ...args: Object[]): string; + /** * Get the string name of the system errno. * @since 7 + * @deprecated since 9 + * @useinstead ohos.util.errnoToString * @syscap SystemCapability.Utils.Lang - * @param errno the error code generated by an error in the system - * @return return the string name of a system errno + * @param errno The error code generated by an error in the system + * @returns Return the string name of a system errno */ function getErrorString(errno: number): string; + /** + * Get the string name of the system errno. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param errno The error code generated by an error in the system + * @returns Return the string name of a system errno + * @throws {BusinessError} 401 - The type of errno must be number. + */ + function errnoToString(errno: number): string; + /** * Takes an async function (or a function that returns a Promise) and returns a function following the * error-first callback style. * @since 7 * @syscap SystemCapability.Utils.Lang - * @param original asynchronous function + * @param original Asynchronous function + * @throws {BusinessError} 401 - The type of original must be Function. */ function callbackWrapper(original: Function): (err: Object, value: Object) => void; @@ -69,52 +110,63 @@ declare namespace util { * callback as the last argument, and return a function that returns promises. * @since 9 * @syscap SystemCapability.Utils.Lang - * @param original asynchronous function - * @return return a function that returns promises + * @param original Asynchronous function + * @returns Return a function that returns promises + * @throws {BusinessError} 401 - The type of original must be Function. */ - function promisify(original: (err: Object, value: Object) => void): Function; + function promisify(original: (err: Object, value: Object) => void): Function; /** * Takes a function following the common error-first callback style, i.e taking an (err, value) => * callback as the last argument, and return a version that returns promises. * @since 7 * @deprecated since 9 + * @useinstead ohos.util.promisify * @syscap SystemCapability.Utils.Lang - * @param original asynchronous function - * @return return a version that returns promises + * @param original Asynchronous function + * @returns Return a version that returns promises */ function promiseWrapper(original: (err: Object, value: Object) => void): Object; - + /** - * Generate a random RFC 4122 version 4 UUID using a cryptographically secure random number generator. - * @since 9 - * @syscap SystemCapability.Utils.Lang - * @param entropyCache whether to generate the UUID with using the cache. Default: true. - * @return return a string representing this UUID. - */ + * Generate a random RFC 4122 version 4 UUID using a cryptographically secure random number generator. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param entropyCache Whether to generate the UUID with using the cache. Default: true. + * @returns Return a string representing this UUID. + * @throws {BusinessError} 401 - The type of entropyCache must be boolean. + */ function randomUUID(entropyCache?: boolean): string; /** - * Generate a random RFC 4122 version 4 UUID using a cryptographically secure random number generator. - * @since 9 - * @syscap SystemCapability.Utils.Lang - * @param entropyCache whether to generate the UUID with using the cache. Default: true. - * @return return a Uint8Array representing this UUID. - */ + * Generate a random RFC 4122 version 4 UUID using a cryptographically secure random number generator. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param entropyCache Whether to generate the UUID with using the cache. Default: true. + * @returns Return a Uint8Array representing this UUID. + * @throws {BusinessError} 401 - The type of entropyCache must be boolean. + */ function randomBinaryUUID(entropyCache?: boolean): Uint8Array; /** - * Parse a UUID from the string standard representation as described in the RFC 4122 version 4. - * @since 9 - * @syscap SystemCapability.Utils.Lang - * @param uuid string that specifies a UUID - * @return return a Uint8Array representing this UUID. Throw SyntaxError if parsing fails. - */ + * Parse a UUID from the string standard representation as described in the RFC 4122 version 4. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param uuid String that specifies a UUID + * @returns Return a Uint8Array representing this UUID. Throw SyntaxError if parsing fails. + * @throws {BusinessError} 401 - The type of uuid must be string. + */ function parseUUID(uuid: string): Uint8Array; + /** + * The TextEncoder represents a text encoder that accepts a string as input, + * encodes it in UTF-8 format, and outputs UTF-8 byte stream. + * @syscap SystemCapability.Utils.Lang + * @since 7 + */ class TextDecoder { /** - * the source encoding's name, lowercased. + * The source encoding's name, lowercased. * @since 7 * @syscap SystemCapability.Utils.Lang */ @@ -135,22 +187,45 @@ declare namespace util { readonly ignoreBOM = false; /** - * the textEncoder constructor. - * @param 7 + * The textEncoder constructor. + * @since 7 + * @deprecated since 9 + * @useinstead ohos.util.constructor * @syscap SystemCapability.Utils.Lang - * @param encoding decoding format + * @param encoding Decoding format */ constructor( encoding?: string, options?: { fatal?: boolean; ignoreBOM?: boolean }, ); + /** + * The textEncoder constructor. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + constructor(); + + /** + * Check the validity of parameters. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param encoding Decoding format + * @throws {BusinessError} 401 - if the input parameters are invalid. + */ + static create( + encoding?: string, + options?: { fatal?: boolean; ignoreBOM?: boolean }, + ): TextDecoder; + /** * Returns the result of running encoding's decoder. * @since 7 + * @deprecated since 9 + * @useinstead ohos.util.decodeWithStream * @syscap SystemCapability.Utils.Lang - * @param input decoded numbers in accordance with the format - * @return return decoded text + * @param input Decoded numbers in accordance with the format + * @returns Return decoded text */ decode(input: Uint8Array, options?: { stream?: false }): string; @@ -158,12 +233,19 @@ declare namespace util { * Returns the result of running encoding's decoder. * @since 9 * @syscap SystemCapability.Utils.Lang - * @param input decoded numbers in accordance with the format - * @return return decoded text + * @param input Decoded numbers in accordance with the format + * @returns Return decoded text + * @throws {BusinessError} 401 - if the input parameters are invalid. */ - decodeWithStream(input: Uint8Array, options?: { stream?: boolean }): string; + decodeWithStream(input: Uint8Array, options?: { stream?: boolean }): string; } + /** + * The TextDecoder interface represents a text decoder. + * The decoder takes the byte stream as the input and outputs the String string. + * @syscap SystemCapability.Utils.Lang + * @since 7 + */ class TextEncoder { /** * Encoding format. @@ -173,36 +255,51 @@ declare namespace util { readonly encoding = "utf-8"; /** - * the textEncoder constructor. + * The textEncoder constructor. * @since 7 * @syscap SystemCapability.Utils.Lang */ constructor(); /** - * the textEncoder constructor. + * The textEncoder constructor. * @since 9 * @syscap SystemCapability.Utils.Lang * @param encoding The string for encoding format. + * @throws {BusinessError} 401 - The type of encoding must be string. */ constructor(encoding?: string); /** * Returns the result of encoder. * @since 7 + * @deprecated since 9 + * @useinstead ohos.util.encodeInto * @syscap SystemCapability.Utils.Lang - * @param The string to be encoded. - * @return returns the encoded text. + * @param input The string to be encoded. + * @returns Returns the encoded text. */ encode(input?: string): Uint8Array; /** - * encode string, write the result to dest array. + * Returns the result of encoder. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param input The string to be encoded. + * @returns Returns the encoded text. + * @throws {BusinessError} 401 - The type of input must be string. + */ + encodeInto(input?: string): Uint8Array; + + /** + * Encode string, write the result to dest array. * @since 7 + * @deprecated since 9 + * @useinstead ohos.util.encodeIntoUint8Array * @syscap SystemCapability.Utils.Lang * @param input The string to be encoded. - * @param dest decoded numbers in accordance with the format - * @return returns Returns the object, where read represents + * @param dest Decoded numbers in accordance with the format + * @returns Returns Returns the object, where read represents * the number of characters that have been encoded, and written * represents the number of bytes occupied by the encoded characters. */ @@ -210,227 +307,364 @@ declare namespace util { input: string, dest: Uint8Array, ): { read: number; written: number }; - } + /** + * Encode string, write the result to dest array. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param input The string to be encoded. + * @param dest Decoded numbers in accordance with the format + * @returns Returns Returns the object, where read represents + * the number of characters that have been encoded, and written + * represents the number of bytes occupied by the encoded characters. + * @throws {BusinessError} 401 - if the input parameters are invalid. + */ + encodeIntoUint8Array( + input: string, + dest: Uint8Array, + ): { read: number; written: number }; + } + + /** + * The rational number is mainly to compare rational numbers and obtain the numerator and denominator. + * @syscap SystemCapability.Utils.Lang + * @since 8 + */ class RationalNumber { /** * A constructor used to create a RationalNumber instance with a given numerator and denominator. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.constructor * @syscap SystemCapability.Utils.Lang * @param numerator An integer number * @param denominator An integer number */ constructor(numerator: number, denominator: number); + + /** + * A constructor used to create a RationalNumber instance with a given numerator and denominator. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + constructor(); + + /** + * Check the validity of parameters. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param numerator An integer number + * @param denominator An integer number + * @throws {BusinessError} 401 - if the input parameters are invalid. + */ + static parseRationalNumber(numerator: number, denominator: number): RationalNumber; + /** * Creates a RationalNumber object based on a given string. * @since 8 * @syscap SystemCapability.Utils.Lang - * @param String Expression of Rational Numbers - * @return Returns a RationalNumber object generated based on the given string. + * @param rationalString String Expression of Rational Numbers + * @returns Returns a RationalNumber object generated based on the given string. + * @throws {BusinessError} 401 - The type of rationalString must be string. */ static createRationalFromString(rationalString: string): RationalNumber​; + /** * Compares the current RationalNumber object to the given object. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.compare * @syscap SystemCapability.Utils.Lang - * @param An object of other rational numbers - * @return Returns 0 or 1, or -1, depending on the comparison. + * @param another An object of other rational numbers + * @returns Returns 0 or 1, or -1, depending on the comparison. */ compareTo(another :RationalNumber): number; + + /** + * Compares the current RationalNumber object to the given object. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param another An object of other rational numbers + * @returns Returns 0 or 1, or -1, depending on the comparison. + * @throws {BusinessError} 401 - The type of another must be RationalNumber. + */ + compare(another :RationalNumber): number; + /** * Compares two objects for equality. * @since 8 * @syscap SystemCapability.Utils.Lang - * @param An object - * @return Returns true if the given object is the same as the current object; Otherwise, false is returned. + * @param obj An object + * @returns Returns true if the given object is the same as the current object; Otherwise, false is returned. */ equals(obj: Object): boolean; + /** * Gets integer and floating-point values of a rational number object. * @since 8 * @syscap SystemCapability.Utils.Lang - * @return Returns the integer and floating-point values of a rational number object. + * @returns Returns the integer and floating-point values of a rational number object. */ valueOf(): number; + /** * Get the greatest common divisor of two integers. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.getCommonFactor * @syscap SystemCapability.Utils.Lang - * @param number1 is an integer. - * @param number2 is an integer. - * @return Returns the greatest common divisor of two integers, integer type. + * @param number1 Is an integer. + * @param number2 Is an integer. + * @returns Returns the greatest common divisor of two integers, integer type. */ static getCommonDivisor(number1: number, number2: number): number; + + /** + * Get the greatest common divisor of two integers. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param number1 Is an integer. + * @param number2 Is an integer. + * @returns Returns the greatest common divisor of two integers, integer type. + * @throws {BusinessError} 401 - if the input parameters are invalid. + */ + static getCommonFactor(number1: number, number2: number): number; + /** * Gets the denominator of the current object. * @since 8 * @syscap SystemCapability.Utils.Lang - * @return Returns the denominator of the current object. + * @returns Returns the denominator of the current object. */ getDenominator(): number; + /** * Gets the numerator​ of the current object. * @since 8 * @syscap SystemCapability.Utils.Lang - * @return Returns the numerator​ of the current object. + * @returns Returns the numerator​ of the current object. */ getNumerator(): number; + /** * Checks whether the current RationalNumber object represents an infinite value. * @since 8 * @syscap SystemCapability.Utils.Lang - * @return If the denominator is not 0, true is returned. Otherwise, false is returned. + * @returns If the denominator is not 0, true is returned. Otherwise, false is returned. */ - isFinite() : boolean; + isFinite(): boolean; + /** * Checks whether the current RationalNumber object represents a Not-a-Number (NaN) value. * @since 8 * @syscap SystemCapability.Utils.Lang - * @return If both the denominator and numerator are 0, true is returned. Otherwise, false is returned. + * @returns If both the denominator and numerator are 0, true is returned. Otherwise, false is returned. */ isNaN(): boolean; + /** * Checks whether the current RationalNumber object represents the value 0. * @since 8 * @syscap SystemCapability.Utils.Lang - * @return If the value represented by the current object is 0, true is returned. Otherwise, false is returned. + * @returns If the value represented by the current object is 0, true is returned. Otherwise, false is returned. */ isZero(): boolean; + /** * Obtains a string representation of the current RationalNumber object. * @since 8 * @syscap SystemCapability.Utils.Lang - * @return Returns a string representation of the current RationalNumber object. + * @returns Returns a string representation of the current RationalNumber object. */ toString(): string; } + /** + * The LruBuffer algorithm replaces the least used data with new data when the buffer space is insufficient. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache + */ class LruBuffer { /** * Default constructor used to create a new LruBuffer instance with the default capacity of 64. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.constructor * @syscap SystemCapability.Utils.Lang * @param capacity Indicates the capacity to customize for the buffer. */ - constructor(capacity?:number); + constructor(capacity?: number); + /** * Updates the buffer capacity to a specified capacity. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.updateCapacity * @syscap SystemCapability.Utils.Lang * @param newCapacity Indicates the new capacity to set. */ updateCapacity(newCapacity: number):void + /** - *Returns a string representation of the object. + * Returns a string representation of the object. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.toString * @syscap SystemCapability.Utils.Lang - * @return Returns the string representation of the object and outputs the string representation of the object. + * @returns Returns the string representation of the object and outputs the string representation of the object. */ - toString():string + toString(): string + /** * Obtains a list of all values in the current buffer. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.length * @syscap SystemCapability.Utils.Lang - * @return Returns the total number of values in the current buffer. + * @returns Returns the total number of values in the current buffer. */ - length:number + length: number + /** * Obtains the capacity of the current buffer. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.getCapacity * @syscap SystemCapability.Utils.Lang - * @return Returns the capacity of the current buffer. + * @returns Returns the capacity of the current buffer. */ getCapacity(): number; + /** * Clears key-value pairs from the current buffer. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.clear * @syscap SystemCapability.Utils.Lang */ clear(): void; + /** * Obtains the number of times createDefault(Object) returned a value. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.getCreateCount * @syscap SystemCapability.Utils.Lang - * @return Returns the number of times createDefault(java.lang.Object) returned a value. + * @returns Returns the number of times createDefault(java.lang.Object) returned a value. */ getCreateCount(): number; + /** * Obtains the number of times that the queried values are not matched. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.getMissCount * @syscap SystemCapability.Utils.Lang - * @return Returns the number of times that the queried values are not matched. + * @returns Returns the number of times that the queried values are not matched. */ getMissCount(): number; + /** * Obtains the number of times that values are evicted from the buffer. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.getRemovalCount * @syscap SystemCapability.Utils.Lang - * @return Returns the number of times that values are evicted from the buffer. + * @returns Returns the number of times that values are evicted from the buffer. */ getRemovalCount(): number; + /** * Obtains the number of times that the queried values are successfully matched. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.getMatchCount * @syscap SystemCapability.Utils.Lang - * @return Returns the number of times that the queried values are successfully matched. + * @returns Returns the number of times that the queried values are successfully matched. */ getMatchCount(): number; + /** * Obtains the number of times that values are added to the buffer. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.getPutCount * @syscap SystemCapability.Utils.Lang - * @return Returns the number of times that values are added to the buffer. + * @returns Returns the number of times that values are added to the buffer. */ getPutCount(): number; + /** * Checks whether the current buffer is empty. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.isEmpty * @syscap SystemCapability.Utils.Lang - * @return Returns true if the current buffer contains no value. + * @returns Returns true if the current buffer contains no value. */ isEmpty(): boolean; + /** * Obtains the value associated with a specified key. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.get * @syscap SystemCapability.Utils.Lang * @param key Indicates the key to query. - * @return Returns the value associated with the key if the specified key is present in the buffer; returns null otherwise. + * @returns Returns the value associated with the key if the specified key is present in the buffer; returns null otherwise. */ get(key: K): V | undefined; + /** * Adds a key-value pair to the buffer. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.put * @syscap SystemCapability.Utils.Lang * @param key Indicates the key to add. * @param value Indicates the value associated with the key to add. - * @return Returns the value associated with the added key; returns the original value if the key to add already exists. + * @returns Returns the value associated with the added key; returns the original value if the key to add already exists. */ put(key: K, value: V): V; + /** * Obtains a list of all values in the current buffer. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.values * @syscap SystemCapability.Utils.Lang - * @return Returns the list of all values in the current buffer in ascending order, from the most recently accessed to least recently accessed. + * @returns Returns the list of all values in the current buffer in ascending order, from the most recently accessed to least recently accessed. */ values(): V[]; + /** * Obtains a list of keys for the values in the current buffer. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.keys * @syscap SystemCapability.Utils.Lang - * @return Returns a list of keys sorted from most recently accessed to least recently accessed. + * @returns Returns a list of keys sorted from most recently accessed to least recently accessed. */ keys(): K[]; + /** * Deletes a specified key and its associated value from the current buffer. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.remove * @syscap SystemCapability.Utils.Lang * @param key Indicates the key to delete. - * @return Returns an Optional object containing the deleted key-value pair; returns an empty Optional object if the key does not exist. + * @returns Returns an Optional object containing the deleted key-value pair; returns an empty Optional object if the key does not exist. */ remove(key: K): V | undefined; + /** * Executes subsequent operations after a value is deleted. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.afterRemoval * @syscap SystemCapability.Utils.Lang * @param isEvict The parameter value is true if this method is called due to insufficient capacity, and the parameter value is false in other cases. * @param key Indicates the deleted key. @@ -438,46 +672,258 @@ declare namespace util { * @param newValue The parameter value is the new value associated if the put(java.lang.Object,java.lang.Object) method is called and the key to add already exists. The parameter value is null in other cases. */ afterRemoval(isEvict: boolean, key: K, value: V, newValue: V): void; + /** * Checks whether the current buffer contains a specified key. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.contains * @syscap SystemCapability.Utils.Lang * @param key Indicates the key to check. - * @return Returns true if the buffer contains the specified key. + * @returns Returns true if the buffer contains the specified key. */ contains(key: K): boolean; + /** * Executes subsequent operations if miss to compute a value for the specific key. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.createDefault * @syscap SystemCapability.Utils.Lang * @param key Indicates the missed key. - * @return Returns the value associated with the key. + * @returns Returns the value associated with the key. */ createDefault(key: K): V; + /** * Returns an array of key-value pairs of enumeratable properties of a given object. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.entries * @syscap SystemCapability.Utils.Lang - * @return Returns an array of key-value pairs for the enumeratable properties of the given object itself. + * @returns Returns an array of key-value pairs for the enumeratable properties of the given object itself. */ entries(): IterableIterator<[K, V]>; + /** * Specifies the default iterator for an object. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.LRUCache.[Symbol.iterator] + * @syscap SystemCapability.Utils.Lang + * @returns Returns a two - dimensional array in the form of key - value pairs. + */ + [Symbol.iterator](): IterableIterator<[K, V]>; + } + + /** + * The LRUCache algorithm replaces the least used data with new data when the buffer space is insufficient. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + class LRUCache { + /** + * Default constructor used to create a new LruBuffer instance with the default capacity of 64. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param capacity Indicates the capacity to customize for the buffer. + */ + constructor(capacity?: number); + + /** + * Updates the buffer capacity to a specified capacity. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param newCapacity Indicates the new capacity to set. + * @throws {BusinessError} 401 - The type of newCapacity must be number. + */ + updateCapacity(newCapacity: number):void + + /** + * Returns a string representation of the object. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @returns Returns the string representation of the object and outputs the string representation of the object. + */ + toString(): string + + /** + * Obtains a list of all values in the current buffer. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @returns Returns the total number of values in the current buffer. + */ + length: number + + /** + * Obtains the capacity of the current buffer. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @returns Returns the capacity of the current buffer. + */ + getCapacity(): number; + + /** + * Clears key-value pairs from the current buffer. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + clear(): void; + + /** + * Obtains the number of times createDefault(Object) returned a value. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @returns Returns the number of times createDefault(java.lang.Object) returned a value. + */ + getCreateCount(): number; + + /** + * Obtains the number of times that the queried values are not matched. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @returns Returns the number of times that the queried values are not matched. + */ + getMissCount(): number; + + /** + * Obtains the number of times that values are evicted from the buffer. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @returns Returns the number of times that values are evicted from the buffer. + */ + getRemovalCount(): number; + + /** + * Obtains the number of times that the queried values are successfully matched. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @returns Returns the number of times that the queried values are successfully matched. + */ + getMatchCount(): number; + + /** + * Obtains the number of times that values are added to the buffer. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @returns Returns the number of times that values are added to the buffer. + */ + getPutCount(): number; + + /** + * Checks whether the current buffer is empty. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @returns Returns true if the current buffer contains no value. + */ + isEmpty(): boolean; + + /** + * Obtains the value associated with a specified key. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param key Indicates the key to query. + * @returns Returns the value associated with the key if the specified key is present in the buffer; returns null otherwise. + * @throws {BusinessError} 401 - The type of key must be object. + */ + get(key: K): V | undefined; + + /** + * Adds a key-value pair to the buffer. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param key Indicates the key to add. + * @param value Indicates the value associated with the key to add. + * @returns Returns the value associated with the added key; returns the original value if the key to add already exists. + * @throws {BusinessError} 401 - if the input parameters are invalid. + */ + put(key: K, value: V): V; + + /** + * Obtains a list of all values in the current buffer. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @returns Returns the list of all values in the current buffer in ascending order, from the most recently accessed to least recently accessed. + */ + values(): V[]; + + /** + * Obtains a list of keys for the values in the current buffer. + * since 9 + * @syscap SystemCapability.Utils.Lang + * @returns Returns a list of keys sorted from most recently accessed to least recently accessed. + */ + keys(): K[]; + + /** + * Deletes a specified key and its associated value from the current buffer. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param key Indicates the key to delete. + * @returns Returns an Optional object containing the deleted key-value pair; returns an empty Optional object if the key does not exist. + * @throws {BusinessError} 401 - The type of key must be object. + */ + remove(key: K): V | undefined; + + /** + * Executes subsequent operations after a value is deleted. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param isEvict The parameter value is true if this method is called due to insufficient capacity, and the parameter value is false in other cases. + * @param key Indicates the deleted key. + * @param value Indicates the deleted value. + * @param newValue The parameter value is the new value associated if the put(java.lang.Object,java.lang.Object) method is called and the key to add already exists. The parameter value is null in other cases. + * @throws {BusinessError} 401 - if the input parameters are invalid. + */ + afterRemoval(isEvict: boolean, key: K, value: V, newValue: V): void; + + /** + * Checks whether the current buffer contains a specified key. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param key Indicates the key to check. + * @returns Returns true if the buffer contains the specified key. + * @throws {BusinessError} 401 - The type of key must be object. + */ + contains(key: object): boolean; + + /** + * Executes subsequent operations if miss to compute a value for the specific key. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param key Indicates the missed key. + * @returns Returns the value associated with the key. + * @throws {BusinessError} 401 - The type of key must be object. + */ + createDefault(key: K): V; + + /** + * Returns an array of key-value pairs of enumeratable properties of a given object. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @returns Returns an array of key-value pairs for the enumeratable properties of the given object itself. + */ + entries(): IterableIterator<[K, V]>; + + /** + * Specifies the default iterator for an object. + * @since 9 * @syscap SystemCapability.Utils.Lang - * @return Returns a two - dimensional array in the form of key - value pairs. + * @returns Returns a two - dimensional array in the form of key - value pairs. */ [Symbol.iterator](): IterableIterator<[K, V]>; } + interface ScopeComparable { /** * The comparison function is used by the scope. * @since 8 * @syscap SystemCapability.Utils.Lang - * @return Returns whether the current object is greater than or equal to the input object. + * @returns Returns whether the current object is greater than or equal to the input object. */ compareTo(other: ScopeComparable): boolean; } + /** * A type used to denote ScopeComparable or number. * @since 8 @@ -485,170 +931,446 @@ declare namespace util { */ type ScopeType = ScopeComparable | number; - class Scope{ + /** + * The Scope interface is used to describe the valid range of a field. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.ScopeHelper + */ + class Scope { /** * A constructor used to create a Scope instance with the lower and upper bounds specified. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.ScopeHelper.constructor * @syscap SystemCapability.Utils.Lang * @param lowerObj A ScopeType value * @param upperObj A ScopeType value */ constructor(lowerObj: ScopeType, upperObj: ScopeType); + /** * Obtains a string representation of the current range. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.ScopeHelper.toString * @syscap SystemCapability.Utils.Lang - * @return Returns a string representation of the current range object. + * @returns Returns a string representation of the current range object. */ toString(): string; + /** * Returns the intersection of a given range and the current range. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.ScopeHelper.intersect * @syscap SystemCapability.Utils.Lang * @param range A Scope range object - * @return Returns the intersection of a given range and the current range. + * @returns Returns the intersection of a given range and the current range. */ intersect(range: Scope): Scope; + /** * Returns the intersection of the current range and the range specified by the given lower and upper bounds. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.ScopeHelper.intersect * @syscap SystemCapability.Utils.Lang * @param lowerObj A ScopeType value * @param upperObj A ScopeType value - * @return Returns the intersection of the current range and the range specified by the given lower and upper bounds. + * @returns Returns the intersection of the current range and the range specified by the given lower and upper bounds. */ intersect(lowerObj: ScopeType, upperObj: ScopeType): Scope; + /** * Obtains the upper bound of the current range. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.ScopeHelper.getUpper * @syscap SystemCapability.Utils.Lang - * @return Returns the upper bound of the current range. + * @returns Returns the upper bound of the current range. */ getUpper(): ScopeType; + /** * Obtains the lower bound of the current range. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.ScopeHelper.getLower * @syscap SystemCapability.Utils.Lang - * @return Returns the lower bound of the current range. + * @returns Returns the lower bound of the current range. */ getLower(): ScopeType; + /** * Creates the smallest range that includes the current range and the given lower and upper bounds. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.ScopeHelper.expand * @syscap SystemCapability.Utils.Lang * @param lowerObj A ScopeType value * @param upperObj A ScopeType value - * @return Returns the smallest range that includes the current range and the given lower and upper bounds. + * @returns Returns the smallest range that includes the current range and the given lower and upper bounds. */ expand(lowerObj: ScopeType, upperObj: ScopeType): Scope; + /** * Creates the smallest range that includes the current range and a given range. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.ScopeHelper.expand * @syscap SystemCapability.Utils.Lang * @param range A Scope range object - * @return Returns the smallest range that includes the current range and a given range. + * @returns Returns the smallest range that includes the current range and a given range. */ expand(range: Scope): Scope; + /** * Creates the smallest range that includes the current range and a given value. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.ScopeHelper.expand * @syscap SystemCapability.Utils.Lang * @param value A ScopeType value - * @return Returns the smallest range that includes the current range and a given value. + * @returns Returns the smallest range that includes the current range and a given value. */ expand(value: ScopeType): Scope; + /** * Checks whether a given value is within the current range. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.ScopeHelper.contains * @syscap SystemCapability.Utils.Lang - * @param range A ScopeType range - * @return If the value is within the current range return true,otherwise return false. + * @param value A ScopeType value + * @returns If the value is within the current range return true,otherwise return false. */ contains(value: ScopeType): boolean; + /** * Checks whether a given range is within the current range. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.ScopeHelper.contains * @syscap SystemCapability.Utils.Lang - * @param value A Scope value - * @return If the current range is within the given range return true,otherwise return false. + * @param range A Scope range + * @returns If the current range is within the given range return true,otherwise return false. */ contains(range: Scope): boolean; + /** * Clamps a given value to the current range. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.ScopeHelper.clamp + * @syscap SystemCapability.Utils.Lang + * @param value A ScopeType value + * @returns Returns a ScopeType object that a given value is clamped to the current range.. + */ + clamp(value: ScopeType): ScopeType; + } + + /** + * The ScopeHelper interface is used to describe the valid range of a field. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + class ScopeHelper { + /** + * A constructor used to create a Scope instance with the lower and upper bounds specified. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param lowerObj A ScopeType value + * @param upperObj A ScopeType value + * @throws {BusinessError} 401 - if the input parameters are invalid. + */ + constructor(lowerObj: ScopeType, upperObj: ScopeType); + + /** + * Obtains a string representation of the current range. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @returns Returns a string representation of the current range object. + */ + toString(): string; + + /** + * Returns the intersection of a given range and the current range. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param range A Scope range object + * @returns Returns the intersection of a given range and the current range. + * @throws {BusinessError} 401 - The type of range must be ScopeHelper. + */ + intersect(range: ScopeHelper): ScopeHelper; + + /** + * Returns the intersection of the current range and the range specified by the given lower and upper bounds. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param lowerObj A ScopeType value + * @param upperObj A ScopeType value + * @returns Returns the intersection of the current range and the range specified by the given lower and upper bounds. + * @throws {BusinessError} 401 - if the input parameters are invalid. + */ + intersect(lowerObj: ScopeType, upperObj: ScopeType): ScopeHelper; + + /** + * Obtains the upper bound of the current range. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @returns Returns the upper bound of the current range. + */ + getUpper(): ScopeType; + + /** + * Obtains the lower bound of the current range. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @returns Returns the lower bound of the current range. + */ + getLower(): ScopeType; + + /** + * Creates the smallest range that includes the current range and the given lower and upper bounds. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param lowerObj A ScopeType value + * @param upperObj A ScopeType value + * @returns Returns the smallest range that includes the current range and the given lower and upper bounds. + * @throws {BusinessError} 401 - if the input parameters are invalid. + */ + expand(lowerObj: ScopeType, upperObj: ScopeType): ScopeHelper; + + /** + * Creates the smallest range that includes the current range and a given range. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param range A Scope range object + * @returns Returns the smallest range that includes the current range and a given range. + * @throws {BusinessError} 401 - The type of range must be ScopeHelper. + */ + expand(range: ScopeHelper): ScopeHelper; + + /** + * Creates the smallest range that includes the current range and a given value. + * @since 9 * @syscap SystemCapability.Utils.Lang * @param value A ScopeType value - * @return Returns a ScopeType object that a given value is clamped to the current range.. + * @returns Returns the smallest range that includes the current range and a given value. + * @throws {BusinessError} 401 - The type of value must be object. + */ + expand(value: ScopeType): ScopeHelper; + + /** + * Checks whether a given value is within the current range. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param value A ScopeType value + * @returns If the value is within the current range return true,otherwise return false. + * @throws {BusinessError} 401 - The type of value must be object. + */ + contains(value: ScopeType): boolean; + + /** + * Checks whether a given range is within the current range. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param range A Scope range + * @returns If the current range is within the given range return true,otherwise return false. + * @throws {BusinessError} 401 - The type of range must be ScopeHelper. + */ + contains(range: ScopeHelper): boolean; + + /** + * Clamps a given value to the current range. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param value A ScopeType value + * @returns Returns a ScopeType object that a given value is clamped to the current range. + * @throws {BusinessError} 401 - The type of value must be object. */ clamp(value: ScopeType): ScopeType; } - class Base64{ + /** + * Decodes a Base64 encoded String or input u8 array into a newly-allocated + * u8 array using the Base64 encoding scheme. + * @syscap SystemCapability.Utils.Lang + * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.Base64Helper + */ + class Base64 { /** * Constructor for creating base64 encoding and decoding * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.Base64Helper.constructor * @syscap SystemCapability.Utils.Lang * @param No input parameter is required. - * @return No return value. + * @returns No return value. */ constructor(); + /** * Encodes all bytes from the specified u8 array into a newly-allocated u8 array using the Base64 encoding scheme. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.Base64Helper.encodeSync * @syscap SystemCapability.Utils.Lang - * @param value A Uint8Array value - * @return Return the encoded new Uint8Array. + * @param src A Uint8Array value + * @returns Return the encoded new Uint8Array. */ encodeSync(src: Uint8Array): Uint8Array; + /** * Encodes the specified byte array into a String using the Base64 encoding scheme. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.Base64Helper.encodeToStringSync * @syscap SystemCapability.Utils.Lang - * @param value A Uint8Array value - * @return Return the encoded string. + * @param src A Uint8Array value + * @returns Return the encoded string. */ encodeToStringSync(src: Uint8Array): string; + /** * Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 array using the Base64 encoding scheme. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.Base64Helper.decodeSync * @syscap SystemCapability.Utils.Lang - * @param value A Uint8Array value or value A string value - * @return Return the decoded Uint8Array. + * @param src A Uint8Array value or value A string value + * @returns Return the decoded Uint8Array. */ decodeSync(src: Uint8Array | string): Uint8Array; + /** * Asynchronously encodes all bytes in the specified u8 array into the newly allocated u8 array using the Base64 encoding scheme. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.Base64Helper.encode * @syscap SystemCapability.Utils.Lang - * @param value A Uint8Array value - * @return Return the encodes asynchronous new Uint8Array. + * @param src A Uint8Array value + * @returns Return the encodes asynchronous new Uint8Array. */ encode(src: Uint8Array): Promise; + /** * Asynchronously encodes the specified byte array into a String using the Base64 encoding scheme. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.Base64Helper.encodeToString * @syscap SystemCapability.Utils.Lang - * @param value A Uint8Array value - * @return Returns the encoded asynchronous string. + * @param src A Uint8Array value + * @returns Returns the encoded asynchronous string. */ - encodeToString(src: Uint8Array): Promise; + encodeToString(src: Uint8Array): Promise; + /** * Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or input u8 array into a newly allocated u8 array. * @since 8 + * @deprecated since 9 + * @useinstead ohos.util.Base64Helper.decode + * @syscap SystemCapability.Utils.Lang + * @param src A Uint8Array value or value A string value + * @returns Return the decoded asynchronous Uint8Array. + */ + decode(src: Uint8Array | string): Promise; + } + + /** + * Decodes a Base64 encoded String or input u8 array into a newly-allocated + * u8 array using the Base64 encoding scheme. + * @syscap SystemCapability.Utils.Lang + * @since 9 + */ + class Base64Helper { + /** + * Constructor for creating base64 encoding and decoding + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param No input parameter is required. + * @returns No return value. + */ + constructor(); + + /** + * Encodes all bytes from the specified u8 array into a newly-allocated u8 array using the Base64 encoding scheme. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param src A Uint8Array value + * @returns Return the encoded new Uint8Array. + * @throws {BusinessError} 401 - The type of src must be Uint8Array. + */ + encodeSync(src: Uint8Array): Uint8Array; + + /** + * Encodes the specified byte array into a String using the Base64 encoding scheme. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param src A Uint8Array value + * @returns Return the encoded string. + * @throws {BusinessError} 401 - The type of src must be Uint8Array. + */ + encodeToStringSync(src: Uint8Array): string; + + /** + * Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 array using the Base64 encoding scheme. + * @since 9 * @syscap SystemCapability.Utils.Lang - * @param value A Uint8Array value or value A string value - * @return Return the decoded asynchronous Uint8Array. + * @param src A Uint8Array value or value A string value + * @returns Return the decoded Uint8Array. + * @throws {BusinessError} 401 - The type of src must be Uint8Array or string. + */ + decodeSync(src: Uint8Array | string): Uint8Array; + + /** + * Asynchronously encodes all bytes in the specified u8 array into the newly allocated u8 array using the Base64 encoding scheme. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param src A Uint8Array value + * @returns Return the encodes asynchronous new Uint8Array. + * @throws {BusinessError} 401 - The type of src must be Uint8Array. + */ + encode(src: Uint8Array): Promise; + + /** + * Asynchronously encodes the specified byte array into a String using the Base64 encoding scheme. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param src A Uint8Array value + * @returns Returns the encoded asynchronous string. + * @throws {BusinessError} 401 - The type of src must be Uint8Array. + */ + encodeToString(src: Uint8Array): Promise; + + /** + * Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or + * input u8 array into a newly allocated u8 array. + * @since 9 + * @syscap SystemCapability.Utils.Lang + * @param src A Uint8Array value or value A string value + * @returns Return the decoded asynchronous Uint8Array. + * @throws {BusinessError} 401 - The type of src must be Uint8Array or string. */ decode(src: Uint8Array | string): Promise; } + /** + * Check the type of parameter. + * @syscap SystemCapability.Utils.Lang + * @since 8 + */ class types{ /** * The types constructor * @since 8 * @syscap SystemCapability.Utils.Lang * @param No input parameter is required. - * @return No return value. + * @returns No return value. */ constructor(); /** @@ -656,7 +1378,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A ArrayBuffer or SharedArrayBuffer value - * @Returns true if the value is a built-in ArrayBuffer or SharedArrayBuffer instance.. + * @returns Returns true if the value is a built-in ArrayBuffer or SharedArrayBuffer instance. */ isAnyArrayBuffer(value: Object): boolean; /** @@ -664,7 +1386,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A included in the isAnyArrayBuffer value - * @return Returns true if the value is an instance of one of the ArrayBuffer views, such as typed array objects or DataView. Equivalent to ArrayBuffer.isView(). + * @returns Returns true if the value is an instance of one of the ArrayBuffer views, such as typed array objects or DataView. Equivalent to ArrayBuffer.isView(). */ isArrayBufferView(value: Object): boolean; /** @@ -672,7 +1394,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A arguments value - * @return Returns true if the value is an arguments object. + * @returns Returns true if the value is an arguments object. */ isArgumentsObject(value: Object): boolean; /** @@ -680,7 +1402,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A arraybuffer value - * @return Returns true if the value is a built-in ArrayBuffer instance. This does not include SharedArrayBuffer instances. Usually, it is desirable to test for both; See isAnyArrayBuffer() for that. + * @returns Returns true if the value is a built-in ArrayBuffer instance. This does not include SharedArrayBuffer instances. Usually, it is desirable to test for both; See isAnyArrayBuffer() for that. */ isArrayBuffer(value: Object): boolean; /** @@ -688,7 +1410,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A async function value - * @return Returns true if the value is an async function. This only reports back what the JavaScript engine is seeing; in particular, the return value may not match the original source code if a transpilation tool was used. + * @returns Returns true if the value is an async function. This only reports back what the JavaScript engine is seeing; in particular, the return value may not match the original source code if a transpilation tool was used. */ isAsyncFunction(value: Object): boolean; /** @@ -696,7 +1418,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A BigInt64Array value - * @return Returns true if the value is a BigInt64Array instance. + * @returns Returns true if the value is a BigInt64Array instance. */ isBigInt64Array(value: Object): boolean; /** @@ -704,7 +1426,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A BigUint64Array value - * @return Returns true if the value is a BigUint64Array instance. + * @returns Returns true if the value is a BigUint64Array instance. */ isBigUint64Array(value: Object): boolean; /** @@ -712,7 +1434,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A boolean object value - * @return Returns true if the value is a boolean object, e.g. created by new Boolean(). + * @returns Returns true if the value is a boolean object, e.g. created by new Boolean(). */ isBooleanObject(value: Object): boolean; /** @@ -720,7 +1442,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A boxed primitive object value - * @return Returns true if the value is any boxed primitive object, e.g. created by new Boolean(), new String() or Object(Symbol()). + * @returns Returns true if the value is any boxed primitive object, e.g. created by new Boolean(), new String() or Object(Symbol()). */ isBoxedPrimitive(value: Object): boolean; /** @@ -728,7 +1450,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A DataView value - * @return Returns true if the value is a built-in DataView instance. + * @returns Returns true if the value is a built-in DataView instance. */ isDataView(value: Object): boolean; /** @@ -736,7 +1458,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A Date value - * @return Returns true if the value is a built-in Date instance. + * @returns Returns true if the value is a built-in Date instance. */ isDate(value: Object): boolean; /** @@ -744,7 +1466,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A External value - * @return Returns true if the value is a native External value. + * @returns Returns true if the value is a native External value. */ isExternal(value: Object): boolean; /** @@ -752,7 +1474,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A Float32Array value - * @return Returns true if the value is a built-in Float32Array instance. + * @returns Returns true if the value is a built-in Float32Array instance. */ isFloat32Array(value: Object): boolean; /** @@ -760,7 +1482,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A Float64Array value - * @return Returns true if the value is a built-in Float64Array instance. + * @returns Returns true if the value is a built-in Float64Array instance. */ isFloat64Array(value: Object): boolean; /** @@ -768,7 +1490,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A generator function value - * @return Returns true if the value is a generator function. This only reports back what the JavaScript engine is seeing; in particular, the return value may not match the original source code if a transpilation tool was used. + * @returns Returns true if the value is a generator function. This only reports back what the JavaScript engine is seeing; in particular, the return value may not match the original source code if a transpilation tool was used. */ isGeneratorFunction(value: Object): boolean; /** @@ -776,7 +1498,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A generator object value - * @return Returns true if the value is a generator object as returned from a built-in generator function. This only reports back what the JavaScript engine is seeing; in particular, the return value may not match the original source code if a transpilation tool was used. + * @returns Returns true if the value is a generator object as returned from a built-in generator function. This only reports back what the JavaScript engine is seeing; in particular, the return value may not match the original source code if a transpilation tool was used. */ isGeneratorObject(value: Object): boolean; /** @@ -784,7 +1506,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A Int8Array value - * @return Returns true if the value is a built-in Int8Array instance. + * @returns Returns true if the value is a built-in Int8Array instance. */ isInt8Array(value: Object): boolean; /** @@ -792,7 +1514,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A Int16Array value - * @return Returns true if the value is a built-in Int16Array instance. + * @returns Returns true if the value is a built-in Int16Array instance. */ isInt16Array(value: Object): boolean; /** @@ -800,7 +1522,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A Int32Array value - * @return Returns true if the value is a built-in Int32Array instance. + * @returns Returns true if the value is a built-in Int32Array instance. */ isInt32Array(value: Object): boolean; /** @@ -808,7 +1530,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A Map value - * @return Returns true if the value is a built-in Map instance. + * @returns Returns true if the value is a built-in Map instance. */ isMap(value: Object): boolean; /** @@ -816,7 +1538,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A Map iterator value - * @return Returns true if the value is an iterator returned for a built-in Map instance. + * @returns Returns true if the value is an iterator returned for a built-in Map instance. */ isMapIterator(value: Object): boolean; /** @@ -824,7 +1546,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A Module Namespace Object value - * @return Returns true if the value is an instance of a Module Namespace Object. + * @returns Returns true if the value is an instance of a Module Namespace Object. */ isModuleNamespaceObject(value: Object): boolean; /** @@ -832,7 +1554,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A Error value - * @return Returns true if the value is an instance of a built-in Error type. + * @returns Returns true if the value is an instance of a built-in Error type. */ isNativeError(value: Object): boolean; /** @@ -840,7 +1562,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A number object value - * @return Returns true if the value is a number object, e.g. created by new Number(). + * @returns Returns true if the value is a number object, e.g. created by new Number(). */ isNumberObject(value: Object): boolean; /** @@ -848,7 +1570,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A Promise value - * @return Returns true if the value is a built-in Promise. + * @returns Returns true if the value is a built-in Promise. */ isPromise(value: Object): boolean; /** @@ -856,7 +1578,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A Proxy value - * @return Returns true if the value is a Proxy instance. + * @returns Returns true if the value is a Proxy instance. */ isProxy(value: Object): boolean; /** @@ -864,7 +1586,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A regular expression object value - * @return Returns true if the value is a regular expression object. + * @returns Returns true if the value is a regular expression object. */ isRegExp(value: Object): boolean; /** @@ -872,7 +1594,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A Set instance value - * @return Returns true if the value is a built-in Set instance. + * @returns Returns true if the value is a built-in Set instance. */ isSet(value: Object): boolean; /** @@ -880,7 +1602,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A Set iterator value - * @return Returns true if the value is an iterator returned for a built-in Set instance. + * @returns Returns true if the value is an iterator returned for a built-in Set instance. */ isSetIterator(value: Object): boolean; /** @@ -888,7 +1610,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A SharedArrayBuffer instance value - * @return Returns true if the value is a built-in SharedArrayBuffer instance. This does not include ArrayBuffer instances. Usually, it is desirable to test for both; See isAnyArrayBuffer() for that. + * @returns Returns true if the value is a built-in SharedArrayBuffer instance. This does not include ArrayBuffer instances. Usually, it is desirable to test for both; See isAnyArrayBuffer() for that. */ isSharedArrayBuffer(value: Object): boolean; /** @@ -896,7 +1618,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A String object value - * @return Returns true if the value is a string object, e.g. created by new String(). + * @returns Returns true if the value is a string object, e.g. created by new String(). */ isStringObject(value: Object): boolean; /** @@ -904,7 +1626,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A symbol object value - * @return Returns true if the value is a symbol object, created by calling Object() on a Symbol primitive. + * @returns Returns true if the value is a symbol object, created by calling Object() on a Symbol primitive. */ isSymbolObject(value: Object): boolean; /** @@ -912,7 +1634,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A TypedArray instance value - * @return Returns true if the value is a built-in TypedArray instance. + * @returns Returns true if the value is a built-in TypedArray instance. */ isTypedArray(value: Object): boolean; /** @@ -920,7 +1642,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A Uint8Array value - * @return Returns true if the value is a built-in Uint8Array instance. + * @returns Returns true if the value is a built-in Uint8Array instance. */ isUint8Array(value: Object): boolean; /** @@ -928,7 +1650,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A Uint8ClampedArray value - * @return Returns true if the value is a built-in Uint8ClampedArray instance. + * @returns Returns true if the value is a built-in Uint8ClampedArray instance. */ isUint8ClampedArray(value: Object): boolean; /** @@ -936,7 +1658,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A Uint16Array value - * @return Returns true if the value is a built-in Uint16Array instance. + * @returns Returns true if the value is a built-in Uint16Array instance. */ isUint16Array(value: Object): boolean; /** @@ -944,7 +1666,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A Uint32Array value - * @return Returns true if the value is a built-in Uint32Array instance. + * @returns Returns true if the value is a built-in Uint32Array instance. */ isUint32Array(value: Object): boolean; /** @@ -952,7 +1674,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A WeakMap value - * @return Returns true if the value is a built-in WeakMap instance. + * @returns Returns true if the value is a built-in WeakMap instance. */ isWeakMap(value: Object): boolean; /** @@ -960,7 +1682,7 @@ declare namespace util { * @since 8 * @syscap SystemCapability.Utils.Lang * @param value A WeakSet value - * @return Returns true if the value is a built-in WeakSet instance. + * @returns Returns true if the value is a built-in WeakSet instance. */ isWeakSet(value: Object): boolean; } diff --git a/api/@ohos.vibrator.d.ts b/api/@ohos.vibrator.d.ts index 83f8d961c19085f7a7baf632092892e1b85f86b1..7063ef78857ca4845935217c30cf6f4c8135686e 100755 --- a/api/@ohos.vibrator.d.ts +++ b/api/@ohos.vibrator.d.ts @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + import { AsyncCallback } from './basic'; /** @@ -19,7 +20,6 @@ import { AsyncCallback } from './basic'; * * @since 8 * @syscap SystemCapability.Sensors.MiscDevice - * @import import vibrator from '@ohos.vibrator' */ declare namespace vibrator { /** @@ -29,7 +29,7 @@ declare namespace vibrator { * @permission ohos.permission.VIBRATE * @since 8 * @deprecated since 9 - * @useinstead ohos.vibrator.startVibration + * @useinstead vibrator#startVibration */ function vibrate(duration: number, callback?: AsyncCallback): void; function vibrate(duration: number): Promise; @@ -41,7 +41,7 @@ declare namespace vibrator { * @permission ohos.permission.VIBRATE * @since 8 * @deprecated since 9 - * @useinstead ohos.vibrator.startVibration + * @useinstead vibrator#startVibration */ function vibrate(effectId: EffectId): Promise; function vibrate(effectId: EffectId, callback?: AsyncCallback): void; @@ -83,7 +83,7 @@ declare namespace vibrator { * @permission ohos.permission.VIBRATE * @since 8 * @deprecated since 9 - * @useinstead ohos.vibrator.stopVibration + * @useinstead vibrator#stopVibration */ function stop(stopMode: VibratorStopMode): Promise; function stop(stopMode: VibratorStopMode, callback?: AsyncCallback): void; diff --git a/api/@ohos.wallpaper.d.ts b/api/@ohos.wallpaper.d.ts index 09e94670c19f8501e63f360b2dbce13498e9c7b1..9dd484769ac4127d66f2dee1f832201f3d8691be 100644 --- a/api/@ohos.wallpaper.d.ts +++ b/api/@ohos.wallpaper.d.ts @@ -18,7 +18,6 @@ import image from './@ohos.multimedia.image'; /** * System wallpaper * @syscap SystemCapability.MiscServices.Wallpaper - * @import import wallpaper from '@ohos.wallpaper'; * @since 7 */ declare namespace wallpaper { @@ -76,7 +75,7 @@ declare namespace wallpaper { /** * Obtains a file of the wallpaper of the specified type. Returns the file descriptor. * @param wallpaperType Indicates the wallpaper type. - * @permission ohos.permission.GET_WALLPAPER. + * @permission ohos.permission.GET_WALLPAPER * ohos.permission.READ_USER_STORAGE. * @returns { Promise } the Promise returned by the function. * @since 8 @@ -89,7 +88,7 @@ declare namespace wallpaper { /** * Obtains a file of the wallpaper of the specified type. Returns the file descriptor. * @param wallpaperType Indicates the wallpaper type. - * @permission ohos.permission.GET_WALLPAPER. + * @permission ohos.permission.GET_WALLPAPER * @returns { number } the number returned by the function. * @throws {BusinessError} 401 - parameter error. * @throws {BusinessError} 201 - permission denied. diff --git a/api/@ohos.wantAgent.d.ts b/api/@ohos.wantAgent.d.ts index 48a996a4816d4cb917332e965b0ca0d4c0b1f803..b5b7e9ddc430de009481a43849c4321cae81b9a6 100644 --- a/api/@ohos.wantAgent.d.ts +++ b/api/@ohos.wantAgent.d.ts @@ -25,15 +25,16 @@ import { TriggerInfo as _TriggerInfo } from './wantAgent/triggerInfo'; * @name wantAgent * @since 7 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @import import wantAgent from '@ohos.wantAgent'; * @permission N/A + * @deprecated since 9 + * @useinstead ohos.app.ability.wantAgent */ 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. + * @returns Returns the bundle name of the {@link WantAgent} if any. */ function getBundleName(agent: WantAgent, callback: AsyncCallback): void; function getBundleName(agent: WantAgent): Promise; @@ -42,7 +43,7 @@ declare namespace wantAgent { * 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. + * @returns 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; @@ -51,7 +52,7 @@ declare namespace wantAgent { * 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}. + * @returns Returns the {@link Want} of the {@link WantAgent}. * @systemapi Hide this for inner system use. */ function getWant(agent: WantAgent, callback: AsyncCallback): void; @@ -60,13 +61,13 @@ declare namespace wantAgent { * 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}. + * @returns 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. + * Cancel a WantAgent. Only the application that creates the WantAgent can cancel it. * * @param WantAgent to cancel. */ @@ -97,7 +98,7 @@ declare namespace wantAgent { * * @param WantAgent to compare. * @param WantAgent to compare. - * @return Returns {@code true} If the two objects are the same; returns {@code false} otherwise. + * @returns 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; @@ -106,7 +107,7 @@ declare namespace wantAgent { * Obtains a WantAgent object. * * @param Information about the WantAgent object to obtain. - * @return Returns the created {@link WantAgent} object. + * @returns Returns the created {@link WantAgent} object. */ function getWantAgent(info: WantAgentInfo, callback: AsyncCallback): void; function getWantAgent(info: WantAgentInfo): Promise; @@ -116,7 +117,7 @@ declare namespace 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}. + * @returns Returns the {@link OperationType} of the {@link WantAgent}. */ function getOperationType(agent: WantAgent, callback: AsyncCallback): void; function getOperationType(agent: WantAgent): Promise; diff --git a/api/@ohos.web.webview.d.ts b/api/@ohos.web.webview.d.ts index 1ef2d8ad7c51ed0f0f31da3b80c89a55affcce0b..164a1ef7521e7b275f01238449df211ec577a2fa 100644 --- a/api/@ohos.web.webview.d.ts +++ b/api/@ohos.web.webview.d.ts @@ -19,105 +19,105 @@ import {AsyncCallback} from "./basic"; import {Resource} from 'GlobalResource'; /** - * Defines the Web's request/response header. + * This module provides the capability to manage web modules. + * * @since 9 + * @syscap SystemCapability.Web.Webview.Core */ - declare interface HeaderV9 { - /** - * Gets the key of the request/response header. - * @since 9 - */ - headerKey: string; - +declare namespace webview { /** - * Gets the value of the request/response header. + * Defines the Web's request/response header. * @since 9 */ - headerValue: string; - } + interface HeaderV9 { + /** + * Gets the key of the request/response header. + * @since 9 + */ + headerKey: string; -/** - * Enum type supplied to {@link getHitTest} for indicating the cursor node HitTest. - * @since 9 - */ - declare enum HitTestTypeV9 { - /** - * The edit text. - * @since 9 - */ - EditText, + /** + * Gets the value of the request/response header. + * @since 9 + */ + headerValue: string; + } /** - * The email address. + * Enum type supplied to {@link getHitTest} for indicating the cursor node HitTest. * @since 9 */ - Email, + enum HitTestTypeV9 { + /** + * The edit text. + * @since 9 + */ + EditText, - /** - * The HTML::a tag with src=http. - * @since 9 - */ - HttpAnchor, + /** + * The email address. + * @since 9 + */ + Email, - /** - * The HTML::a tag with src=http + HTML::img. - * @since 9 - */ - HttpAnchorImg, + /** + * The HTML::a tag with src=http. + * @since 9 + */ + HttpAnchor, - /** - * The HTML::img tag. - * @since 9 - */ - Img, + /** + * The HTML::a tag with src=http + HTML::img. + * @since 9 + */ + HttpAnchorImg, - /** - * The map address. - * @since 9 - */ - Map, + /** + * The HTML::img tag. + * @since 9 + */ + Img, - /** - * The phone number. - * @since 9 - */ - Phone, + /** + * The map address. + * @since 9 + */ + Map, - /** - * Other unknown HitTest. - * @since 9 - */ - Unknown, - } + /** + * The phone number. + * @since 9 + */ + Phone, -/** - * Defines the hit test value, related to {@link getHitTestValue} method. - * @since 9 - */ -declare interface HitTestValue { + /** + * Other unknown HitTest. + * @since 9 + */ + Unknown, + } /** - * Get the hit test type. - * + * Defines the hit test value, related to {@link getHitTestValue} method. * @since 9 */ - type: HitTestTypeV9; + interface HitTestValue { - /** - * Get the hit test extra data. - * - * @since 9 - */ - extra: string; -} + /** + * Get the hit test type. + * + * @since 9 + */ + type: HitTestTypeV9; + + /** + * Get the hit test extra data. + * + * @since 9 + */ + extra: string; + } -/** - * This module provides the capability to manage web modules. - * - * @since 9 - * @syscap SystemCapability.Web.Webview.Core - */ -declare namespace webview { /** * Provides basic information of web storage. * @name WebStorageOrigin @@ -148,8 +148,8 @@ declare namespace webview { * Delete the storage data with the origin. * * @param { string } origin - The origin which to be deleted. - * @throws { BusinessError } 401 - Invaild input parameter. - * @throws { BusinessError } 17100011 - Invaild permission origin. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 17100011 - Invalid origin. * @since 9 */ static deleteOrigin(origin : string): void; @@ -157,8 +157,8 @@ declare namespace webview { /** * Get current all the web storage origins. * - * @throws { BusinessError } 401 - Invaild input parameter. - * @throws { BusinessError } 17100012 - Invaild web storage origin. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 17100012 - Invalid web storage origin. * @since 9 */ static getOrigins() : Promise>; @@ -167,8 +167,8 @@ declare namespace webview { /** * Get the web storage quota with the origin. * @param { string } origin - The origin which to be inquired. - * @throws { BusinessError } 401 - Invaild input parameter. - * @throws { BusinessError } 17100011 - Invaild permission origin. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 17100011 - Invalid origin. * @since 9 */ static getOriginQuota(origin : string) : Promise; @@ -177,8 +177,8 @@ declare namespace webview { /** * Get the web storage quota with the origin. * @param { string } origin - The origin which to be inquired. - * @throws { BusinessError } 401 - Invaild input parameter. - * @throws { BusinessError } 17100011 - Invaild permission origin. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 17100011 - Invalid origin. * @since 9 */ static getOriginUsage(origin : string) : Promise ; @@ -194,7 +194,7 @@ declare namespace webview { class WebDataBase { /** * Get whether instances holds any http authentication credentials. - * @return { boolean } true if instances saved any http authentication credentials otherwise false. + * @returns { boolean } true if instances saved any http authentication credentials otherwise false. * * @since 9 */ @@ -211,8 +211,8 @@ declare namespace webview { * Get http authentication credentials. * @param { string } host - The host to which the credentials apply. * @param { string } realm - The realm to which the credentials apply. - * @throws { BusinessError } 401 - Invaild input parameter. - * @return { Array } Return an array containing username and password. + * @throws { BusinessError } 401 - Invalid input parameter. + * @returns { Array } Return an array containing username and password. * @since 9 */ static getHttpAuthCredentials(host: string, realm: string): Array; @@ -223,7 +223,7 @@ declare namespace webview { * @param { string } realm - The realm to which the credentials apply. * @param { string } username - The username. * @param { string } password - The password. - * @throws { BusinessError } 401 - Invaild input parameter. + * @throws { BusinessError } 401 - Invalid input parameter. * * @since 9 */ @@ -289,8 +289,8 @@ declare namespace webview { /** * Allow geolocation permissions for specifies source. * @param { string } origin - Url source. - * @throws { BusinessError } 401 - Invaild input parameter. - * @throws { BusinessError } 17100011 - Invaild permission origin. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 17100011 - Invalid origin. * * @since 9 */ @@ -299,8 +299,8 @@ declare namespace webview { /** * Delete geolocation permissions for specifies source. * @param { string } origin - Url source. - * @throws { BusinessError } 401 - Invaild input parameter. - * @throws { BusinessError } 17100011 - Invaild permission origin. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 17100011 - Invalid origin. * * @since 9 */ @@ -318,9 +318,9 @@ declare namespace webview { * @param { string } origin - Url source. * @param { AsyncCallback } callback - Return to the specified source * geographic location permission status. - * @throws { BusinessError } 401 - Invaild input parameter. - * @throws { BusinessError } 17100011 - Invaild permission origin. - * @return { Promise } Return whether there is a saved result. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 17100011 - Invalid origin. + * @returns { Promise } Return whether there is a saved result. * * @since 9 */ @@ -331,8 +331,8 @@ declare namespace webview { * Get all stored geolocation permission url source. * @param { AsyncCallback } callback - Return all source information of * stored geographic location permission status. - * @throws { BusinessError } 401 - Invaild input parameter. - * @return { Promise> } Return whether there is a saved result. + * @throws { BusinessError } 401 - Invalid input parameter. + * @returns { Promise> } Return whether there is a saved result. * * @since 9 */ @@ -350,8 +350,8 @@ declare namespace webview { * Gets all cookies for the given URL. * * @param { string } url - The URL for which the cookies are requested. - * @throws { BusinessError } 401 - Invaild input parameter. - * @throws { BusinessError } 17100002 - Invaild url. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 17100002 - Invalid url. * @returns The cookie value for the given URL. * * @since 9 @@ -363,36 +363,25 @@ declare namespace webview { * * @param { string } url - The URL for which the cookie is to be set. * @param { string } value - The cookie as a string, using the format of the 'Set-Cookie' HTTP response header. - * @throws { BusinessError } 401 - Invaild input parameter. - * @throws { BusinessError } 17100002 - Invaild url. - * @throws { BusinessError } 17100005 - Invaild cookie value. + * @throws { BusinessError } 401 - Invalid input parameter. + * @throws { BusinessError } 17100002 - Invalid url. + * @throws { BusinessError } 17100005 - Invalid cookie value. * * @since 9 */ static setCookie(url: string, value: string): void; - /** - * Save the cookies Synchronously. - * - * @since 9 - */ - static saveCookieSync(): void; - /** * Save the cookies Asynchronously. * - * @param { AsyncCallback } callback - Called after the cookies have been saved. - * The parameter will either be true if the cookies - * have been successfully saved, or false if failed. - * @throws { BusinessError } 401 - Invaild input parameter. - * @return { Promise } A promise resolved after the cookies have been saved. - * The parameter will either be true if the cookies have - * been successfully saved, or false if failed. + * @param { AsyncCallback } callback - Called after the cookies have been saved. + * @throws { BusinessError } 401 - Invalid input parameter. + * @returns { Promise } A promise resolved after the cookies have been saved. * * @since 9 */ - static saveCookieAsync(): Promise; - static saveCookieAsync(callback: AsyncCallback): void; + static saveCookieAsync(): Promise; + static saveCookieAsync(callback: AsyncCallback): void; /** * Get whether the instance can send and accept cookies. @@ -408,7 +397,7 @@ declare namespace webview { * By default this is set to be true. * * @param { boolean } accept - Whether the instance should send and accept cookies. - * @throws { BusinessError } 401 - Invaild input parameter. + * @throws { BusinessError } 401 - Invalid input parameter. * * @since 9 */ @@ -425,10 +414,10 @@ declare namespace webview { /** * Set whether the instance should send and accept thirdparty cookies. - * By default this is set to be true. + * By default this is set to be false. * * @param { boolean } accept - Whether the instance should send and accept thirdparty cookies. - * @throws { BusinessError } 401 - Invaild input parameter. + * @throws { BusinessError } 401 - Invalid input parameter. * * @since 9 */ @@ -472,7 +461,7 @@ declare namespace webview { /** * Post a message to other port. * @param { string } message - Message to send. - * @throws { BusinessError } 401 - Invaild input parameter. + * @throws { BusinessError } 401 - Invalid input parameter. * @throws { BusinessError } 17100010 - Can not post message using this port. * * @since 9 @@ -482,7 +471,7 @@ declare namespace webview { /** * Receive message from other port. * @param { (result: string) => void } callback - Callback function for receiving messages. - * @throws { BusinessError } 401 - Invaild input parameter. + * @throws { BusinessError } 401 - Invalid input parameter. * @throws { BusinessError } 17100006 - Can not register message event using this port. * * @since 9 @@ -500,7 +489,7 @@ declare namespace webview { * Checks whether the web page can go forward. * * @throws { BusinessError } 17100001 - Init error. - * The WebviewController must be associted with a Web component. + * The WebviewController must be associated with a Web component. * @returns { boolean } True if the web page can go forward else false. * * @since 9 @@ -511,7 +500,7 @@ declare namespace webview { * Checks whether the web page can go back. * * @throws { BusinessError } 17100001 - Init error. - * The WebviewController must be associted with a Web component. + * The WebviewController must be associated with a Web component. * @returns { boolean } True if the web page can go back else false. * * @since 9 @@ -522,9 +511,9 @@ declare namespace webview { * Checks whether the web page can go back or forward the given number of steps. * * @param { number } step - The number of steps. - * @throws { BusinessError } 401 - Invaild input parameter. + * @throws { BusinessError } 401 - Invalid input parameter. * @throws { BusinessError } 17100001 - Init error. - * The WebviewController must be associted with a Web component. + * The WebviewController must be associated with a Web component. * @returns { boolean } True if the web page can go back else false. * * @since 9 @@ -535,8 +524,7 @@ declare namespace webview { * Goes forward in the history of the web page. * * @throws { BusinessError } 17100001 - Init error. - * The WebviewController must be associted with a Web component. - * @throws { BusinessError } 17100007 - Invalid back or forward operation. + * The WebviewController must be associated with a Web component. * * @since 9 */ @@ -546,8 +534,7 @@ declare namespace webview { * Goes back in the history of the web page. * * @throws { BusinessError } 17100001 - Init error. - * The WebviewController must be associted with a Web component. - * @throws { BusinessError } 17100007 - Invalid back or forward operation. + * The WebviewController must be associated with a Web component. * * @since 9 */ @@ -557,7 +544,7 @@ declare namespace webview { * Clears the history in the Web. * * @throws { BusinessError } 17100001 - Init error. - * The WebviewController must be associted with a Web component. + * The WebviewController must be associated with a Web component. * @since 9 */ clearHistory(): void; @@ -566,7 +553,7 @@ declare namespace webview { * Let the Web active. * * @throws { BusinessError } 17100001 - Init error. - * The WebviewController must be associted with a Web component. + * The WebviewController must be associated with a Web component. * @since 9 */ onActive(): void; @@ -575,7 +562,7 @@ declare namespace webview { * Let the Web inactive. * * @throws { BusinessError } 17100001 - Init error. - * The WebviewController must be associted with a Web component. + * The WebviewController must be associated with a Web component. * @since 9 */ onInactive(): void; @@ -584,7 +571,7 @@ declare namespace webview { * Refreshes the current URL. * * @throws { BusinessError } 17100001 - Init error. - * The WebviewController must be associted with a Web component. + * The WebviewController must be associated with a Web component. * @since 9 */ refresh(): void; @@ -600,10 +587,10 @@ declare namespace webview { * @param { string } [historyUrl] - History URL. When it is not empty, it can be managed by * history records to realize the back and forth function. * This property is invalid when baseUrl is empty. - * @throws { BusinessError } 401 - Invaild input parameter. + * @throws { BusinessError } 401 - Invalid input parameter. * @throws { BusinessError } 17100001 - Init error. - * The WebviewController must be associted with a Web component. - * @throws { BusinessError } 17100002 - Invaild url. + * The WebviewController must be associated with a Web component. + * @throws { BusinessError } 17100002 - Invalid url. * * @since 9 */ @@ -614,10 +601,10 @@ declare namespace webview { * * @param { string | Resource } url - The URL to load. * @param { Array } [headers] - Additional HTTP request header for URL. - * @throws { BusinessError } 401 - Invaild input parameter. + * @throws { BusinessError } 401 - Invalid input parameter. * @throws { BusinessError } 17100001 - Init error. - * The WebviewController must be associted with a Web component. - * @throws { BusinessError } 17100002 - Invaild url. + * The WebviewController must be associated with a Web component. + * @throws { BusinessError } 17100002 - Invalid url. * @throws { BusinessError } 17100003 - Invalid resource path or file type. * * @since 9 @@ -628,7 +615,7 @@ declare namespace webview { * Gets the type of HitTest. * * @throws { BusinessError } 17100001 - Init error. - * The WebviewController must be associted with a Web component. + * The WebviewController must be associated with a Web component. * @returns { HitTestTypeV9 } The type of HitTest. * * @since 9 @@ -646,9 +633,9 @@ declare namespace webview { * @param { AsyncCallback } callback - called after the web archive has been stored. The parameter * will either be the filename under which the file was stored, * or empty if storing the file failed. - * @throws { BusinessError } 401 - Invaild input parameter. + * @throws { BusinessError } 401 - Invalid input parameter. * @throws { BusinessError } 17100001 - Init error. - * The WebviewController must be associted with a Web component. + * The WebviewController must be associated with a Web component. * @throws { BusinessError } 17100003 - Invalid resource path or file type. * @returns { Promise } a promise resolved after the web archive has been stored. The parameter * will either be the filename under which the file was stored, or empty @@ -663,11 +650,10 @@ declare namespace webview { * Let the Web zoom by. * * @param { number } factor - The zoom factor. - * @throws { BusinessError } 401 - Invaild input parameter. + * @throws { BusinessError } 401 - Invalid input parameter. * @throws { BusinessError } 17100001 - Init error. - * The WebviewController must be associted with a Web component. + * The WebviewController must be associated with a Web component. * @throws { BusinessError } 17100004 - Function not enable. - * @throws { BusinessError } 17100009 - Cannot zoom in or zoom out. * * @since 9 */ @@ -677,9 +663,8 @@ declare namespace webview { * Let the Web zoom in. * * @throws { BusinessError } 17100001 - Init error. - * The WebviewController must be associted with a Web component. + * The WebviewController must be associated with a Web component. * @throws { BusinessError } 17100004 - Function not enable. - * @throws { BusinessError } 17100009 - Cannot zoom in or zoom out. * * @since 9 */ @@ -689,9 +674,8 @@ declare namespace webview { * Let the Web zoom out. * * @throws { BusinessError } 17100001 - Init error. - * The WebviewController must be associted with a Web component. + * The WebviewController must be associated with a Web component. * @throws { BusinessError } 17100004 - Function not enable. - * @throws { BusinessError } 17100009 - Cannot zoom in or zoom out. * * @since 9 */ @@ -701,7 +685,7 @@ declare namespace webview { * Gets the hit test value of HitTest. * * @throws { BusinessError } 17100001 - Init error. - * The WebviewController must be associted with a Web component. + * The WebviewController must be associated with a Web component. * @returns { HitTestValue } Return the element information of the clicked area. * * @since 9 @@ -712,7 +696,7 @@ declare namespace webview { * Gets the id for the current Web. * * @throws { BusinessError } 17100001 - Init error. - * The WebviewController must be associted with a Web component. + * The WebviewController must be associated with a Web component. * @returns { number } Returns the index value of the current Web component. * * @since 9 @@ -723,7 +707,7 @@ declare namespace webview { * Gets the default user agent. * * @throws { BusinessError } 17100001 - Init error. - * The WebviewController must be associted with a Web component. + * The WebviewController must be associated with a Web component. * @returns { string } Return user agent information. * * @since 9 @@ -734,7 +718,7 @@ declare namespace webview { * Gets the title of current Web page. * * @throws { BusinessError } 17100001 - Init error. - * The WebviewController must be associted with a Web component. + * The WebviewController must be associated with a Web component. * @returns { string } Return to File Selector Title. * * @since 9 @@ -745,7 +729,7 @@ declare namespace webview { * Gets the content height of current Web page. * * @throws { BusinessError } 17100001 - Init error. - * The WebviewController must be associted with a Web component. + * The WebviewController must be associated with a Web component. * @returns { number } Returns the page height of the current page. * * @since 9 @@ -756,10 +740,9 @@ declare namespace webview { * Goes forward or back backOrForward in the history of the web page. * * @param { number } step - Steps to go forward or backward. - * @throws { BusinessError } 401 - Invaild input parameter. + * @throws { BusinessError } 401 - Invalid input parameter. * @throws { BusinessError } 17100001 - Init error. - * The WebviewController must be associted with a Web component. - * @throws { BusinessError } 17100007 - Invalid back or forward operation. + * The WebviewController must be associated with a Web component. * * @since 9 */ @@ -769,7 +752,7 @@ declare namespace webview { * Gets the request focus. * * @throws { BusinessError } 17100001 - Init error. - * The WebviewController must be associted with a Web component. + * The WebviewController must be associated with a Web component. * * @since 9 */ @@ -779,7 +762,7 @@ declare namespace webview { * Create web message ports * * @throws { BusinessError } 17100001 - Init error. - * The WebviewController must be associted with a Web component. + * The WebviewController must be associated with a Web component. * @returns { Array } An array represent 2 WebMessagePort, then can use * those ports to communication with html pages. * @@ -793,9 +776,9 @@ declare namespace webview { * @param { string } name - Data name information to send. * @param { Array } ports - Port number array information to send. * @param { string } uri - URI to receive this information. - * @throws { BusinessError } 401 - Invaild input parameter. + * @throws { BusinessError } 401 - Invalid input parameter. * @throws { BusinessError } 17100001 - Init error. - * The WebviewController must be associted with a Web component. + * The WebviewController must be associated with a Web component. * * @since 9 */ @@ -805,11 +788,11 @@ declare namespace webview { * Stops the current load. * * @throws { BusinessError } 17100001 - Init error. - * The WebviewController must be associted with a Web component. + * The WebviewController must be associated with a Web component. * * @since 9 */ - stop(); + stop(): void; /** * Registers the JavaScript object and method list. @@ -819,9 +802,9 @@ declare namespace webview { * object name called in the window. * @param { Array } methodList - Thr method of the application side JavaScript object participating * in the registration. - * @throws { BusinessError } 401 - Invaild input parameter. + * @throws { BusinessError } 401 - Invalid input parameter. * @throws { BusinessError } 17100001 - Init error. - * The WebviewController must be associted with a Web component. + * The WebviewController must be associated with a Web component. * * @since 9 */ @@ -831,9 +814,9 @@ declare namespace webview { * Deletes a registered JavaScript object with given name. * * @param { string } name - The name of a registered JavaScript object to be deleted. - * @throws { BusinessError } 401 - Invaild input parameter. + * @throws { BusinessError } 401 - Invalid input parameter. * @throws { BusinessError } 17100001 - Init error. - * The WebviewController must be associted with a Web component. + * The WebviewController must be associated with a Web component. * @throws { BusinessError } 17100008 - Cannot delete JavaScriptProxy. * * @since 9 @@ -845,9 +828,9 @@ declare namespace webview { * result will be notify through callback onSearchResultReceive. * * @param { string } searchString - String to be search. - * @throws { BusinessError } 401 - Invaild input parameter. + * @throws { BusinessError } 401 - Invalid input parameter. * @throws { BusinessError } 17100001 - Init error. - * The WebviewController must be associted with a Web component. + * The WebviewController must be associated with a Web component. * * @since 9 */ @@ -857,7 +840,7 @@ declare namespace webview { * Clears the highlighting surrounding text matches created by searchAllAsync. * * @throws { BusinessError } 17100001 - Init error. - * The WebviewController must be associted with a Web component. + * The WebviewController must be associated with a Web component. * * @since 9 */ @@ -867,9 +850,9 @@ declare namespace webview { * Highlights and scrolls to the next match search. * * @param { boolean } forward - Step of search is back or forward. - * @throws { BusinessError } 401 - Invaild input parameter. + * @throws { BusinessError } 401 - Invalid input parameter. * @throws { BusinessError } 17100001 - Init error. - * The WebviewController must be associted with a Web component. + * The WebviewController must be associated with a Web component. * * @since 9 */ @@ -879,7 +862,7 @@ declare namespace webview { * Clears the ssl cache in the Web. * * @throws { BusinessError } 17100001 - Init error. - * The WebviewController must be associted with a Web component. + * The WebviewController must be associated with a Web component. * * @since 9 */ @@ -889,7 +872,7 @@ declare namespace webview { * Clears the client authentication certificate cache in the Web. * * @throws { BusinessError } 17100001 - Init error. - * The WebviewController must be associted with a Web component. + * The WebviewController must be associated with a Web component. * * @since 9 */ @@ -900,9 +883,9 @@ declare namespace webview { * * @param { string } script - JavaScript Script. * @param { AsyncCallback } callback - Callbacks execute JavaScript script results. - * @throws { BusinessError } 401 - Invaild input parameter. + * @throws { BusinessError } 401 - Invalid input parameter. * @throws { BusinessError } 17100001 - Init error. - * The WebviewController must be associted with a Web component. + * The WebviewController must be associated with a Web component. * @returns { Promise } A promise is solved after the JavaScript script is executed. * This parameter will be the result of JavaScript script execution. * If the JavaScript script fails to execute or has no return value, @@ -917,7 +900,7 @@ declare namespace webview { * Gets the url of current Web page. * * @throws { BusinessError } 17100001 - Init error. - * The WebviewController must be associted with a Web component. + * The WebviewController must be associated with a Web component. * @returns { string } Return the url of the current page. * * @since 9 diff --git a/api/@ohos.wifi.d.ts b/api/@ohos.wifi.d.ts index 5636e3110121437abd1d637acd57d68a346c4f96..476684b65d664608c05404ca09507d42084757b6 100644 --- a/api/@ohos.wifi.d.ts +++ b/api/@ohos.wifi.d.ts @@ -31,6 +31,8 @@ declare namespace wifi { * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION * @systemapi Hide this for inner system use. + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.enableWifi */ function enableWifi(): boolean; @@ -43,6 +45,8 @@ declare namespace wifi { * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION * @systemapi Hide this for inner system use. + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.disableWifi */ function disableWifi(): boolean; @@ -54,6 +58,8 @@ declare namespace wifi { * @since 6 * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.GET_WIFI_INFO + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.isWifiActive */ function isWifiActive(): boolean; @@ -67,6 +73,8 @@ declare namespace wifi { * @since 6 * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.LOCATION + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.scan */ function scan(): boolean; @@ -78,21 +86,12 @@ declare namespace wifi { * @since 6 * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.GET_WIFI_INFO and (ohos.permission.GET_WIFI_PEERS_MAC or ohos.permission.LOCATION) + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.getScanResults */ function getScanInfos(): Promise>; function getScanInfos(callback: AsyncCallback>): void; - /** - * Obtains the scanned results. - * - * @return Returns information about scanned Wi-Fi hotspots if any. - * - * @since 9 - * @syscap SystemCapability.Communication.WiFi.STA - * @permission ohos.permission.GET_WIFI_INFO and (ohos.permission.GET_WIFI_PEERS_MAC or ohos.permission.LOCATION) - */ - function getScanInfosSync(): Array; - /** * Adds Wi-Fi connection configuration to the device. * @@ -105,6 +104,8 @@ declare namespace wifi { * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.SET_WIFI_CONFIG * @systemapi Hide this for inner system use. + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.addDeviceConfig */ function addDeviceConfig(config: WifiDeviceConfig): Promise; function addDeviceConfig(config: WifiDeviceConfig, callback: AsyncCallback): void; @@ -120,6 +121,7 @@ declare namespace wifi { * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.SET_WIFI_INFO * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.addCandidateConfig */ function addUntrustedConfig(config: WifiDeviceConfig): Promise; function addUntrustedConfig(config: WifiDeviceConfig, callback: AsyncCallback): void; @@ -134,68 +136,11 @@ declare namespace wifi { * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.SET_WIFI_INFO * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.removeCandidateConfig */ function removeUntrustedConfig(config: WifiDeviceConfig): Promise; function removeUntrustedConfig(config: WifiDeviceConfig, callback: AsyncCallback): void; - /** - * Adds a specified candidate hotspot configuration and returns the networkId. - * - *

          This method adds one configuration at a time. After this configuration is added, - * your device will determine whether to connect to the hotspot. - * - * @param config - candidate config. - * @return Returns {@code networkId} if the configuration is added; returns {@code -1} otherwise. - * - * @since 9 - * @syscap SystemCapability.Communication.WiFi.STA - * @permission ohos.permission.SET_WIFI_INFO - */ - function addCandidateConfig(config: WifiDeviceConfig): Promise; - function addCandidateConfig(config: WifiDeviceConfig, callback: AsyncCallback): void; - - /** - * Removes a specified candidate hotspot configuration, only the configration which is added by ourself is allowed - * to be removed. - * - * @param networkId - Network ID which will be removed. - * @throws {ErrorCode} when failed to remove the hotspot configuration. - * @return {@code true} if the candidate hotspot configuration is removed, returns {@code false} otherwise. - * - * @since 9 - * @syscap SystemCapability.Communication.WiFi.STA - * @permission ohos.permission.SET_WIFI_INFO - */ - function removeCandidateConfig(networkId: number): Promise; - function removeCandidateConfig(networkId: number, callback: AsyncCallback): void; - - /** - * Obtains the list of all existing candidate Wi-Fi configurations which added by ourself. - * - *

          You can obtain only the Wi-Fi configurations you created on your own application. - * - * @return Returns the list of all existing Wi-Fi configurations you created on your application. - * - * @since 9 - * @syscap SystemCapability.Communication.WiFi.STA - * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION - */ - function getCandidateConfigs(): Array; - - /** - * Connect to a specified candidate hotspot configuration, only the configration which is added by ourself - * is allowed to be connected. - * - *

          This method connect to a configuration at a time. - * - * @param networkId - Network ID which will be connected. - * @throws {ErrCode} if operation is failed. - * @since 9 - * @syscap SystemCapability.Communication.WiFi.STA - * @permission ohos.permission.SET_WIFI_INFO - */ - function connectToCandidateConfig(networkId: number): void; - /** * Connects to Wi-Fi network. * @@ -206,6 +151,8 @@ declare namespace wifi { * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.MANAGE_WIFI_CONNECTION * @systemapi Hide this for inner system use. + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.connectToNetwork */ function connectToNetwork(networkId: number): boolean; @@ -220,6 +167,8 @@ declare namespace wifi { * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.SET_WIFI_CONFIG and * ohos.permission.MANAGE_WIFI_CONNECTION * @systemapi Hide this for inner system use. + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.connectToDevice */ function connectToDevice(config: WifiDeviceConfig): boolean; @@ -232,6 +181,8 @@ declare namespace wifi { * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION * @systemapi Hide this for inner system use. + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.disconnect */ function disconnect(): boolean; @@ -245,6 +196,8 @@ declare namespace wifi { * @since 6 * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.GET_WIFI_INFO + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.getSignalLevel */ function getSignalLevel(rssi: number, band: number): number; @@ -255,6 +208,8 @@ declare namespace wifi { * @since 6 * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.GET_WIFI_INFO + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.getLinkedInfo */ function getLinkedInfo(): Promise; function getLinkedInfo(callback: AsyncCallback): void; @@ -266,6 +221,8 @@ declare namespace wifi { * @since 7 * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.GET_WIFI_INFO + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.isConnected */ function isConnected(): boolean; @@ -279,6 +236,8 @@ declare namespace wifi { * @syscap SystemCapability.Communication.WiFi.Core * @permission ohos.permission.GET_WIFI_INFO * @systemapi Hide this for inner system use. + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.getSupportedFeatures */ function getSupportedFeatures(): number; @@ -290,6 +249,8 @@ declare namespace wifi { * @since 7 * @syscap SystemCapability.Communication.WiFi.Core * @permission ohos.permission.GET_WIFI_INFO + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.isFeatureSupported */ function isFeatureSupported(featureId: number): boolean; @@ -303,6 +264,8 @@ declare namespace wifi { * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.GET_WIFI_LOCAL_MAC and ohos.permission.GET_WIFI_INFO * @systemapi Hide this for inner system use. + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.getDeviceMacAddress */ function getDeviceMacAddress(): string[]; @@ -315,6 +278,8 @@ declare namespace wifi { * @since 7 * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.GET_WIFI_INFO + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.getIpInfo */ function getIpInfo(): IpInfo; @@ -325,6 +290,8 @@ declare namespace wifi { * @since 7 * @syscap SystemCapability.Communication.WiFi.Core * @permission ohos.permission.GET_WIFI_INFO + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.getCountryCode */ function getCountryCode(): string; @@ -336,6 +303,8 @@ declare namespace wifi { * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION * @systemapi Hide this for inner system use. + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.reassociate */ function reassociate(): boolean; @@ -347,6 +316,8 @@ declare namespace wifi { * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION * @systemapi Hide this for inner system use. + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.reconnect */ function reconnect(): boolean; @@ -360,6 +331,8 @@ declare namespace wifi { * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.GET_WIFI_CONFIG * @systemapi Hide this for inner system use. + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.getDeviceConfigs */ function getDeviceConfigs(): Array; @@ -374,6 +347,8 @@ declare namespace wifi { * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.SET_WIFI_CONFIG * @systemapi Hide this for inner system use. + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.updateNetwork */ function updateNetwork(config: WifiDeviceConfig): number; @@ -388,6 +363,8 @@ declare namespace wifi { * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION * @systemapi Hide this for inner system use. + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.disableNetwork */ function disableNetwork(netId: number): boolean; @@ -400,6 +377,8 @@ declare namespace wifi { * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION * @systemapi Hide this for inner system use. + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.removeAllNetwork */ function removeAllNetwork(): boolean; @@ -417,6 +396,8 @@ declare namespace wifi { * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION * @systemapi Hide this for inner system use. + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.removeDevice */ function removeDevice(id: number): boolean; @@ -430,6 +411,8 @@ declare namespace wifi { * @syscap SystemCapability.Communication.WiFi.AP.Core * @permission ohos.permission.MANAGE_WIFI_HOTSPOT * @systemapi Hide this for inner system use. + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.enableHotspot */ function enableHotspot(): boolean; @@ -443,6 +426,8 @@ declare namespace wifi { * @syscap SystemCapability.Communication.WiFi.AP.Core * @permission ohos.permission.MANAGE_WIFI_HOTSPOT * @systemapi Hide this for inner system use. + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.disableHotspot */ function disableHotspot(): boolean; @@ -454,6 +439,8 @@ declare namespace wifi { * @syscap SystemCapability.Communication.WiFi.AP.Core * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.MANAGE_WIFI_HOTSPOT * @systemapi Hide this for inner system use. + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.isHotspotDualBandSupported */ function isHotspotDualBandSupported(): boolean; @@ -465,6 +452,8 @@ declare namespace wifi { * @syscap SystemCapability.Communication.WiFi.AP.Core * @permission ohos.permission.GET_WIFI_INFO * @systemapi Hide this for inner system use. + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.isHotspotActive */ function isHotspotActive(): boolean; @@ -481,6 +470,8 @@ declare namespace wifi { * @syscap SystemCapability.Communication.WiFi.AP.Core * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.GET_WIFI_CONFIG * @systemapi Hide this for inner system use. + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.setHotspotConfig */ function setHotspotConfig(config: HotspotConfig): boolean; @@ -492,6 +483,8 @@ declare namespace wifi { * @syscap SystemCapability.Communication.WiFi.AP.Core * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.GET_WIFI_CONFIG * @systemapi Hide this for inner system use. + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.getHotspotConfig */ function getHotspotConfig(): HotspotConfig; @@ -505,6 +498,8 @@ declare namespace wifi { * @syscap SystemCapability.Communication.WiFi.AP.Core * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.MANAGE_WIFI_HOTSPOT * @systemapi Hide this for inner system use. + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.getStations */ function getStations(): Array; @@ -515,6 +510,8 @@ declare namespace wifi { * @since 8 * @syscap SystemCapability.Communication.WiFi.P2P * @permission ohos.permission.GET_WIFI_INFO + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.getP2pLinkedInfo */ function getP2pLinkedInfo(): Promise; function getP2pLinkedInfo(callback: AsyncCallback): void; @@ -526,6 +523,8 @@ declare namespace wifi { * @since 8 * @syscap SystemCapability.Communication.WiFi.P2P * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.getCurrentGroup */ function getCurrentGroup(): Promise; function getCurrentGroup(callback: AsyncCallback): void; @@ -537,24 +536,12 @@ declare namespace wifi { * @since 8 * @syscap SystemCapability.Communication.WiFi.P2P * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.getP2pPeerDevices */ function getP2pPeerDevices(): Promise; function getP2pPeerDevices(callback: AsyncCallback): void; - /** - * Obtains the information about own device info. - * - *

          deviceAddress in the returned WifiP2pDevice will be set "00:00:00:00:00:00", - * if ohos.permission.GET_WIFI_LOCAL_MAC is not granted. - * - * @return Returns the information about own device info. - * @since 9 - * @syscap SystemCapability.Communication.WiFi.P2P - * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.GET_WIFI_CONFIG - */ - function getP2pLocalDevice(): Promise; - function getP2pLocalDevice(callback: AsyncCallback): void; - /** * Creates a P2P group. * @@ -563,6 +550,8 @@ declare namespace wifi { * @since 8 * @syscap SystemCapability.Communication.WiFi.P2P * @permission ohos.permission.GET_WIFI_INFO + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.createGroup */ function createGroup(config: WifiP2PConfig): boolean; @@ -573,6 +562,8 @@ declare namespace wifi { * @since 8 * @syscap SystemCapability.Communication.WiFi.P2P * @permission ohos.permission.GET_WIFI_INFO + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.removeGroup */ function removeGroup(): boolean; @@ -584,6 +575,8 @@ declare namespace wifi { * @since 8 * @syscap SystemCapability.Communication.WiFi.P2P * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.p2pConnect */ function p2pConnect(config: WifiP2PConfig): boolean; @@ -594,6 +587,8 @@ declare namespace wifi { * @since 8 * @syscap SystemCapability.Communication.WiFi.P2P * @permission ohos.permission.GET_WIFI_INFO + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.p2pDisonnect */ function p2pCancelConnect(): boolean; @@ -604,6 +599,8 @@ declare namespace wifi { * @since 8 * @syscap SystemCapability.Communication.WiFi.P2P * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.startDiscoverDevices */ function startDiscoverDevices(): boolean; @@ -614,6 +611,8 @@ declare namespace wifi { * @since 8 * @syscap SystemCapability.Communication.WiFi.P2P * @permission ohos.permission.GET_WIFI_INFO + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.stopDiscoverDevices */ function stopDiscoverDevices(): boolean; @@ -626,21 +625,11 @@ declare namespace wifi { * @syscap SystemCapability.Communication.WiFi.P2P * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION * @systemapi Hide this for inner system use. + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.deletePersistentGroup */ function deletePersistentGroup(netId: number): boolean; - /** - * Obtains information about the groups. - * - * @return Returns the groups information. - * @since 9 - * @syscap SystemCapability.Communication.WiFi.P2P - * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION - * @systemapi Hide this for inner system use. - */ - function getP2pGroups(): Promise>; - function getP2pGroups(callback: AsyncCallback>): void; - /** * Sets the name of the Wi-Fi P2P device. * @@ -650,6 +639,8 @@ declare namespace wifi { * @syscap SystemCapability.Communication.WiFi.P2P * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION * @systemapi Hide this for inner system use. + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.setDeviceName */ function setDeviceName(devName: string): boolean; @@ -660,6 +651,8 @@ declare namespace wifi { * @since 7 * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.GET_WIFI_INFO + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.on#event:wifiStateChange */ function on(type: "wifiStateChange", callback: Callback): void; @@ -671,6 +664,8 @@ declare namespace wifi { * @since 7 * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.GET_WIFI_INFO + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.off#event:wifiStateChange */ function off(type: "wifiStateChange", callback?: Callback): void; @@ -681,6 +676,8 @@ declare namespace wifi { * @since 7 * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.GET_WIFI_INFO + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.on#event:wifiConnectionChange */ function on(type: "wifiConnectionChange", callback: Callback): void; @@ -692,6 +689,8 @@ declare namespace wifi { * @since 7 * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.GET_WIFI_INFO + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.off#event:wifiConnectionChange */ function off(type: "wifiConnectionChange", callback?: Callback): void; @@ -702,6 +701,8 @@ declare namespace wifi { * @since 7 * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.GET_WIFI_INFO + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.on#event:wifiScanStateChange */ function on(type: "wifiScanStateChange", callback: Callback): void; @@ -713,6 +714,8 @@ declare namespace wifi { * @since 7 * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.GET_WIFI_INFO + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.off#event:wifiScanStateChange */ function off(type: "wifiScanStateChange", callback?: Callback): void; @@ -723,6 +726,8 @@ declare namespace wifi { * @since 7 * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.GET_WIFI_INFO + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.on#event:wifiRssiChange */ function on(type: "wifiRssiChange", callback: Callback): void; @@ -734,6 +739,8 @@ declare namespace wifi { * @since 7 * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.GET_WIFI_INFO + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.off#event:wifiRssiChange */ function off(type: "wifiRssiChange", callback?: Callback): void; @@ -745,6 +752,8 @@ declare namespace wifi { * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.MANAGE_WIFI_CONNECTION * @systemapi Hide this for inner system use. + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.on#event:streamChange */ function on(type: "streamChange", callback: Callback): void; @@ -757,31 +766,11 @@ declare namespace wifi { * @syscap SystemCapability.Communication.WiFi.STA * @permission ohos.permission.MANAGE_WIFI_CONNECTION * @systemapi Hide this for inner system use. + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.off#event:streamChange */ function off(type: "streamChange", callback?: Callback): void; - /** - * Subscribe Wi-Fi device config change events. - * - * @return Returns 0: config is added, 1: config is changed, 2: config is removed. - * @since 9 - * @syscap SystemCapability.Communication.WiFi.STA - * @permission ohos.permission.GET_WIFI_INFO - * @systemapi Hide this for inner system use. - */ - function on(type: "deviceConfigChange", callback: Callback): void; - - /** - * Subscribe Wi-Fi device config change events. - * - * @return Returns 0: config is added, 1: config is changed, 2: config is removed. - * @since 9 - * @syscap SystemCapability.Communication.WiFi.STA - * @permission ohos.permission.GET_WIFI_INFO - * @systemapi Hide this for inner system use. - */ - function off(type: "deviceConfigChange", callback?: Callback): void; - /** * Subscribe Wi-Fi hotspot state change events. * @@ -789,6 +778,8 @@ declare namespace wifi { * @since 7 * @syscap SystemCapability.Communication.WiFi.AP.Core * @permission ohos.permission.GET_WIFI_INFO + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.on#event:hotspotStateChange */ function on(type: "hotspotStateChange", callback: Callback): void; @@ -800,6 +791,8 @@ declare namespace wifi { * @since 7 * @syscap SystemCapability.Communication.WiFi.AP.Core * @permission ohos.permission.GET_WIFI_INFO + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.off#event:hotspotStateChange */ function off(type: "hotspotStateChange", callback?: Callback): void; @@ -811,6 +804,8 @@ declare namespace wifi { * @syscap SystemCapability.Communication.WiFi.AP.Core * @permission ohos.permission.MANAGE_WIFI_HOTSPOT * @systemapi Hide this for inner system use. + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.on#event:hotspotStaJoin */ function on(type: "hotspotStaJoin", callback: Callback): void; @@ -823,6 +818,8 @@ declare namespace wifi { * @syscap SystemCapability.Communication.WiFi.AP.Core * @permission ohos.permission.MANAGE_WIFI_HOTSPOT * @systemapi Hide this for inner system use. + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.off#event:hotspotStaJoin */ function off(type: "hotspotStaJoin", callback?: Callback): void; @@ -834,6 +831,8 @@ declare namespace wifi { * @syscap SystemCapability.Communication.WiFi.AP.Core * @permission ohos.permission.MANAGE_WIFI_HOTSPOT * @systemapi Hide this for inner system use. + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.on#event:hotspotStaLeave */ function on(type: "hotspotStaLeave", callback: Callback): void; @@ -845,6 +844,8 @@ declare namespace wifi { * @syscap SystemCapability.Communication.WiFi.AP.Core * @permission ohos.permission.MANAGE_WIFI_HOTSPOT * @systemapi Hide this for inner system use. + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.off#event:hotspotStaLeave */ function off(type: "hotspotStaLeave", callback?: Callback): void; @@ -855,6 +856,8 @@ declare namespace wifi { * @since 8 * @syscap SystemCapability.Communication.WiFi.P2P * @permission ohos.permission.GET_WIFI_INFO + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.on#event:p2pStateChange */ function on(type: "p2pStateChange", callback: Callback): void; @@ -864,6 +867,8 @@ declare namespace wifi { * @since 8 * @syscap SystemCapability.Communication.WiFi.P2P * @permission ohos.permission.GET_WIFI_INFO + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.off#event:p2pStateChange */ function off(type: "p2pStateChange", callback?: Callback): void; @@ -874,6 +879,8 @@ declare namespace wifi { * @since 8 * @syscap SystemCapability.Communication.WiFi.P2P * @permission ohos.permission.GET_WIFI_INFO + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.on#event:p2pConnectionChange */ function on(type: "p2pConnectionChange", callback: Callback): void; @@ -883,6 +890,8 @@ declare namespace wifi { * @since 8 * @syscap SystemCapability.Communication.WiFi.P2P * @permission ohos.permission.GET_WIFI_INFO + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.off#event:p2pConnectionChange */ function off(type: "p2pConnectionChange", callback?: Callback): void; @@ -893,6 +902,8 @@ declare namespace wifi { * @since 8 * @syscap SystemCapability.Communication.WiFi.P2P * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.on#event:p2pDeviceChange */ function on(type: "p2pDeviceChange", callback: Callback): void; @@ -903,6 +914,8 @@ declare namespace wifi { * @since 8 * @syscap SystemCapability.Communication.WiFi.P2P * @permission ohos.permission.LOCATION + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.off#event:p2pDeviceChange */ function off(type: "p2pDeviceChange", callback?: Callback): void; @@ -913,6 +926,8 @@ declare namespace wifi { * @since 8 * @syscap SystemCapability.Communication.WiFi.P2P * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.on#event:p2pPeerDeviceChange */ function on(type: "p2pPeerDeviceChange", callback: Callback): void; @@ -922,6 +937,8 @@ declare namespace wifi { * @since 8 * @syscap SystemCapability.Communication.WiFi.P2P * @permission ohos.permission.LOCATION + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.off#event:p2pPeerDeviceChange */ function off(type: "p2pPeerDeviceChange", callback?: Callback): void; @@ -932,6 +949,8 @@ declare namespace wifi { * @since 8 * @syscap SystemCapability.Communication.WiFi.P2P * @permission ohos.permission.GET_WIFI_INFO + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.on#event:p2pPersistentGroupChange */ function on(type: "p2pPersistentGroupChange", callback: Callback): void; @@ -941,6 +960,8 @@ declare namespace wifi { * @since 8 * @syscap SystemCapability.Communication.WiFi.P2P * @permission ohos.permission.GET_WIFI_INFO + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.off#event:p2pPersistentGroupChange */ function off(type: "p2pPersistentGroupChange", callback?: Callback): void; @@ -951,6 +972,8 @@ declare namespace wifi { * @since 8 * @syscap SystemCapability.Communication.WiFi.P2P * @permission ohos.permission.GET_WIFI_INFO + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.on#event:p2pDiscoveryChange */ function on(type: "p2pDiscoveryChange", callback: Callback): void; @@ -960,99 +983,18 @@ declare namespace wifi { * @since 8 * @syscap SystemCapability.Communication.WiFi.P2P * @permission ohos.permission.GET_WIFI_INFO + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.off#event:p2pDiscoveryChange */ function off(type: "p2pDiscoveryChange", callback?: Callback): void; - /** - * Wi-Fi EAP method. - * - * @since 9 - * @systemapi Hide this for inner system use. - * @syscap SystemCapability.Communication.WiFi.STA - */ - enum EapMethod { - EAP_NONE, - EAP_PEAP, - EAP_TLS, - EAP_TTLS, - EAP_PWD, - EAP_SIM, - EAP_AKA, - EAP_AKA_PRIME, - EAP_UNAUTH_TLS, - } - - /** - * Wi-Fi phase 2 method. - * - * @since 9 - * @systemapi Hide this for inner system use. - * @syscap SystemCapability.Communication.WiFi.STA - */ - enum Phase2Method { - PHASE2_NONE, - PHASE2_PAP, - PHASE2_MSCHAP, - PHASE2_MSCHAPV2, - PHASE2_GTC, - PHASE2_SIM, - PHASE2_AKA, - PHASE2_AKA_PRIME, - } - - /** - * Wi-Fi EAP config. - * - * @since 9 - * @systemapi Hide this for inner system use. - * @syscap SystemCapability.Communication.WiFi.STA - */ - interface WifiEapConfig { - /** EAP authentication method */ - eapMethod: EapMethod; - - /** Phase 2 authentication method */ - phase2Method: Phase2Method; - - /** The identity */ - identity: string; - - /** Anonymous identity */ - anonymousIdentity: string; - - /** Password */ - password: string; - - /** CA certificate alias */ - caCertAliases: string; - - /** CA certificate path */ - caPath: string; - - /** Client certificate alias */ - clientCertAliases: string; - - /** Alternate subject match */ - altSubjectMatch: string; - - /** Domain suffix match */ - domainSuffixMatch: string; - - /** Realm for Passpoint credential */ - realm: string; - - /** Public Land Mobile Network of the provider of Passpoint credential */ - plmn: string; - - /** Sub ID of the SIM card */ - eapSubId: number; - } - /** * Wi-Fi device configuration information. * * @since 6 * @syscap SystemCapability.Communication.WiFi.STA + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.WifiDeviceConfig */ interface WifiDeviceConfig { /** Wi-Fi SSID: the maximum length is 32 */ @@ -1097,15 +1039,6 @@ declare namespace wifi { /** IP config of static */ /* @systemapi */ staticIp: IpConfig; - - /** - * EAP config info. - * - * @since 9 - * @systemapi - * @syscap SystemCapability.Communication.WiFi.STA - */ - eapConfig: WifiEapConfig; } /** @@ -1114,6 +1047,8 @@ declare namespace wifi { * @since 7 * @systemapi Hide this for inner system use. * @syscap SystemCapability.Communication.WiFi.STA + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.IpConfig */ interface IpConfig { ipAddress: number; @@ -1122,40 +1057,13 @@ declare namespace wifi { domains: Array; } - /** - * Wi-Fi information elements. - * - * @since 9 - * @systemapi Hide this for inner system use. - * @syscap SystemCapability.Communication.WiFi.STA - */ - interface WifiInfoElem { - /** Element id */ - eid: number; - /** Element content */ - content: Uint8Array; - } - - /** - * Describes the wifi channel width. - * - * @since 9 - * @syscap SystemCapability.Communication.WiFi.STA - */ - enum WifiChannelWidth { - WIDTH_20MHZ = 0, - WIDTH_40MHZ = 1, - WIDTH_80MHZ = 2, - WIDTH_160MHZ = 3, - WIDTH_80MHZ_PLUS = 4, - WIDTH_INVALID - } - /** * Describes the scanned Wi-Fi information. * * @since 6 * @syscap SystemCapability.Communication.WiFi.STA + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.WifiScanInfo */ interface WifiScanInfo { /** Wi-Fi SSID: the maximum length is 32 */ @@ -1182,30 +1090,6 @@ declare namespace wifi { /** Channel width */ channelWidth: number; - /** - * Center frequency 0. - * - * @since 9 - * @syscap SystemCapability.Communication.WiFi.STA - */ - centerFrequency0: number; - - /** - * Center frequency 1. - * - * @since 9 - * @syscap SystemCapability.Communication.WiFi.STA - */ - centerFrequency1: number; - - /** - * Information elements. - * - * @since 9 - * @syscap SystemCapability.Communication.WiFi.STA - */ - infoElems: Array; - /** Time stamp */ timestamp: number; } @@ -1215,6 +1099,8 @@ declare namespace wifi { * * @since 6 * @syscap SystemCapability.Communication.WiFi.Core + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.WifiSecurityType */ enum WifiSecurityType { /** Invalid security type */ @@ -1231,46 +1117,6 @@ declare namespace wifi { /** Simultaneous Authentication of Equals (SAE) */ WIFI_SEC_TYPE_SAE = 4, - - /** - * EAP authentication. - * - * @since 9 - * @syscap SystemCapability.Communication.WiFi.Core - */ - WIFI_SEC_TYPE_EAP = 5, - - /** - * SUITE_B_192 192 bit level. - * - * @since 9 - * @syscap SystemCapability.Communication.WiFi.Core - */ - WIFI_SEC_TYPE_EAP_SUITE_B = 6, - - /** - * Opportunististic Wireless Encryption. - * - * @since 9 - * @syscap SystemCapability.Communication.WiFi.Core - */ - WIFI_SEC_TYPE_OWE = 7, - - /** - * WAPI certificate to be specified. - * - * @since 9 - * @syscap SystemCapability.Communication.WiFi.Core - */ - WIFI_SEC_TYPE_WAPI_CERT = 8, - - /** - * WAPI pre-shared key to be specified. - * - * @since 9 - * @syscap SystemCapability.Communication.WiFi.Core - */ - WIFI_SEC_TYPE_WAPI_PSK = 9, } /** @@ -1278,6 +1124,8 @@ declare namespace wifi { * * @since 6 * @syscap SystemCapability.Communication.WiFi.STA + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.WifiLinkedInfo */ interface WifiLinkedInfo { /** The SSID of the Wi-Fi hotspot */ @@ -1316,14 +1164,6 @@ declare namespace wifi { /* @systemapi */ snr: number; - /** - * Type of macAddress: 0 - real mac, 1 - random mac. - * - * @since 9 - * @syscap SystemCapability.Communication.WiFi.STA - */ - macType: number; - /** The Wi-Fi MAC address of a device. */ macAddress: string; @@ -1343,6 +1183,8 @@ declare namespace wifi { * * @since 7 * @syscap SystemCapability.Communication.WiFi.STA + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.IpInfo */ interface IpInfo { /** The IP address of the Wi-Fi connection */ @@ -1373,6 +1215,8 @@ declare namespace wifi { * @since 7 * @systemapi Hide this for inner system use. * @syscap SystemCapability.Communication.WiFi.AP.Core + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.HotspotConfig */ interface HotspotConfig { /** The SSID of the Wi-Fi hotspot */ @@ -1397,6 +1241,8 @@ declare namespace wifi { * @since 7 * @systemapi Hide this for inner system use. * @syscap SystemCapability.Communication.WiFi.AP.Core + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.StationInfo */ interface StationInfo { /** the network name of the Wi-Fi client */ @@ -1415,6 +1261,8 @@ declare namespace wifi { * @since 7 * @systemapi Hide this for inner system use. * @syscap SystemCapability.Communication.WiFi.STA + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.IpType */ enum IpType { /** Use statically configured IP settings */ @@ -1433,6 +1281,8 @@ declare namespace wifi { * @since 6 * @systemapi Hide this for inner system use. * @syscap SystemCapability.Communication.WiFi.STA + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.SuppState */ export enum SuppState { /** The supplicant is not associated with or is disconnected from the AP. */ @@ -1477,6 +1327,8 @@ declare namespace wifi { * * @since 6 * @syscap SystemCapability.Communication.WiFi.STA + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.ConnState */ export enum ConnState { /** The device is searching for an available AP. */ @@ -1509,6 +1361,8 @@ declare namespace wifi { * * @since 8 * @syscap SystemCapability.Communication.WiFi.P2P + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.WifiP2pDevice */ interface WifiP2pDevice { /** Device name */ @@ -1532,6 +1386,8 @@ declare namespace wifi { * * @since 8 * @syscap SystemCapability.Communication.WiFi.P2P + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.WifiP2PConfig */ interface WifiP2PConfig { /** Device mac address */ @@ -1558,6 +1414,8 @@ declare namespace wifi { * * @since 8 * @syscap SystemCapability.Communication.WiFi.P2P + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.WifiP2pGroupInfo */ interface WifiP2pGroupInfo { /** Indicates whether it is group owner */ @@ -1593,6 +1451,8 @@ declare namespace wifi { * * @since 8 * @syscap SystemCapability.Communication.WiFi.P2P + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.P2pConnectState */ enum P2pConnectState { DISCONNECTED = 0, @@ -1604,6 +1464,8 @@ declare namespace wifi { * * @since 8 * @syscap SystemCapability.Communication.WiFi.P2P + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.WifiP2pLinkedInfo */ interface WifiP2pLinkedInfo { /** Connection status */ @@ -1621,6 +1483,8 @@ declare namespace wifi { * * @since 8 * @syscap SystemCapability.Communication.WiFi.P2P + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.P2pDeviceStatus */ enum P2pDeviceStatus { CONNECTED = 0, @@ -1635,6 +1499,8 @@ declare namespace wifi { * * @since 8 * @syscap SystemCapability.Communication.WiFi.P2P + * @deprecated since 9 + * @useinstead ohos.wifiManager/wifiManager.GroupOwnerBand */ enum GroupOwnerBand { GO_BAND_AUTO = 0, diff --git a/api/@ohos.wifiManager.d.ts b/api/@ohos.wifiManager.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ee9bdc6388bb5b1a8eb60320c46cfeea45fea128 --- /dev/null +++ b/api/@ohos.wifiManager.d.ts @@ -0,0 +1,1920 @@ +/* + * 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, Callback } from './basic'; + +/** + * Provides methods to operate or manage Wi-Fi. + * + * @since 9 + * @import import wifiManager from '@ohos.wifiManager'; + */ +declare namespace wifiManager { + /** + * Enables Wi-Fi. + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @throws {BusinessError} 2501003 - Failed for wifi is closing. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION + * @systemapi Hide this for inner system use. + */ + function enableWifi(): void; + + /** + * Disables Wi-Fi. + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @throws {BusinessError} 2501004 - Failed for wifi is opening. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION + * @systemapi Hide this for inner system use. + */ + function disableWifi(): void; + + /** + * Queries the Wi-Fi status + * + * @return Returns {@code true} if the Wi-Fi is active, returns {@code false} otherwise. + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.GET_WIFI_INFO + */ + function isWifiActive(): boolean; + + /** + * Scans Wi-Fi hotspots. + * + *

          This API works in asynchronous mode.

          + * + * @return Returns {@code true} if the scanning is successful, returns {@code false} otherwise. + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @throws {BusinessError} 2501001 - Wifi is closed. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.LOCATION + */ + function scan(): void; + + /** + * Obtains the hotspot information that scanned. + * + * @return Returns information about scanned Wi-Fi hotspots if any. + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.GET_WIFI_INFO and (ohos.permission.GET_WIFI_PEERS_MAC or ohos.permission.LOCATION) + */ + function getScanResults(): Promise>; + function getScanResults(callback: AsyncCallback>): void; + + /** + * Obtains the scanned results. + * + * @return Returns information about scanned Wi-Fi hotspots if any. + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.GET_WIFI_INFO and (ohos.permission.GET_WIFI_PEERS_MAC or ohos.permission.LOCATION) + */ + function getScanResultsSync(): Array; + + /** + * Adds Wi-Fi connection configuration to the device. + * + *

          The configuration will be updated when the configuration is added.

          + * + * @param config Indicates the device configuration for connection to the Wi-Fi network. + * @return Returns {@code networkId} if the configuration is added; returns {@code -1} otherwise. + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.SET_WIFI_CONFIG + * @systemapi Hide this for inner system use. + */ + function addDeviceConfig(config: WifiDeviceConfig): Promise; + function addDeviceConfig(config: WifiDeviceConfig, callback: AsyncCallback): void; + + /** + * Adds a specified candidate hotspot configuration and returns the networkId. + * + *

          This method adds one configuration at a time. After this configuration is added, + * your device will determine whether to connect to the hotspot. + * + * @param config - candidate config. + * @return Returns {@code networkId} if the configuration is added; returns {@code -1} otherwise. + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.SET_WIFI_INFO + */ + function addCandidateConfig(config: WifiDeviceConfig): Promise; + function addCandidateConfig(config: WifiDeviceConfig, callback: AsyncCallback): void; + + /** + * Removes a specified candidate hotspot configuration, only the configration which is added by ourself is allowed + * to be removed. + * + * @param networkId - Network ID which will be removed. + * @throws {ErrorCode} when failed to remove the hotspot configuration. + * @return {@code true} if the candidate hotspot configuration is removed, returns {@code false} otherwise. + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.SET_WIFI_INFO + */ + function removeCandidateConfig(networkId: number): Promise; + function removeCandidateConfig(networkId: number, callback: AsyncCallback): void; + + /** + * Obtains the list of all existing candidate Wi-Fi configurations which added by ourself. + * + *

          You can obtain only the Wi-Fi configurations you created on your own application. + * + * @return Returns the list of all existing Wi-Fi configurations you created on your application. + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION + */ + function getCandidateConfigs(): Array; + + /** + * Connect to a specified candidate hotspot configuration, only the configration which is added by ourself + * is allowed to be connected. + * + *

          This method connect to a configuration at a time. + * + * @param networkId - Network ID which will be connected. + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @throws {BusinessError} 2501001 - Wifi is closed. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.SET_WIFI_INFO + */ + function connectToCandidateConfig(networkId: number): void; + + /** + * Connects to Wi-Fi network. + * + * @param networkId ID of the connected network. + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @throws {BusinessError} 2501001 - Wifi is closed. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.MANAGE_WIFI_CONNECTION + * @systemapi Hide this for inner system use. + */ + function connectToNetwork(networkId: number): void; + + /** + * Connects to Wi-Fi network. + * + * @param config Indicates the device configuration for connection to the Wi-Fi network. + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @throws {BusinessError} 2501001 - Wifi is closed. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.SET_WIFI_CONFIG and + * ohos.permission.MANAGE_WIFI_CONNECTION + * @systemapi Hide this for inner system use. + */ + function connectToDevice(config: WifiDeviceConfig): void; + + /** + * Disconnects Wi-Fi network. + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION + * @systemapi Hide this for inner system use. + */ + function disconnect(): boolean; + + /** + * Calculates the Wi-Fi signal level based on the Wi-Fi RSSI and frequency band. + * + * @param rssi Indicates the Wi-Fi RSSI. + * @band Indicates the Wi-Fi frequency band. + * @return Returns Wi-Fi signal level ranging from 0 to 4. + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @throws {BusinessError} 2501001 - Wifi is closed. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.GET_WIFI_INFO + */ + function getSignalLevel(rssi: number, band: number): number; + + /** + * Obtains information about a Wi-Fi connection. + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @throws {BusinessError} 2501001 - Wifi is closed. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.GET_WIFI_INFO + */ + function getLinkedInfo(): Promise; + function getLinkedInfo(callback: AsyncCallback): void; + + /** + * Checks whether a Wi-Fi connection has been set up. + * + * @return Returns {@code true} if a Wi-Fi connection has been set up, returns {@code false} otherwise. + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.GET_WIFI_INFO + */ + function isConnected(): boolean; + + /** + * Obtains the features supported by this device. + * + *

          To check whether this device supports a specified feature. + * + * @return Returns the features supported by this device. + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2401000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.Core + * @permission ohos.permission.GET_WIFI_INFO + * @systemapi Hide this for inner system use. + */ + function getSupportedFeatures(): number; + + /** + * Checks whether this device supports a specified feature. + * + * @param featureId Indicates the ID of the feature. + * @return Returns {@code true} if this device supports the specified feature, returns {@code false} otherwise. + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2401000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.Core + * @permission ohos.permission.GET_WIFI_INFO + */ + function isFeatureSupported(featureId: number): boolean; + + /** + * Obtains the MAC address of a Wi-Fi device. Wi-Fi must be enabled. + * + *

          The MAC address is unique and cannot be changed. + * + * @return Returns the MAC address of the Wi-Fi device. + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.GET_WIFI_LOCAL_MAC and ohos.permission.GET_WIFI_INFO + * @systemapi Hide this for inner system use. + */ + function getDeviceMacAddress(): string[]; + + /** + * Obtains the IP information of a Wi-Fi connection. + * + *

          The IP information includes the host IP address, gateway address, and DNS information. + * + * @return Returns the IP information of the Wi-Fi connection. + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.GET_WIFI_INFO + */ + function getIpInfo(): IpInfo; + + /** + * Obtains the country code of this device. + * + * @return Returns the country code of this device. + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2401000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.Core + * @permission ohos.permission.GET_WIFI_INFO + */ + function getCountryCode(): string; + + /** + * Re-associates to current network. + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @throws {BusinessError} 2501001 - Wifi is closed. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION + * @systemapi Hide this for inner system use. + */ + function reassociate(): void; + + /** + * Re-connects to current network. + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @throws {BusinessError} 2501001 - Wifi is closed. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION + * @systemapi Hide this for inner system use. + */ + function reconnect(): void; + + /** + * Obtains the list of all existing Wi-Fi configurations. + * + *

          You can obtain only the Wi-Fi configurations you created on your own application. + * + * @return Returns the list of all existing Wi-Fi configurations you created on your application. + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.GET_WIFI_CONFIG + * @systemapi Hide this for inner system use. + */ + function getDeviceConfigs(): Array; + + /** + * Updates the specified Wi-Fi configuration. + * + * @param config Indicates the Wi-Fi configuration to update. + * + * @return Returns the network ID in the updated Wi-Fi configuration if the update is successful; + * returns {@code -1} if the specified Wi-Fi configuration is not contained in the list. + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.SET_WIFI_CONFIG + * @systemapi Hide this for inner system use. + */ + function updateNetwork(config: WifiDeviceConfig): number; + + /** + * Disables a specified network. + * + *

          The disabled network will not be associated with again. + * + * @param netId Identifies the network to disable. + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION + * @systemapi Hide this for inner system use. + */ + function disableNetwork(netId: number): void; + + /** + * Removes all the saved Wi-Fi configurations. + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION + * @systemapi Hide this for inner system use. + */ + function removeAllNetwork(): void; + + /** + * Deletes a Wi-Fi network with a specified ID. + * + *

          After a Wi-Fi network is deleted, its configuration will be deleted from the list of Wi-Fi configurations. + * If the Wi-Fi network is being connected, the connection will be interrupted. + * The application can only delete Wi-Fi networks it has created. + * + * @param id Indicates the ID of the Wi-Fi network, + * which can be obtained using the {@link #addDeviceConfig} or {@link #getLinkedInfo} method. + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION + * @systemapi Hide this for inner system use. + */ + function removeDevice(id: number): void; + + /** + * Enables a Wi-Fi hotspot. + * + *

          This method is asynchronous. After the Wi-Fi hotspot is enabled, Wi-Fi may be disabled. + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2601000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.AP.Core + * @permission ohos.permission.MANAGE_WIFI_HOTSPOT + * @systemapi Hide this for inner system use. + */ + function enableHotspot(): void; + + /** + * Disables a Wi-Fi hotspot. + * + *

          This method is asynchronous. If Wi-Fi is enabled after the Wi-Fi hotspot is disabled, Wi-Fi may be re-enabled. + * + * @return Returns {@code true} if this method is called successfully, returns {@code false} otherwise. + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2601000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.AP.Core + * @permission ohos.permission.MANAGE_WIFI_HOTSPOT + * @systemapi Hide this for inner system use. + */ + function disableHotspot(): void; + + /** + * Checks whether a device serving as a Wi-Fi hotspot supports both the 2.4 GHz and 5 GHz Wi-Fi. + * + * @return Returns {@code true} if the method is called successfully, returns {@code false} otherwise. + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2601000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.AP.Core + * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.MANAGE_WIFI_HOTSPOT + * @systemapi Hide this for inner system use. + */ + function isHotspotDualBandSupported(): boolean; + + /** + * Checks whether Wi-Fi hotspot is active on a device. + * + * @return Returns {@code true} if Wi-Fi hotspot is enabled, returns {@code false} otherwise. + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2601000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.AP.Core + * @permission ohos.permission.GET_WIFI_INFO + * @systemapi Hide this for inner system use. + */ + function isHotspotActive(): boolean; + + /** + * Sets the hotspot for a device. + * + *

          Only OPEN and WPA2 PSK hotspots can be configured. + * + * @param config Indicates the Wi-Fi hotspot configuration. + * The SSID and {@code securityType} must be available and correct. + * If {@code securityType} is not {@code open}, {@code preSharedKey} must be available and correct. + * @return Returns {@code true} if the method is called successfully, returns {@code false} otherwise. + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2601000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.AP.Core + * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.GET_WIFI_CONFIG + * @systemapi Hide this for inner system use. + */ + function setHotspotConfig(config: HotspotConfig): void; + + /** + * Obtains the Wi-Fi hotspot configuration. + * + * @return Returns the configuration of an existing or enabled Wi-Fi hotspot. + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2601000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.AP.Core + * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.GET_WIFI_CONFIG + * @systemapi Hide this for inner system use. + */ + function getHotspotConfig(): HotspotConfig; + + /** + * Obtains the list of clients that are connected to a Wi-Fi hotspot. + * + *

          This method can only be used on a device that serves as a Wi-Fi hotspot. + * + * @return Returns the list of clients that are connected to the Wi-Fi hotspot. + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2601000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.AP.Core + * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION and ohos.permission.MANAGE_WIFI_HOTSPOT + * @systemapi Hide this for inner system use. + */ + function getStations(): Array; + + /** + * Obtains information about a P2P connection. + * + * @return Returns the P2P connection information. + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2801000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.P2P + * @permission ohos.permission.GET_WIFI_INFO + */ + function getP2pLinkedInfo(): Promise; + function getP2pLinkedInfo(callback: AsyncCallback): void; + + /** + * Obtains information about the current group. + * + * @return Returns the current group information. + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2801000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.P2P + * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION + */ + function getCurrentGroup(): Promise; + function getCurrentGroup(callback: AsyncCallback): void; + + /** + * Obtains the information about the found devices. + * + * @return Returns the found devices list. + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2801000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.P2P + * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION + */ + function getP2pPeerDevices(): Promise; + function getP2pPeerDevices(callback: AsyncCallback): void; + + /** + * Obtains the information about own device info. + * + *

          deviceAddress in the returned WifiP2pDevice will be set "00:00:00:00:00:00", + * if ohos.permission.GET_WIFI_LOCAL_MAC is not granted. + * + * @return Returns the information about own device info. + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2801000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.P2P + * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.GET_WIFI_CONFIG + */ + function getP2pLocalDevice(): Promise; + function getP2pLocalDevice(callback: AsyncCallback): void; + + /** + * Creates a P2P group. + * + * @param config Indicates the configuration for creating a group. + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2801000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.P2P + * @permission ohos.permission.GET_WIFI_INFO + */ + function createGroup(config: WifiP2PConfig): void; + + /** + * Removes a P2P group. + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2801000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.P2P + * @permission ohos.permission.GET_WIFI_INFO + */ + function removeGroup(): void; + + /** + * Initiates a P2P connection to a device with the specified configuration. + * + * @param config Indicates the configuration for connecting to a specific group. + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2801000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.P2P + * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION + */ + function p2pConnect(config: WifiP2PConfig): void; + + /** + * Disconnects a P2P connection. + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2801000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.P2P + * @permission ohos.permission.GET_WIFI_INFO + */ + function p2pDisconnect(): void; + + /** + * Discovers Wi-Fi P2P devices. + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2801000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.P2P + * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION + */ + function startDiscoverDevices(): void; + + /** + * Stops discovering Wi-Fi P2P devices. + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2801000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.P2P + * @permission ohos.permission.GET_WIFI_INFO + */ + function stopDiscoverDevices(): void; + + /** + * Deletes the persistent P2P group with the specified network ID. + * + * @param netId Indicates the network ID of the group to be deleted. + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2801000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.P2P + * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION + * @systemapi Hide this for inner system use. + */ + function deletePersistentGroup(netId: number): void; + + /** + * Obtains information about the groups. + * + * @return Returns the groups information. + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2801000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.P2P + * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION + * @systemapi Hide this for inner system use. + */ + function getP2pGroups(): Promise>; + function getP2pGroups(callback: AsyncCallback>): void; + + /** + * Sets the name of the Wi-Fi P2P device. + * + * @param devName Indicates the name to be set. + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2801000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.P2P + * @permission ohos.permission.SET_WIFI_INFO and ohos.permission.MANAGE_WIFI_CONNECTION + * @systemapi Hide this for inner system use. + */ + function setDeviceName(devName: string): void; + + /** + * Subscribe Wi-Fi status change events. + * + * @return Returns 0: inactive, 1: active, 2: activating, 3: deactivating + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.GET_WIFI_INFO + */ + function on(type: "wifiStateChange", callback: Callback): void; + + /** + * Unsubscribe Wi-Fi status change events. + * + *

          All callback functions will be deregistered If there is no specific callback parameter.

          + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.GET_WIFI_INFO + */ + function off(type: "wifiStateChange", callback?: Callback): void; + + /** + * Subscribe Wi-Fi connection change events. + * + * @return Returns 0: disconnected, 1: connected + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.GET_WIFI_INFO + */ + function on(type: "wifiConnectionChange", callback: Callback): void; + + /** + * Unsubscribe Wi-Fi connection change events. + * + *

          All callback functions will be deregistered If there is no specific callback parameter.

          + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.GET_WIFI_INFO + */ + function off(type: "wifiConnectionChange", callback?: Callback): void; + + /** + * Subscribe Wi-Fi scan status change events. + * + * @return Returns 0: scan fail, 1: scan success + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.GET_WIFI_INFO + */ + function on(type: "wifiScanStateChange", callback: Callback): void; + + /** + * Unsubscribe Wi-Fi scan status change events. + * + *

          All callback functions will be deregistered If there is no specific callback parameter.

          + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.GET_WIFI_INFO + */ + function off(type: "wifiScanStateChange", callback?: Callback): void; + + /** + * Subscribe Wi-Fi rssi change events. + * + * @return Returns RSSI value in dBm + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.GET_WIFI_INFO + */ + function on(type: "wifiRssiChange", callback: Callback): void; + + /** + * Unsubscribe Wi-Fi rssi change events. + * + *

          All callback functions will be deregistered If there is no specific callback parameter.

          + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.GET_WIFI_INFO + */ + function off(type: "wifiRssiChange", callback?: Callback): void; + + /** + * Subscribe Wi-Fi stream change events. + * + * @return Returns 0: stream none, 1: stream down, 2: stream up, 3: stream bidirectional + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.MANAGE_WIFI_CONNECTION + * @systemapi Hide this for inner system use. + */ + function on(type: "streamChange", callback: Callback): void; + + /** + * Unsubscribe Wi-Fi stream change events. + * + *

          All callback functions will be deregistered If there is no specific callback parameter.

          + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.MANAGE_WIFI_CONNECTION + * @systemapi Hide this for inner system use. + */ + function off(type: "streamChange", callback?: Callback): void; + + /** + * Subscribe Wi-Fi device config change events. + * + * @return Returns 0: config is added, 1: config is changed, 2: config is removed. + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.GET_WIFI_INFO + * @systemapi Hide this for inner system use. + */ + function on(type: "deviceConfigChange", callback: Callback): void; + + /** + * Subscribe Wi-Fi device config change events. + * + * @return Returns 0: config is added, 1: config is changed, 2: config is removed. + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2501000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.STA + * @permission ohos.permission.GET_WIFI_INFO + * @systemapi Hide this for inner system use. + */ + function off(type: "deviceConfigChange", callback?: Callback): void; + + /** + * Subscribe Wi-Fi hotspot state change events. + * + * @return Returns 0: inactive, 1: active, 2: activating, 3: deactivating + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2601000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.AP.Core + * @permission ohos.permission.GET_WIFI_INFO + */ + function on(type: "hotspotStateChange", callback: Callback): void; + + /** + * Unsubscribe Wi-Fi hotspot state change events. + * + *

          All callback functions will be deregistered If there is no specific callback parameter.

          + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2601000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.AP.Core + * @permission ohos.permission.GET_WIFI_INFO + */ + function off(type: "hotspotStateChange", callback?: Callback): void; + + /** + * Subscribe Wi-Fi hotspot sta join events. + * + * @return Returns StationInfo + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2601000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.AP.Core + * @permission ohos.permission.MANAGE_WIFI_HOTSPOT + * @systemapi Hide this for inner system use. + */ + function on(type: "hotspotStaJoin", callback: Callback): void; + + /** + * Unsubscribe Wi-Fi hotspot sta join events. + * + *

          All callback functions will be deregistered If there is no specific callback parameter.

          + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2601000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.AP.Core + * @permission ohos.permission.MANAGE_WIFI_HOTSPOT + * @systemapi Hide this for inner system use. + */ + function off(type: "hotspotStaJoin", callback?: Callback): void; + + /** + * Subscribe Wi-Fi hotspot sta leave events. + * + * @return Returns {@link #StationInfo} object + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2601000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.AP.Core + * @permission ohos.permission.MANAGE_WIFI_HOTSPOT + * @systemapi Hide this for inner system use. + */ + function on(type: "hotspotStaLeave", callback: Callback): void; + + /** + * Unsubscribe Wi-Fi hotspot sta leave events. + * + * @return Returns {@link #StationInfo} object + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 202 - System API is not allowed called by third HAP. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2601000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.AP.Core + * @permission ohos.permission.MANAGE_WIFI_HOTSPOT + * @systemapi Hide this for inner system use. + */ + function off(type: "hotspotStaLeave", callback?: Callback): void; + + /** + * Subscribe P2P status change events. + * + * @return Returns 1: idle, 2: starting, 3:started, 4: closing, 5: closed + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2801000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.P2P + * @permission ohos.permission.GET_WIFI_INFO + */ + function on(type: "p2pStateChange", callback: Callback): void; + + /** + * Unsubscribe P2P status change events. + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2801000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.P2P + * @permission ohos.permission.GET_WIFI_INFO + */ + function off(type: "p2pStateChange", callback?: Callback): void; + + /** + * Subscribe P2P connection change events. + * + * @return Returns WifiP2pLinkedInfo + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2801000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.P2P + * @permission ohos.permission.GET_WIFI_INFO + */ + function on(type: "p2pConnectionChange", callback: Callback): void; + + /** + * Unsubscribe P2P connection change events. + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2801000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.P2P + * @permission ohos.permission.GET_WIFI_INFO + */ + function off(type: "p2pConnectionChange", callback?: Callback): void; + + /** + * Subscribe P2P local device change events. + * + * @return Returns WifiP2pDevice + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2801000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.P2P + * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION + */ + function on(type: "p2pDeviceChange", callback: Callback): void; + + /** + * Unsubscribe P2P local device change events. + * + * @return Returns WifiP2pDevice + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2801000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.P2P + * @permission ohos.permission.LOCATION + */ + function off(type: "p2pDeviceChange", callback?: Callback): void; + + /** + * Subscribe P2P peer device change events. + * + * @return Returns WifiP2pDevice[] + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2801000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.P2P + * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION + */ + function on(type: "p2pPeerDeviceChange", callback: Callback): void; + + /** + * Unsubscribe P2P peer device change events. + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2801000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.P2P + * @permission ohos.permission.LOCATION + */ + function off(type: "p2pPeerDeviceChange", callback?: Callback): void; + + /** + * Subscribe P2P persistent group change events. + * + * @return Returns void + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2801000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.P2P + * @permission ohos.permission.GET_WIFI_INFO + */ + function on(type: "p2pPersistentGroupChange", callback: Callback): void; + + /** + * Unsubscribe P2P persistent group change events. + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2801000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.P2P + * @permission ohos.permission.GET_WIFI_INFO + */ + function off(type: "p2pPersistentGroupChange", callback?: Callback): void; + + /** + * Subscribe P2P discovery events. + * + * @return Returns 0: initial state, 1: discovery succeeded + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2801000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.P2P + * @permission ohos.permission.GET_WIFI_INFO + */ + function on(type: "p2pDiscoveryChange", callback: Callback): void; + + /** + * Unsubscribe P2P discovery events. + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 401 - Invalid parameters. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2801000 - Operation failed. + * @syscap SystemCapability.Communication.WiFi.P2P + * @permission ohos.permission.GET_WIFI_INFO + */ + function off(type: "p2pDiscoveryChange", callback?: Callback): void; + + /** + * Wi-Fi EAP method. + * + * @since 9 + * @systemapi Hide this for inner system use. + * @syscap SystemCapability.Communication.WiFi.STA + */ + enum EapMethod { + EAP_NONE, + EAP_PEAP, + EAP_TLS, + EAP_TTLS, + EAP_PWD, + EAP_SIM, + EAP_AKA, + EAP_AKA_PRIME, + EAP_UNAUTH_TLS, + } + + /** + * Wi-Fi phase 2 method. + * + * @since 9 + * @systemapi Hide this for inner system use. + * @syscap SystemCapability.Communication.WiFi.STA + */ + enum Phase2Method { + PHASE2_NONE, + PHASE2_PAP, + PHASE2_MSCHAP, + PHASE2_MSCHAPV2, + PHASE2_GTC, + PHASE2_SIM, + PHASE2_AKA, + PHASE2_AKA_PRIME, + } + + /** + * Wi-Fi EAP config. + * + * @since 9 + * @systemapi Hide this for inner system use. + * @syscap SystemCapability.Communication.WiFi.STA + */ + interface WifiEapConfig { + /** EAP authentication method */ + eapMethod: EapMethod; + + /** Phase 2 authentication method */ + phase2Method: Phase2Method; + + /** The identity */ + identity: string; + + /** Anonymous identity */ + anonymousIdentity: string; + + /** Password */ + password: string; + + /** CA certificate alias */ + caCertAliases: string; + + /** CA certificate path */ + caPath: string; + + /** Client certificate alias */ + clientCertAliases: string; + + /** Alternate subject match */ + altSubjectMatch: string; + + /** Domain suffix match */ + domainSuffixMatch: string; + + /** Realm for Passpoint credential */ + realm: string; + + /** Public Land Mobile Network of the provider of Passpoint credential */ + plmn: string; + + /** Sub ID of the SIM card */ + eapSubId: number; + } + + /** + * Wi-Fi device configuration information. + * + * @since 9 + * @syscap SystemCapability.Communication.WiFi.STA + */ + interface WifiDeviceConfig { + /** Wi-Fi SSID: the maximum length is 32 */ + ssid: string; + + /** Wi-Fi bssid(MAC): the length is 6 */ + bssid: string; + + /** Wi-Fi key: maximum length is 64 */ + preSharedKey: string; + + /** Hide SSID or not, false(default): not hide */ + isHiddenSsid: boolean; + + /** Security type: reference definition of WifiSecurityType */ + securityType: WifiSecurityType; + + /** The UID of the Wi-Fi configuration creator */ + /* @systemapi */ + creatorUid: number; + + /** Disable reason */ + /* @systemapi */ + disableReason: number; + + /** Allocated networkId */ + /* @systemapi */ + netId: number; + + /** Random mac type */ + /* @systemapi */ + randomMacType: number; + + /** Random mac address, the length is 6 */ + /* @systemapi */ + randomMacAddr: string; + + /** IP Type */ + /* @systemapi */ + ipType: IpType; + + /** IP config of static */ + /* @systemapi */ + staticIp: IpConfig; + + /** + * EAP config info. + * @systemapi + */ + eapConfig: WifiEapConfig; + } + + /** + * Wi-Fi IP configuration information. + * + * @since 9 + * @systemapi Hide this for inner system use. + * @syscap SystemCapability.Communication.WiFi.STA + */ + interface IpConfig { + ipAddress: number; + gateway: number; + prefixLength: number; + dnsServers: number[]; + domains: Array; + } + + /** + * Wi-Fi information elements. + * + * @since 9 + * @syscap SystemCapability.Communication.WiFi.STA + */ + interface WifiInfoElem { + /** Element id */ + eid: number; + /** Element content */ + content: Uint8Array; + } + + /** + * Describes the wifi channel width. + * + * @since 9 + * @syscap SystemCapability.Communication.WiFi.STA + */ + enum WifiChannelWidth { + WIDTH_20MHZ = 0, + WIDTH_40MHZ = 1, + WIDTH_80MHZ = 2, + WIDTH_160MHZ = 3, + WIDTH_80MHZ_PLUS = 4, + WIDTH_INVALID + } + + /** + * Describes the scanned Wi-Fi information. + * + * @since 9 + * @syscap SystemCapability.Communication.WiFi.STA + */ + interface WifiScanInfo { + /** Wi-Fi SSID: the maximum length is 32 */ + ssid: string; + + /** Wi-Fi bssid(MAC): the length is 6 */ + bssid: string; + + /** Hotspot capability */ + capabilities: string; + + /** Security type: reference definition of WifiSecurityType */ + securityType: WifiSecurityType; + + /** Received signal strength indicator (RSSI) */ + rssi: number; + + /** Frequency band, 1: 2.4G, 2: 5G */ + band: number; + + /** Frequency */ + frequency: number; + + /** Channel width */ + channelWidth: number; + + /** + * Center frequency 0. + * + * @since 9 + * @syscap SystemCapability.Communication.WiFi.STA + */ + centerFrequency0: number; + + /** + * Center frequency 1. + * + * @since 9 + * @syscap SystemCapability.Communication.WiFi.STA + */ + centerFrequency1: number; + + /** + * Information elements. + * + * @since 9 + * @syscap SystemCapability.Communication.WiFi.STA + */ + infoElems: Array; + + /** Time stamp */ + timestamp: number; + } + + /** + * Describes the wifi security type. + * + * @since 9 + * @syscap SystemCapability.Communication.WiFi.Core + */ + enum WifiSecurityType { + /** Invalid security type */ + WIFI_SEC_TYPE_INVALID = 0, + + /** Open */ + WIFI_SEC_TYPE_OPEN = 1, + + /** Wired Equivalent Privacy (WEP) */ + WIFI_SEC_TYPE_WEP = 2, + + /** Pre-shared key (PSK) */ + WIFI_SEC_TYPE_PSK = 3, + + /** Simultaneous Authentication of Equals (SAE) */ + WIFI_SEC_TYPE_SAE = 4, + + /** + * EAP authentication. + * + * @since 9 + * @syscap SystemCapability.Communication.WiFi.Core + */ + WIFI_SEC_TYPE_EAP = 5, + + /** + * SUITE_B_192 192 bit level. + * + * @since 9 + * @syscap SystemCapability.Communication.WiFi.Core + */ + WIFI_SEC_TYPE_EAP_SUITE_B = 6, + + /** + * Opportunististic Wireless Encryption. + * + * @since 9 + * @syscap SystemCapability.Communication.WiFi.Core + */ + WIFI_SEC_TYPE_OWE = 7, + + /** + * WAPI certificate to be specified. + * + * @since 9 + * @syscap SystemCapability.Communication.WiFi.Core + */ + WIFI_SEC_TYPE_WAPI_CERT = 8, + + /** + * WAPI pre-shared key to be specified. + * + * @since 9 + * @syscap SystemCapability.Communication.WiFi.Core + */ + WIFI_SEC_TYPE_WAPI_PSK = 9, + } + + /** + * Wi-Fi connection information. + * + * @since 9 + * @syscap SystemCapability.Communication.WiFi.STA + */ + interface WifiLinkedInfo { + /** The SSID of the Wi-Fi hotspot */ + ssid: string; + + /** The BSSID of the Wi-Fi hotspot */ + bssid: string; + + /** The ID(uniquely identifies) of a Wi-Fi connection. */ + /* @systemapi */ + networkId: number; + + /** The RSSI(dBm) of a Wi-Fi access point. */ + rssi: number; + + /** The frequency band of a Wi-Fi access point. */ + band: number; + + /** The speed of a Wi-Fi access point. */ + linkSpeed: number; + + /** The frequency of a Wi-Fi access point. */ + frequency: number; + + /** Whether the SSID of the access point (AP) of this Wi-Fi connection is hidden. */ + isHidden: boolean; + + /** Whether this Wi-Fi connection restricts the data volume. */ + isRestricted: boolean; + + /** The load value of this Wi-Fi connection. A greater value indicates a higher load. */ + /* @systemapi */ + chload: number; + + /** The signal-to-noise ratio (SNR) of this Wi-Fi connection. */ + /* @systemapi */ + snr: number; + + /** + * Type of macAddress: 0 - real mac, 1 - random mac. + * + * @since 9 + * @syscap SystemCapability.Communication.WiFi.STA + */ + macType: number; + + /** The Wi-Fi MAC address of a device. */ + macAddress: string; + + /** The IP address of this Wi-Fi connection. */ + ipAddress: number; + + /** The state of the supplicant of this Wi-Fi connection. */ + /* @systemapi */ + suppState: SuppState; + + /** The state of this Wi-Fi connection. */ + connState: ConnState; + } + + /** + * Wi-Fi IP information. + * + * @since 9 + * @syscap SystemCapability.Communication.WiFi.STA + */ + interface IpInfo { + /** The IP address of the Wi-Fi connection */ + ipAddress: number; + + /** The gateway of the Wi-Fi connection */ + gateway: number; + + /** The network mask of the Wi-Fi connection */ + netmask: number; + + /** The primary DNS server IP address of the Wi-Fi connection */ + primaryDns: number; + + /** The secondary DNS server IP address of the Wi-Fi connection */ + secondDns: number; + + /** The DHCP server IP address of the Wi-Fi connection */ + serverIp: number; + + /** The IP address lease duration of the Wi-Fi connection */ + leaseDuration: number; + } + + /** + * Wi-Fi hotspot configuration information. + * + * @since 9 + * @systemapi Hide this for inner system use. + * @syscap SystemCapability.Communication.WiFi.AP.Core + */ + interface HotspotConfig { + /** The SSID of the Wi-Fi hotspot */ + ssid: string; + + /** The encryption mode of the Wi-Fi hotspot */ + securityType: WifiSecurityType; + + /** The frequency band of the Wi-Fi hotspot */ + band: number; + + /** The password of the Wi-Fi hotspot */ + preSharedKey: string; + + /** The maximum number of connections allowed by the Wi-Fi hotspot */ + maxConn: number; + } + + /** + * Wi-Fi station information. + * + * @since 9 + * @systemapi Hide this for inner system use. + * @syscap SystemCapability.Communication.WiFi.AP.Core + */ + interface StationInfo { + /** the network name of the Wi-Fi client */ + name: string; + + /** The MAC address of the Wi-Fi client */ + macAddress: string; + + /** The IP address of the Wi-Fi client */ + ipAddress: string; + } + + /** + * Wi-Fi IP type enumeration. + * + * @since 9 + * @systemapi Hide this for inner system use. + * @syscap SystemCapability.Communication.WiFi.STA + */ + enum IpType { + /** Use statically configured IP settings */ + STATIC, + + /** Use dynamically configured IP settings */ + DHCP, + + /** No IP details are assigned */ + UNKNOWN, + } + + /** + * The state of the supplicant enumeration. + * + * @since 9 + * @systemapi Hide this for inner system use. + * @syscap SystemCapability.Communication.WiFi.STA + */ + export enum SuppState { + /** The supplicant is not associated with or is disconnected from the AP. */ + DISCONNECTED, + + /** The network interface is disabled. */ + INTERFACE_DISABLED, + + /** The supplicant is disabled. */ + INACTIVE, + + /** The supplicant is scanning for a Wi-Fi connection. */ + SCANNING, + + /** The supplicant is authenticating with a specified AP. */ + AUTHENTICATING, + + /** The supplicant is associating with a specified AP. */ + ASSOCIATING, + + /** The supplicant is associated with a specified AP. */ + ASSOCIATED, + + /** The four-way handshake is ongoing. */ + FOUR_WAY_HANDSHAKE, + + /** The group handshake is ongoing. */ + GROUP_HANDSHAKE, + + /** All authentication is completed. */ + COMPLETED, + + /** Failed to establish a connection to the supplicant. */ + UNINITIALIZED, + + /** The supplicant is in an unknown or invalid state. */ + INVALID + } + + /** + * The state of Wi-Fi connection enumeration. + * + * @since 9 + * @syscap SystemCapability.Communication.WiFi.STA + */ + export enum ConnState { + /** The device is searching for an available AP. */ + SCANNING, + + /** The Wi-Fi connection is being set up. */ + CONNECTING, + + /** The Wi-Fi connection is being authenticated. */ + AUTHENTICATING, + + /** The IP address of the Wi-Fi connection is being obtained. */ + OBTAINING_IPADDR, + + /** The Wi-Fi connection has been set up. */ + CONNECTED, + + /** The Wi-Fi connection is being torn down. */ + DISCONNECTING, + + /** The Wi-Fi connection has been torn down. */ + DISCONNECTED, + + /** Failed to set up the Wi-Fi connection. */ + UNKNOWN + } + + /** + * P2P device information. + * + * @since 9 + * @syscap SystemCapability.Communication.WiFi.P2P + */ + interface WifiP2pDevice { + /** Device name */ + deviceName: string; + + /** Device mac address */ + deviceAddress: string; + + /** Primary device type */ + primaryDeviceType: string; + + /** Device status */ + deviceStatus: P2pDeviceStatus; + + /** Device group capabilities */ + groupCapabilities: number; + } + + /** + * P2P config. + * + * @since 9 + * @syscap SystemCapability.Communication.WiFi.P2P + */ + interface WifiP2PConfig { + /** Device mac address */ + deviceAddress: string; + + /** + * Group network ID. When creating a group, -1 indicates creates a temporary group, + * -2: indicates creates a persistent group + */ + netId: number; + + /* The passphrase of this {@code WifiP2pConfig} instance */ + passphrase: string; + + /** Group name */ + groupName: string; + + /** Group owner band */ + goBand: GroupOwnerBand; + } + + /** + * P2P group information. + * + * @since 9 + * @syscap SystemCapability.Communication.WiFi.P2P + */ + interface WifiP2pGroupInfo { + /** Indicates whether it is group owner */ + isP2pGo: boolean; + + /** Group owner information */ + ownerInfo: WifiP2pDevice; + + /** The group passphrase */ + passphrase: string; + + /** Interface name */ + interface: string; + + /** Group name */ + groupName: string; + + /** Network ID */ + networkId: number; + + /** Frequency */ + frequency: number; + + /** Client list */ + clientDevices: WifiP2pDevice[]; + + /** Group owner IP address */ + goIpAddress: string; + } + + /** + * P2P connection status. + * + * @since 9 + * @syscap SystemCapability.Communication.WiFi.P2P + */ + enum P2pConnectState { + DISCONNECTED = 0, + CONNECTED = 1, + } + + /** + * P2P linked information. + * + * @since 9 + * @syscap SystemCapability.Communication.WiFi.P2P + */ + interface WifiP2pLinkedInfo { + /** Connection status */ + connectState: P2pConnectState; + + /** Indicates whether it is group owner */ + isGroupOwner: boolean; + + /** Group owner address */ + groupOwnerAddr: string; + } + + /** + * P2P device status. + * + * @since 9 + * @syscap SystemCapability.Communication.WiFi.P2P + */ + enum P2pDeviceStatus { + CONNECTED = 0, + INVITED = 1, + FAILED = 2, + AVAILABLE = 3, + UNAVAILABLE = 4, + } + + /** + * P2P group owner band. + * + * @since 9 + * @syscap SystemCapability.Communication.WiFi.P2P + */ + enum GroupOwnerBand { + GO_BAND_AUTO = 0, + GO_BAND_2GHZ = 1, + GO_BAND_5GHZ = 2, + } +} + +export default wifiManager; diff --git a/api/@ohos.wifiManagerExt.d.ts b/api/@ohos.wifiManagerExt.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cc4f43a272340497af40c0f8669d1eead28a4cab --- /dev/null +++ b/api/@ohos.wifiManagerExt.d.ts @@ -0,0 +1,113 @@ +/* + * 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, Callback } from './basic'; + +/** + * Provides extended methods to operate or manage Wi-Fi. + * + *

          The APIs involved in this file are non-general APIs. + * These extended APIs are only used by some product types, such as routers. + * Common products should not use these APIs.

          + * + * @since 9 + * @import import wifiManagerExt from '@ohos.wifiManagerExt'; + */ +declare namespace wifiManagerExt { + /** + * Enables a Wi-Fi hotspot. + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2701000 - Operation failed. + * @permission ohos.permission.MANAGE_WIFI_HOTSPOT_EXT + * @syscap SystemCapability.Communication.WiFi.AP.Extension + */ + function enableHotspot(): void; + + /** + * Disables a Wi-Fi hotspot. + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2701000 - Operation failed. + * @permission ohos.permission.MANAGE_WIFI_HOTSPOT_EXT + * @syscap SystemCapability.Communication.WiFi.AP.Extension + */ + function disableHotspot(): void; + + /** + * Obtains the supported power Mode. + * + * @return Returns the array of supported power Mode. + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2701000 - Operation failed. + * @permission ohos.permission.GET_WIFI_INFO + * @syscap SystemCapability.Communication.WiFi.AP.Extension + */ + function getSupportedPowerMode(): Promise>; + function getSupportedPowerMode(callback: AsyncCallback>): void; + + /** + * Obtains the current Wi-Fi power mode. + * + * @return Returns the current Wi-Fi power mode. If a value less than zero is returned, it indicates a failure. + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2701000 - Operation failed. + * @permission ohos.permission.GET_WIFI_INFO + * @syscap SystemCapability.Communication.WiFi.AP.Extension + */ + function getPowerMode (): Promise; + function getPowerMode (callback: AsyncCallback): void; + + /** + * Set the current Wi-Fi power mode. + * + * @since 9 + * @throws {BusinessError} 201 - Permission denied. + * @throws {BusinessError} 801 - Capability not supported. + * @throws {BusinessError} 2701000 - Operation failed. + * @permission ohos.permission.MANAGE_WIFI_HOTSPOT_EXT + * @syscap SystemCapability.Communication.WiFi.AP.Extension + */ + function setPowerMode(mode: PowerMode) : void + + /** + * The power Mode enumeration. + * + * @since 9 + * @syscap SystemCapability.Communication.WiFi.AP.Extension + */ + export enum PowerMode { + /** Sleeping Mode. */ + SLEEPING = 0, + + /** General Mode. */ + GENERAL = 1, + + /** Through wall Mode. */ + THROUGH_WALL = 2, + } +} + +export default wifiManagerExt; diff --git a/api/@ohos.wifiext.d.ts b/api/@ohos.wifiext.d.ts index c881d0a13205b7a00ad5d80cd7806731309a4680..1b6f7296dfff3445e34d21b577a4875f3abc0a13 100644 --- a/api/@ohos.wifiext.d.ts +++ b/api/@ohos.wifiext.d.ts @@ -33,6 +33,8 @@ declare namespace wifiext { * @since 8 * @permission ohos.permission.MANAGE_WIFI_HOTSPOT_EXT * @syscap SystemCapability.Communication.WiFi.AP.Extension + * @deprecated since 9 + * @useinstead ohos.wifiManagerExt/wifiManagerExt.enableHotspot */ function enableHotspot(): boolean; @@ -43,6 +45,8 @@ declare namespace wifiext { * @since 8 * @permission ohos.permission.MANAGE_WIFI_HOTSPOT_EXT * @syscap SystemCapability.Communication.WiFi.AP.Extension + * @deprecated since 9 + * @useinstead ohos.wifiManagerExt/wifiManagerExt.disableHotspot */ function disableHotspot(): boolean; @@ -54,6 +58,8 @@ declare namespace wifiext { * @since 8 * @permission ohos.permission.GET_WIFI_INFO * @syscap SystemCapability.Communication.WiFi.AP.Extension + * @deprecated since 9 + * @useinstead ohos.wifiManagerExt/wifiManagerExt.getSupportedPowerMode */ function getSupportedPowerModel(): Promise>; function getSupportedPowerModel(callback: AsyncCallback>): void; @@ -66,6 +72,8 @@ declare namespace wifiext { * @since 8 * @permission ohos.permission.GET_WIFI_INFO * @syscap SystemCapability.Communication.WiFi.AP.Extension + * @deprecated since 9 + * @useinstead ohos.wifiManagerExt/wifiManagerExt.getPowerMode */ function getPowerModel (): Promise; function getPowerModel (callback: AsyncCallback): void; @@ -78,6 +86,8 @@ declare namespace wifiext { * @since 8 * @permission ohos.permission.MANAGE_WIFI_HOTSPOT_EXT * @syscap SystemCapability.Communication.WiFi.AP.Extension + * @deprecated since 9 + * @useinstead ohos.wifiManagerExt/wifiManagerExt.setPowerMode */ function setPowerModel(model: PowerModel) : boolean @@ -86,6 +96,8 @@ declare namespace wifiext { * * @since 8 * @syscap SystemCapability.Communication.WiFi.AP.Extension + * @deprecated since 9 + * @useinstead ohos.wifiManagerExt/wifiManagerExt.PowerMode */ export enum PowerModel { /** Sleeping model. */ diff --git a/api/@ohos.window.d.ts b/api/@ohos.window.d.ts index 1ea88ecd65c6f26a84031a10392aec2815f08535..09bc2a175039f2e400a9e6416fdb5c25f79707ad 100644 --- a/api/@ohos.window.d.ts +++ b/api/@ohos.window.d.ts @@ -615,7 +615,7 @@ declare namespace window { /** * Indicates Parent window id */ - parentId?: string + parentId?: number } /** @@ -627,7 +627,7 @@ declare namespace window { * @throws {BusinessError} 1300001 - If window has created * @throws {BusinessError} 1300006 - If window context is abnormally */ - function createWindow({ name, windowType, ctx, displayId, parentId = "" }: Configuration, callback: AsyncCallback): void; + function createWindow(config: Configuration, callback: AsyncCallback): void; /** * Create a window with a specific configuration @@ -638,7 +638,7 @@ declare namespace window { * @throws {BusinessError} 1300001 - If window has created * @throws {BusinessError} 1300006 - If window context is abnormally */ - function createWindow({ name, windowType, ctx, displayId, parentId = "" }: Configuration): Promise; + function createWindow(config: Configuration): Promise; /** * Create a sub window with a specific id and type, only support 7. @@ -1920,7 +1920,7 @@ declare namespace window { * @throws {BusinessError} 201 - If there is no permission * @throws {BusinessError} 401 - If param is invalid * @throws {BusinessError} 1300002 - If window state is abnormally - * @permission ohos.permission.PRIVACE_WINDOW + * @permission ohos.permission.PRIVACY_WINDOW * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 9 */ @@ -1932,7 +1932,7 @@ declare namespace window { * @throws {BusinessError} 201 - If there is no permission * @throws {BusinessError} 401 - If param is invalid * @throws {BusinessError} 1300002 - If window state is abnormally - * @permission ohos.permission.PRIVACE_WINDOW + * @permission ohos.permission.PRIVACY_WINDOW * @syscap SystemCapability.WindowManager.WindowManager.Core * @since 9 */ @@ -2148,10 +2148,10 @@ declare namespace window { * @StageModelOnly */ enum WindowStageEventType { - FOREGROUND = 1, + SHOWN = 1, ACTIVE, INACTIVE, - BACKGROUND, + HIDDEN, } /** * WindowStage diff --git a/api/@ohos.worker.d.ts b/api/@ohos.worker.d.ts index fffe7241f19c8401af8ed3339aae376fb07a5bbf..40570f2fd26991c2b886bc56937a45850958cb46 100644 --- a/api/@ohos.worker.d.ts +++ b/api/@ohos.worker.d.ts @@ -67,7 +67,7 @@ export interface Event { * @since 7 * @syscap SystemCapability.Utils.Lang */ - export interface ErrorEvent extends Event { +export interface ErrorEvent extends Event { /** * Information about the exception. * @since 7 @@ -109,7 +109,7 @@ export interface Event { * @since 7 * @syscap SystemCapability.Utils.Lang */ - export interface MessageEvent extends Event { +export interface MessageEvent extends Event { /** * Data transferred when an exception occurs. * @since 7 @@ -118,6 +118,20 @@ export interface Event { readonly data: T; } +/** + * Saves the data transferred between worker thread and host thread. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + export interface MessageEvents extends Event { + /** + * Data transferred when an exception occurs. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + readonly data; +} + /** * Specifies the object whose ownership need to be transferred during data transfer. * The object must be ArrayBuffer. @@ -134,8 +148,10 @@ export interface PostMessageOptions { } /** - * Implements evemt listening. + * Implements event listening. * @since 7 + * @deprecated since 9 + * @useinstead ohos.worker.WorkerEventListener * @syscap SystemCapability.Utils.Lang */ export interface EventListener { @@ -143,11 +159,31 @@ export interface EventListener { * Specifies the callback to invoke. * @param evt Event class for the callback to invoke. * @since 7 + * @deprecated since 9 + * @useinstead ohos.worker.WorkerEventListener.(event: Event): void | Promise * @syscap SystemCapability.Utils.Lang */ (evt: Event): void | Promise; } +/** + * Implements event listening. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + export interface WorkerEventListener { + /** + * Specifies the callback function to be invoked. + * @param event Event class for the callback to invoke. + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200004 - Worker instance is not running. + * @throws {BusinessError} 10200005 - The invoked API is not supported in workers. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + (event: Event): void | Promise; +} + /** * Type of message, only "message" and "messageerror". * @since 7 @@ -158,14 +194,18 @@ type MessageType = "message" | "messageerror"; /** * Specific event features. * @since 7 + * @deprecated since 9 + * @useinstead ohos.worker.WorkerEventTarget * @syscap SystemCapability.Utils.Lang */ - export interface EventTarget { +export interface EventTarget { /** * Adds an event listener to the worker. * @param type Type of the event to listen for. * @param listener Callback to invoke when an event of the specified type occurs. * @since 7 + * @deprecated since 9 + * @useinstead ohos.worker.WorkerEventTarget.addEventListener * @syscap SystemCapability.Utils.Lang */ addEventListener( @@ -177,6 +217,8 @@ type MessageType = "message" | "messageerror"; * Dispatches the event defined for the worker. * @param event Event to dispatch. * @since 7 + * @deprecated since 9 + * @useinstead ohos.worker.WorkerEventTarget.dispatchEvent * @syscap SystemCapability.Utils.Lang */ dispatchEvent(event: Event): boolean; @@ -186,6 +228,8 @@ type MessageType = "message" | "messageerror"; * @param type Type of the event for which the event listener is removed. * @param callback Callback of the event listener to remove. * @since 7 + * @deprecated since 9 + * @useinstead ohos.worker.WorkerEventTarget.removeEventListener * @syscap SystemCapability.Utils.Lang */ removeEventListener( @@ -196,6 +240,53 @@ type MessageType = "message" | "messageerror"; /** * Removes all event listeners for the worker. * @since 7 + * @deprecated since 9 + * @useinstead ohos.worker.WorkerEventTarget.removeAllListener + * @syscap SystemCapability.Utils.Lang + */ + removeAllListener(): void; +} + +/** + * Specific worker event features. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ +export interface WorkerEventTarget { + /** + * Adds an event listener to the worker. + * @param type Type of the event to listen for. + * @param listener Callback to invoke when an event of the specified type occurs. + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200004 - Worker instance is not running. + * @throws {BusinessError} 10200005 - The invoked API is not supported in workers. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + addEventListener(type: string, listener: WorkerEventListener): void; + /** + * Handle the event defined for the worker. + * @param event Event to dispatch. + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200004 - Worker instance is not running. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + dispatchEvent(event: Event): boolean; + /** + * Remove an event defined for the worker. + * @param type Type of the event for which the event listener is cancelled. + * @param callback Callback of the event listener to remove. + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200004 - Worker instance is not running. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + removeEventListener(type: string, callback?: WorkerEventListener): void; + /** + * Remove all event listeners for the worker. + * @throws {BusinessError} 10200004 - Worker instance is not running. + * @since 9 * @syscap SystemCapability.Utils.Lang */ removeAllListener(): void; @@ -204,12 +295,16 @@ type MessageType = "message" | "messageerror"; /** * Specifies the worker thread running environment, which is isolated from the host thread environment. * @since 7 + * @deprecated since 9 + * @useinstead ohos.worker.GlobalScope * @syscap SystemCapability.Utils.Lang */ declare interface WorkerGlobalScope extends EventTarget { /** * Worker name specified when there is a new worker. * @since 7 + * @deprecated since 9 + * @useinstead ohos.worker.GlobalScope.name * @syscap SystemCapability.Utils.Lang */ readonly name: string; @@ -220,18 +315,53 @@ declare interface WorkerGlobalScope extends EventTarget { * The event handler is executed in the worker thread. * @param ev Error data. * @since 7 + * @deprecated since 9 + * @useinstead ohos.worker.GlobalScope.onerror * @syscap SystemCapability.Utils.Lang */ onerror?: (ev: ErrorEvent) => void; readonly self: WorkerGlobalScope & typeof globalThis; } +/** + * The environment Specified in which worker threads run, which is isolated from the host thread environment. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + declare interface GlobalScope extends WorkerEventTarget { + /** + * Name of Worker specified when there is a new worker. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + readonly name: string; + + /** + * The onerror attribute of parentPort specified. + * the event handler to be called when an exception occurs during worker execution. + * The event handler is executed in the worker thread. + * @param ev Error data. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + onerror?: (ev: ErrorEvent) => void; + /** + * Specify the type attribute for self. + * @param self type is read-only. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + readonly self: GlobalScope & typeof globalThis; +} + /** * Specifies the worker thread running environment, which is isolated from the host thread environment * @since 7 + * @deprecated since 9 + * @useinstead ohos.worker.ThreadWorkerGlobalScope * @syscap SystemCapability.Utils.Lang */ - export interface DedicatedWorkerGlobalScope extends WorkerGlobalScope { +export interface DedicatedWorkerGlobalScope extends WorkerGlobalScope { /** * The onmessage attribute of parentPort specifies the event handler * to be called then the worker thread receives a message sent by @@ -239,6 +369,8 @@ declare interface WorkerGlobalScope extends EventTarget { * The event handler is executed in the worker thread. * @param ev Message received. * @since 7 + * @deprecated since 9 + * @useinstead ohos.worker.ThreadWorkerGlobalScope.onmessage * @syscap SystemCapability.Utils.Lang */ onmessage?: (this: DedicatedWorkerGlobalScope, ev: MessageEvent) => void; @@ -249,6 +381,8 @@ declare interface WorkerGlobalScope extends EventTarget { * The event handler is executed in the worker thread. * @param ev Error data. * @since 7 + * @deprecated since 9 + * @useinstead ohos.worker.ThreadWorkerGlobalScope.onmessageerror * @syscap SystemCapability.Utils.Lang */ onmessageerror?: (this: DedicatedWorkerGlobalScope, ev: MessageEvent) => void; @@ -256,6 +390,8 @@ declare interface WorkerGlobalScope extends EventTarget { /** * Close the worker thread to stop the worker from receiving messages * @since 7 + * @deprecated since 9 + * @useinstead ohos.worker.ThreadWorkerGlobalScope.close * @syscap SystemCapability.Utils.Lang */ close(): void; @@ -266,6 +402,7 @@ declare interface WorkerGlobalScope extends EventTarget { * @param transfer array cannot contain null. * @since 7 * @deprecated since 9 + * @useinstead ohos.worker.ThreadWorkerGlobalScope.postMessage * @syscap SystemCapability.Utils.Lang */ postMessage(messageObject: Object, transfer: Transferable[]): void; @@ -281,18 +418,260 @@ declare interface WorkerGlobalScope extends EventTarget { postMessage(messageObject: Object, transfer: ArrayBuffer[]): void; } +/** + * Specifies the thread-worker running environment, which is isolated from the host-thread environment + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ +export interface ThreadWorkerGlobalScope extends GlobalScope { + /** + * The onmessage attribute of parentPort specifies the event handler + * to be called then the worker thread receives a message sent by + * the host thread through worker postMessage. + * The event handler is executed in the worker thread. + * @param ev Message received. + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200004 - Worker instance is not running. + * @throws {BusinessError} 10200005 - The invoked API is not supported in workers. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + onmessage?: (this: ThreadWorkerGlobalScope, ev: MessageEvents) => void; + + /** + * The onmessage attribute of parentPort specifies the event handler + * to be called then the worker receives a message that cannot be deserialized. + * The event handler is executed in the worker thread. + * @param ev Error data. + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200004 - Worker instance is not running. + * @throws {BusinessError} 10200005 - The invoked API is not supported in workers. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + onmessageerror?: (this: ThreadWorkerGlobalScope, ev: MessageEvents) => void; + + /** + * Close the worker thread to stop the worker from receiving messages + * @throws {BusinessError} 10200004 - Worker instance is not running. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + close(): void; + + /** + * Send a message to host thread from the worker + * @param messageObject Data to be sent to the worker + * @param transfer array cannot contain null. + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200004 - Worker instance is not running. + * @throws {BusinessError} 10200006 - Serializing an uncaught exception failed. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + postMessage(messageObject: Object, transfer: ArrayBuffer[]): void; + + /** + * Send a message to be host thread from the worker + * @param messageObject Data to be sent to the worker + * @param options Option can be set for postmessage. + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200004 - Worker instance is not running. + * @throws {BusinessError} 10200006 - Serializing an uncaught exception failed. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + postMessage(messageObject: Object, options?: PostMessageOptions): void; +} + /** * JS cross-thread communication tool * @since 7 * @syscap SystemCapability.Utils.Lang */ declare namespace worker { + /** + * The ThreadWorker class contains all Worker functions. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + class ThreadWorker implements WorkerEventTarget { + /** + * Creates a worker instance + * @param scriptURL URL of the script to be executed by the worker + * @param options Options that can be set for the worker + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200003 - Worker initialization failure. + * @throws {BusinessError} 10200007 - The worker file patch is invalid path. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + constructor(scriptURL: string, options?: WorkerOptions); + /** + * The onexit attribute of the worker specifies the event handler to be called + * when the worker exits. The handler is executed in the host thread. + * @param code Code indicating the worker exit state + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200004 - Worker instance is not running. + * @throws {BusinessError} 10200005 - The invoked API is not supported in workers. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + onexit?: (code: number) => void; + /** + * The onerror attribute of the worker specifies the event handler to be called + * when an exception occurs during worker execution. + * The event handler is executed in the host thread. + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200004 - Worker instance is not running. + * @throws {BusinessError} 10200005 - The invoked API is not supported in workers. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + onerror?: (err: ErrorEvent) => void; + /** + * The onmessage attribute of the worker specifies the event handler + * to be called then the host thread receives a message created by itself + * and sent by the worker through the parentPort.postMessage. + * The event handler is executed in the host thread. + * @param event Message received. + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200004 - Worker instance is not running. + * @throws {BusinessError} 10200005 - The invoked API is not supported in workers. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + onmessage?: (event: MessageEvents) => void; + /** + * The onmessage attribute of the worker specifies the event handler + * when the worker receives a message that cannot be serialized. + * The event handler is executed in the host thread. + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200004 - Worker instance is not running. + * @throws {BusinessError} 10200005 - The invoked API is not supported in workers. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + onmessageerror?: (event: MessageEvents) => void; + /** + * Sends a message to the worker thread. + * The data is transferred using the structured clone algorithm. + * @param message Data to be sent to the worker + * @param transfer ArrayBuffer instance that can be transferred. + * The transferList array cannot contain null. + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200004 - Worker instance is not running. + * @throws {BusinessError} 10200006 - Serializing an uncaught exception failed. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + postMessage(message: Object, transfer: ArrayBuffer[]): void; + /** + * Sends a message to the worker thread. + * The data is transferred using the structured clone algorithm. + * @param message Data to be sent to the worker + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200004 - Worker instance is not running. + * @throws {BusinessError} 10200006 - Serializing an uncaught exception failed. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + postMessage(message: Object, options?: PostMessageOptions): void; + /** + * Adds an event listener to the worker. + * @param type Adds an event listener to the worker. + * @param listener Callback to invoke when an event of the specified type occurs. + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200004 - Worker instance is not running. + * @throws {BusinessError} 10200005 - The invoked API is not supported in workers. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + on(type: string, listener: WorkerEventListener): void; + /** + * Adds an event listener to the worker + * and removes the event listener automatically after it is invoked once. + * @param type Type of the event to listen for + * @param listener Callback to invoke when an event of the specified type occurs + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200004 - Worker instance is not running. + * @throws {BusinessError} 10200005 - The invoked API is not supported in workers. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + once(type: string, listener: WorkerEventListener): void; + /** + * Removes an event listener to the worker. + * @param type Type of the event for which the event listener is removed. + * @param listener Callback of the event listener to remove. + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200004 - Worker instance is not running. + * @throws {BusinessError} 10200005 - The invoked API is not supported in workers. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + off(type: string, listener?: WorkerEventListener): void; + /** + * Terminates the worker thread to stop the worker from receiving messages + * @throws {BusinessError} 10200004 - Worker instance is not running. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + terminate(): void; + /** + * Adds an event listener to the worker. + * @param type Type of the event to listen for. + * @param listener Callback to invoke when an event of the specified type occurs. + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200004 - Worker instance is not running. + * @throws {BusinessError} 10200005 - The invoked API is not supported in workers. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + addEventListener(type: string, listener: WorkerEventListener): void; + /** + * Handle the event defined for the worker. + * @param event Event to dispatch. + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200004 - Worker instance is not running. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + dispatchEvent(event: Event): boolean; + /** + * Remove an event defined for the worker. + * @param type Type of the event for which the event listener is cancelled. + * @param callback Callback of the event listener to remove. + * @throws {BusinessError} 401 - if the input parameters are invalid. + * @throws {BusinessError} 10200004 - Worker instance is not running. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + removeEventListener(type: string, callback?: WorkerEventListener): void; + /** + * Remove all event listeners for the worker. + * @throws {BusinessError} 10200004 - Worker instance is not running. + * @since 9 + * @syscap SystemCapability.Utils.Lang + */ + removeAllListener(): void; + } + + /** + * The Worker class contains all Worker functions. + * @since 7 + * @deprecated since 9 + * @useinstead ohos.worker.ThreadWorker + * @syscap SystemCapability.Utils.Lang + */ class Worker implements EventTarget { /** * Creates a worker instance * @param scriptURL URL of the script to be executed by the worker * @param options Options that can be set for the worker * @since 7 + * @deprecated since 9 + * @useinstead ohos.worker.ThreadWorker.constructor * @syscap SystemCapability.Utils.Lang */ constructor(scriptURL: string, options?: WorkerOptions); @@ -302,6 +681,8 @@ declare namespace worker { * when the worker exits. The handler is executed in the host thread. * @param code Code indicating the worker exit state * @since 7 + * @deprecated since 9 + * @useinstead ohos.worker.ThreadWorker.onexit * @syscap SystemCapability.Utils.Lang */ onexit?: (code: number) => void; @@ -311,6 +692,8 @@ declare namespace worker { * when an exception occurs during worker execution. * The event handler is executed in the host thread. * @since 7 + * @deprecated since 9 + * @useinstead ohos.worker.ThreadWorker.onerror * @syscap SystemCapability.Utils.Lang */ onerror?: (err: ErrorEvent) => void; @@ -322,6 +705,8 @@ declare namespace worker { * The event handler is executed in the host thread. * @param event Message received. * @since 7 + * @deprecated since 9 + * @useinstead ohos.worker.ThreadWorker.onmessage * @syscap SystemCapability.Utils.Lang */ onmessage?: (event: MessageEvent) => void; @@ -331,6 +716,8 @@ declare namespace worker { * when the worker receives a message that cannot be serialized. * The event handler is executed in the host thread. * @since 7 + * @deprecated since 9 + * @useinstead ohos.worker.ThreadWorker.onmessageerror * @syscap SystemCapability.Utils.Lang */ onmessageerror?: (event: MessageEvent) => void; @@ -342,6 +729,8 @@ declare namespace worker { * @param transfer ArrayBuffer instance that can be transferred. * The transferList array cannot contain null. * @since 7 + * @deprecated since 9 + * @useinstead ohos.worker.ThreadWorker.postMessage * @syscap SystemCapability.Utils.Lang */ postMessage(message: Object, transfer: ArrayBuffer[]): void; @@ -352,6 +741,8 @@ declare namespace worker { * @param type Adds an event listener to the worker. * @param listener Callback to invoke when an event of the specified type occurs. * @since 7 + * @deprecated since 9 + * @useinstead ohos.worker.ThreadWorker.on * @syscap SystemCapability.Utils.Lang */ on(type: string, listener: EventListener): void; @@ -362,6 +753,8 @@ declare namespace worker { * @param type Type of the event to listen for * @param listener Callback to invoke when an event of the specified type occurs * @since 7 + * @deprecated since 9 + * @useinstead ohos.worker.ThreadWorker.once * @syscap SystemCapability.Utils.Lang */ once(type: string, listener: EventListener): void; @@ -371,6 +764,8 @@ declare namespace worker { * @param type Type of the event for which the event listener is removed. * @param listener Callback of the event listener to remove. * @since 7 + * @deprecated since 9 + * @useinstead ohos.worker.ThreadWorker.off * @syscap SystemCapability.Utils.Lang */ off(type: string, listener?: EventListener): void; @@ -378,11 +773,14 @@ declare namespace worker { /** * Terminates the worker thread to stop the worker from receiving messages * @since 7 + * @deprecated since 9 + * @useinstead ohos.worker.ThreadWorker.terminate * @syscap SystemCapability.Utils.Lang */ terminate(): void; } const parentPort: DedicatedWorkerGlobalScope; -} + const workerPort: ThreadWorkerGlobalScope; +} export default worker; \ No newline at end of file diff --git a/api/@ohos.xml.d.ts b/api/@ohos.xml.d.ts index 6aed19cbd95ee74dc1d6ded3c7b7db2718e9d4d5..3eb9f401b1dfdc1143f61628ebf073128b0b871c 100644 --- a/api/@ohos.xml.d.ts +++ b/api/@ohos.xml.d.ts @@ -21,13 +21,21 @@ * @permission N/A */ declare namespace xml { + + /** + * The XmlSerializer interface is used to generate an xml file. + * @name XmlSerializer + * @since 8 + * @syscap SystemCapability.Utils.Lang + */ class XmlSerializer { /** * A parameterized constructor used to create a new XmlSerializer instance. * As the input parameter of the constructor function, init supports three types. - * The input parameter is an Arrarybuff. + * The input parameter is an Arrarybuffer. * The input parameter is a DataView. * The input parameter is an encoding format of string type. + * @throws {BusinessError} 401 - if the input parameters are invalid. */ constructor(buffer: ArrayBuffer | DataView, encoding?: string); @@ -37,6 +45,7 @@ declare namespace xml { * @syscap SystemCapability.Utils.Lang * @param name Key name of the attribute. * @param value Values of attribute. + * @throws {BusinessError} 401 - if the input parameters are invalid. */ setAttributes(name: string, value: string): void; @@ -46,6 +55,7 @@ declare namespace xml { * @syscap SystemCapability.Utils.Lang * @param name Key name of the attribute. * @param value Values of element. + * @throws {BusinessError} 401 - The type of name must be string. */ addEmptyElement(name: string): void; @@ -57,10 +67,11 @@ declare namespace xml { setDeclaration(): void; /** - * Writes a elemnet start tag with the given name. + * Writes a element start tag with the given name. * @since 8 * @syscap SystemCapability.Utils.Lang - * @param name name of the element. + * @param name Name of the element. + * @throws {BusinessError} 401 - The type of name must be string. */ startElement(name: string): void; @@ -77,6 +88,7 @@ declare namespace xml { * @syscap SystemCapability.Utils.Lang * @param prefix Values name of the prefix. * @param namespace Values of namespace. + * @throws {BusinessError} 401 - if the input parameters are invalid. */ setNamespace(prefix: string, namespace: string): void; @@ -85,6 +97,7 @@ declare namespace xml { * @since 8 * @syscap SystemCapability.Utils.Lang * @param text Values of comment. + * @throws {BusinessError} 401 - The type of text must be string. */ setComment(text: string): void; @@ -93,6 +106,7 @@ declare namespace xml { * @since 8 * @syscap SystemCapability.Utils.Lang * @param text Values of CDATA. + * @throws {BusinessError} 401 - The type of text must be string. */ setCDATA(text: string): void; @@ -101,6 +115,7 @@ declare namespace xml { * @since 8 * @syscap SystemCapability.Utils.Lang * @param text Values of text. + * @throws {BusinessError} 401 - The type of text must be string. */ setText(text: string): void; @@ -109,6 +124,7 @@ declare namespace xml { * @since 8 * @syscap SystemCapability.Utils.Lang * @param text Values of docType. + * @throws {BusinessError} 401 - The type of text must be string. */ setDocType(text: string): void; } @@ -175,7 +191,7 @@ declare namespace xml { */ ENTITY_REFERENCE, /** - * a whitespace. + * A whitespace. * @since 8 * @syscap SystemCapability.Utils.Lang */ @@ -246,7 +262,7 @@ declare namespace xml { getAttributeCount(): number; } - /** parse options for XmlPullParser. */ + /** Parse options for XmlPullParser. */ interface ParseOptions { /** @@ -264,40 +280,47 @@ declare namespace xml { ignoreNameSpace?: boolean; /** - * tag value callback function. + * Tag value callback function. * @since 8 * @syscap SystemCapability.Utils.Lang * @param name The current tag name. * @param value The current tag value. - * @return Returns a Boolean variable for whether parse continually. + * @returns Returns a Boolean variable for whether parse continually. */ tagValueCallbackFunction?: (name: string, value: string) => boolean; /** - * attribute value callback function. + * Attribute value callback function. * @since 8 * @syscap SystemCapability.Utils.Lang * @param name The current attribute name. * @param value The current attribute value. - * @return Returns a Boolean variable for whether parse continually. + * @returns Returns a Boolean variable for whether parse continually. */ attributeValueCallbackFunction?: (name: string, value: string) => boolean; /** - * token value callback function. + * Token value callback function. * @since 8 * @syscap SystemCapability.Utils.Lang * @param eventType The current token eventtype. * @param value The current token parseinfo. - * @return Returns a Boolean variable for whether parse continually. + * @returns Returns a Boolean variable for whether parse continually. */ tokenValueCallbackFunction?: (eventType: EventType, value: ParseInfo) => boolean; } + /** + * The XmlPullParser interface is used to parse the existing xml file. + * @name XmlPullParser + * @since 8 + * @syscap SystemCapability.Utils.Lang + */ class XmlPullParser { /** - * A constructor used to create a new XmlPullParser instance. - */ + * A constructor used to create a new XmlPullParser instance. + * @throws {BusinessError} 401 - if the input parameters are invalid. + */ constructor(buffer: ArrayBuffer | DataView, encoding?: string); /** @@ -305,6 +328,7 @@ declare namespace xml { * @since 8 * @syscap SystemCapability.Utils.Lang * @param option parse options for XmlPullParser, the interface including two Boolean variables and three callback functions. + * @throws {BusinessError} 401 - The type of option must be ParseOptions. */ parse(option: ParseOptions): void; } diff --git a/api/@ohos.zlib.d.ts b/api/@ohos.zlib.d.ts index 6aca560c79aca9195f9a13e8529717f638344aa2..68ac169d3c6633794287852f12179eed1334e530 100644 --- a/api/@ohos.zlib.d.ts +++ b/api/@ohos.zlib.d.ts @@ -20,8 +20,6 @@ declare namespace zlib { * @name ErrorCode * @since 7 * @syscap SystemCapability.BundleManager.Zlib - * @import NA - * @permission NA * @deprecated since 9 */ export enum ErrorCode { @@ -33,8 +31,6 @@ declare namespace zlib { * @name CompressLevel * @since 7 * @syscap SystemCapability.BundleManager.Zlib - * @import NA - * @permission NA */ export enum CompressLevel { COMPRESS_LEVEL_NO_COMPRESSION = 0, @@ -47,8 +43,6 @@ declare namespace zlib { * @name CompressStrategy * @since 7 * @syscap SystemCapability.BundleManager.Zlib - * @import NA - * @permission NA */ export enum CompressStrategy { COMPRESS_STRATEGY_DEFAULT_STRATEGY = 0, @@ -62,8 +56,6 @@ declare namespace zlib { * @name MemLevel * @since 7 * @syscap SystemCapability.BundleManager.Zlib - * @import NA - * @permission NA */ export enum MemLevel { MEM_LEVEL_MIN = 1, @@ -75,8 +67,6 @@ declare namespace zlib { * @name Options * @since 7 * @syscap SystemCapability.BundleManager.Zlib - * @import NA - * @permission NA */ interface Options { level?: CompressLevel; @@ -91,7 +81,7 @@ declare namespace zlib { * @syscap SystemCapability.BundleManager.Zlib * @param inFile Indicates the path of the file to be compressed. * @param outFile Indicates the path of the output compressed file. - * @return Returns error code. + * @returns Returns error code. * @deprecated since 9 * @useinstead ohos.zlib#compressFile */ @@ -104,7 +94,7 @@ declare namespace zlib { * @syscap SystemCapability.BundleManager.Zlib * @param inFile Indicates the path of the file to be decompressed. * @param outFile Indicates the path of the decompressed file. - * @return Returns error code. + * @returns Returns error code. * @deprecated since 9 * @useinstead ohos.zlib#decompressFile */ diff --git a/api/@system.battery.d.ts b/api/@system.battery.d.ts index 9aee8309bf61ee9c26b8e9a743cc3b1a3bd9a745..246a61658bf6dd9a4496f56d90a7863e4501fef0 100755 --- a/api/@system.battery.d.ts +++ b/api/@system.battery.d.ts @@ -16,20 +16,20 @@ /** * @syscap SystemCapability.PowerManager.BatteryManager.Core * @since 3 - * @deprecated since 9 + * @deprecated since 6 */ export interface BatteryResponse { /** * Whether the battery is being charged. * @since 3 - * @deprecated since 9 + * @deprecated since 6 */ charging: boolean; /** * Current battery level, which ranges from 0.00 to 1.00. * @since 3 - * @deprecated since 9 + * @deprecated since 6 */ level: number; } @@ -37,27 +37,27 @@ /** * @syscap SystemCapability.PowerManager.BatteryManager.Core * @since 3 - * @deprecated since 9 + * @deprecated since 6 */ export interface GetStatusOptions { /** * Called when the current charging state and battery level are obtained. * @since 3 - * @deprecated since 9 + * @deprecated since 6 */ success?: (data: BatteryResponse) => void; /** * Called when the current charging state and battery level fail to be obtained. * @since 3 - * @deprecated since 9 + * @deprecated since 6 */ fail?: (data: string, code: number) => void; /** * Called when the execution is completed. * @since 3 - * @deprecated since 9 + * @deprecated since 6 */ complete?: () => void; } @@ -65,14 +65,14 @@ export interface GetStatusOptions { /** * @syscap SystemCapability.PowerManager.BatteryManager.Core * @since 3 - * @deprecated since 9 + * @deprecated since 6 */ export default class Battery { /** * Obtains the current charging state and battery level. * @param options Options. * @since 3 - * @deprecated since 9 + * @deprecated since 6 */ static getStatus(options?: GetStatusOptions): void; } \ No newline at end of file diff --git a/api/@system.brightness.d.ts b/api/@system.brightness.d.ts index d5c656768d75df400570881bef66a68bb22bcda8..055ed06fc5910d829c51789f61a0461d8c6c60b1 100755 --- a/api/@system.brightness.d.ts +++ b/api/@system.brightness.d.ts @@ -16,13 +16,13 @@ /** * @syscap SystemCapability.PowerManager.DisplayPowerManager * @since 3 - * @deprecated since 9 + * @deprecated since 7 */ export interface BrightnessResponse { /** - * Screen brightness, which ranges from 1 to 100. + * Screen brightness, which ranges from 1 to 255. * @since 3 - * @deprecated since 9 + * @deprecated since 7 */ value: number; } @@ -30,27 +30,27 @@ export interface BrightnessResponse { /** * @syscap SystemCapability.PowerManager.DisplayPowerManager * @since 3 - * @deprecated since 9 + * @deprecated since 7 */ export interface GetBrightnessOptions { /** * Called when the current screen brightness is obtained. * @since 3 - * @deprecated since 9 + * @deprecated since 7 */ success?: (data: BrightnessResponse) => void; /** * Called when the current screen brightness fails to be obtained. * @since 3 - * @deprecated since 9 + * @deprecated since 7 */ fail?: (data: string, code: number) => void; /** * Called when the execution is completed. * @since 3 - * @deprecated since 9 + * @deprecated since 7 */ complete?: () => void; } @@ -58,38 +58,38 @@ export interface GetBrightnessOptions { /** * @syscap SystemCapability.PowerManager.DisplayPowerManager * @since 3 - * @deprecated since 9 + * @deprecated since 7 */ export interface SetBrightnessOptions { /** - * Screen brightness. The value is an integer ranging from 1 to 100. + * Screen brightness. The value is an integer ranging from 1 to 255. * If the value is less than or equal to 0, value 1 will be used. - * If the value is greater than 100, value 100 will be used. + * If the value is greater than 255, value 255 will be used. * If the value contains decimals, the integral part of the value will be used. * For example, if value is 8.1 is set, value 8 will be used. * @since 3 - * @deprecated since 9 + * @deprecated since 7 */ value: number; /** * Called when the setting is successful. * @since 3 - * @deprecated since 9 + * @deprecated since 7 */ success?: () => void; /** * Called when the setting fails. * @since 3 - * @deprecated since 9 + * @deprecated since 7 */ fail?: (data: string, code: number) => void; /** * Called when the execution is completed. * @since 3 - * @deprecated since 9 + * @deprecated since 7 */ complete?: () => void } @@ -97,7 +97,7 @@ export interface SetBrightnessOptions { /** * @syscap SystemCapability.PowerManager.DisplayPowerManager * @since 3 - * @deprecated since 9 + * @deprecated since 7 */ export interface BrightnessModeResponse { /** @@ -105,7 +105,7 @@ export interface BrightnessModeResponse { * 0: The screen brightness is manually adjusted. * 1: The screen brightness is automatically adjusted. * @since 3 - * @deprecated since 9 + * @deprecated since 7 */ mode: number; } @@ -113,27 +113,27 @@ export interface BrightnessModeResponse { /** * @syscap SystemCapability.PowerManager.DisplayPowerManager * @since 3 - * @deprecated since 9 + * @deprecated since 7 */ export interface GetBrightnessModeOptions { /** * Called when the screen brightness adjustment mode is obtained. * @since 3 - * @deprecated since 9 + * @deprecated since 7 */ success?: (data: BrightnessModeResponse) => void; /** * Called when the screen brightness adjustment mode fails to be obtained. * @since 3 - * @deprecated since 9 + * @deprecated since 7 */ fail?: (data: string, code: number) => void; /** * Called when the execution is completed. * @since 3 - * @deprecated since 9 + * @deprecated since 7 */ complete?: () => void; } @@ -141,7 +141,7 @@ export interface GetBrightnessModeOptions { /** * @syscap SystemCapability.PowerManager.DisplayPowerManager * @since 3 - * @deprecated since 9 + * @deprecated since 7 */ export interface SetBrightnessModeOptions { /** @@ -149,28 +149,28 @@ export interface SetBrightnessModeOptions { * 0: The screen brightness is manually adjusted. * 1: The screen brightness is automatically adjusted. * @since 3 - * @deprecated since 9 + * @deprecated since 7 */ mode: number; /** * Called when the setting is successful. * @since 3 - * @deprecated since 9 + * @deprecated since 7 */ success?: () => void; /** * Called when the setting fails. * @since 3 - * @deprecated since 9 + * @deprecated since 7 */ fail?: (data: string, code: number) => void; /** * Called when the execution is completed. * @since 3 - * @deprecated since 9 + * @deprecated since 7 */ complete?: () => void } @@ -178,34 +178,34 @@ export interface SetBrightnessModeOptions { /** * @syscap SystemCapability.PowerManager.DisplayPowerManager * @since 3 - * @deprecated since 9 + * @deprecated since 7 */ export interface SetKeepScreenOnOptions { /** * Whether to always keep the screen on. * @since 3 - * @deprecated since 9 + * @deprecated since 7 */ keepScreenOn: boolean; /** * Called when the setting is successful. * @since 3 - * @deprecated since 9 + * @deprecated since 7 */ success?: () => void; /** * Called when the setting fails. * @since 3 - * @deprecated since 9 + * @deprecated since 7 */ fail?: (data: string, code: number) => void; /** * Called when the execution is completed. * @since 3 - * @deprecated since 9 + * @deprecated since 7 */ complete?: () => void } @@ -213,14 +213,14 @@ export interface SetKeepScreenOnOptions { /** * @syscap SystemCapability.PowerManager.DisplayPowerManager * @since 3 - * @deprecated since 9 + * @deprecated since 7 */ export default class Brightness { /** * Obtains the current screen brightness. * @param options Options. * @since 3 - * @deprecated since 9 + * @deprecated since 7 */ static getValue(options?: GetBrightnessOptions): void; @@ -228,7 +228,7 @@ export default class Brightness { * Sets the screen brightness. * @param options Options. * @since 3 - * @deprecated since 9 + * @deprecated since 7 */ static setValue(options?: SetBrightnessOptions): void; @@ -236,7 +236,7 @@ export default class Brightness { * Obtains the screen brightness adjustment mode. * @param options Options. * @since 3 - * @deprecated since 9 + * @deprecated since 7 */ static getMode(options?: GetBrightnessModeOptions): void; @@ -244,15 +244,15 @@ export default class Brightness { * Sets the screen brightness adjustment mode. * @param options Options. * @since 3 - * @deprecated since 9 + * @deprecated since 7 */ static setMode(options?: SetBrightnessModeOptions): void; /** - * Sets whether to always keey the screen on. + * Sets whether to always keep the screen on. * @param options Options. * @since 3 - * @deprecated since 9 + * @deprecated since 7 */ static setKeepScreenOn(options?: SetKeepScreenOnOptions): void; } \ No newline at end of file diff --git a/api/@system.fetch.d.ts b/api/@system.fetch.d.ts index b36c780dbd99339081b90d156948b85406c0920c..f728c65db9765dbaef05393584baf6eb1d26e99c 100644 --- a/api/@system.fetch.d.ts +++ b/api/@system.fetch.d.ts @@ -14,7 +14,6 @@ */ /** - * @import import fetch from '@system.fetch'; * @since 3 * @syscap SystemCapability.Communication.NetStack */ @@ -39,7 +38,6 @@ export interface FetchResponse { } /** - * @import import fetch from '@system.fetch'; * @since 3 * @syscap SystemCapability.Communication.NetStack */ diff --git a/api/@system.geolocation.d.ts b/api/@system.geolocation.d.ts index d47a68ef7e6c9c020cf354ac7e49648b2f173244..c6a47550eefc53fee9198cbdd1884b8cc5582e10 100644 --- a/api/@system.geolocation.d.ts +++ b/api/@system.geolocation.d.ts @@ -15,6 +15,8 @@ /** * @syscap SystemCapability.Location.Location.Lite + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.Location */ export interface GeolocationResponse { /** @@ -51,6 +53,8 @@ export interface GeolocationResponse { /** * @syscap SystemCapability.Location.Location.Lite * @permission ohos.permission.LOCATION + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.CurrentLocationRequest */ export interface GetLocationOption { /** @@ -92,6 +96,7 @@ export interface GetLocationOption { /** * @syscap SystemCapability.Location.Location.Lite + * @deprecated since 9 */ export interface GetLocationTypeResponse { /** @@ -102,6 +107,7 @@ export interface GetLocationTypeResponse { /** * @syscap SystemCapability.Location.Location.Lite + * @deprecated since 9 */ export interface GetLocationTypeOption { /** @@ -126,6 +132,8 @@ export interface GetLocationTypeOption { /** * @syscap SystemCapability.Location.Location.Lite * @permission ohos.permission.LOCATION + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.LocationRequest */ export interface SubscribeLocationOption { /** @@ -150,18 +158,23 @@ export interface SubscribeLocationOption { /** * @syscap SystemCapability.Location.Location.Lite + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager */ export default class Geolocation { /** * Obtains the geographic location. * @permission ohos.permission.LOCATION * @param options Options. + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.getCurrentLocation */ static getLocation(options?: GetLocationOption): void; /** * Obtains the location types supported by the system. * @param options Options. + * @deprecated since 9 */ static getLocationType(options?: GetLocationTypeOption): void; @@ -169,18 +182,23 @@ export default class Geolocation { * Listens to the geographical location. If this method is called multiple times, the last call takes effect. * @permission ohos.permission.LOCATION * @param options Options. + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.on#event:locationChange */ static subscribe(options: SubscribeLocationOption): void; /** * Cancels listening to the geographical location. * @permission ohos.permission.LOCATION + * @deprecated since 9 + * @useinstead ohos.geoLocationManager/geoLocationManager.off#event:locationChange */ static unsubscribe(): void; /** * Obtains the supported coordinate system types. * @returns A string array of the supported coordinate system types, for example, ['wgs84']. + * @deprecated since 9 */ static getSupportedCoordTypes(): Array; } diff --git a/api/@system.mediaquery.d.ts b/api/@system.mediaquery.d.ts index 445cd2d1ee6c646ceddebbbd3c82b0d937fc9f46..e0b58acc47a61ed2cc558ef50d125023ff4d4aca 100644 --- a/api/@system.mediaquery.d.ts +++ b/api/@system.mediaquery.d.ts @@ -73,7 +73,7 @@ export interface MediaQueryList { } /** - * Defines the mediaqurey interface. + * Defines the mediaquery interface. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 3 */ diff --git a/api/@system.network.d.ts b/api/@system.network.d.ts index 977bcd3414c0135317a20a7c5db1aeeb8ef3a0d2..c4ca8227931ee9a77e9ef853b85195194f577a27 100644 --- a/api/@system.network.d.ts +++ b/api/@system.network.d.ts @@ -14,7 +14,6 @@ */ /** - * @import import network from '@system.network'; * @since 3 * @syscap SystemCapability.Communication.NetManager.Core */ @@ -33,7 +32,6 @@ export interface NetworkResponse { } /** - * @import import network from '@system.network'; * @since 3 * @syscap SystemCapability.Communication.NetManager.Core */ diff --git a/api/@system.package.d.ts b/api/@system.package.d.ts index 7a667d63cc945dcedf9a9d11311e6145ae4daaca..130b0a3979ff2c74e660bc476f435421482b80fa 100644 --- a/api/@system.package.d.ts +++ b/api/@system.package.d.ts @@ -16,6 +16,7 @@ /** * @syscap SystemCapability.BundleManager.BundleFramework * @since 3 + * @deprecated since 9 */ export interface CheckPackageHasInstalledResponse { /** @@ -29,6 +30,7 @@ export interface CheckPackageHasInstalledResponse { /** * @syscap SystemCapability.BundleManager.BundleFramework * @since 3 + * @deprecated since 9 */ export interface CheckPackageHasInstalledOptions { /** @@ -53,7 +55,7 @@ export interface CheckPackageHasInstalledOptions { fail?: (data: any, code: number) => void; /** - * Called when the excution is completed. + * Called when the execution is completed. * @syscap SystemCapability.BundleManager.BundleFramework * @since 3 */ @@ -63,13 +65,14 @@ export interface CheckPackageHasInstalledOptions { /** * @syscap SystemCapability.BundleManager.BundleFramework * @since 3 - * @import package from '@system.package'; + * @deprecated since 9 */ export default class Package { /** - * Checks whethers an application exists, or whether a native application has been installed. + * Checks whether an application exists, or whether a native application has been installed. * @param options Options * @syscap SystemCapability.BundleManager.BundleFramework + * @deprecated since 9 */ static hasInstalled(options: CheckPackageHasInstalledOptions): void; } \ No newline at end of file diff --git a/api/@system.prompt.d.ts b/api/@system.prompt.d.ts index c2b4c100add4b46b9bd59fa90820312544045ea1..78025362a649a5f6113d53eff115c11cb0dd72c7 100644 --- a/api/@system.prompt.d.ts +++ b/api/@system.prompt.d.ts @@ -17,6 +17,8 @@ * Defines the options of ShowToast. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 3 + * @deprecated since 8 + * @useinstead ohos.prompt */ export interface ShowToastOptions { /** diff --git a/api/@system.router.d.ts b/api/@system.router.d.ts index 0867df975c4ec5ef7654ac8ddd35db46df7881be..83cc0547020c4273a8d6cf34ab734c72a1d600df 100644 --- a/api/@system.router.d.ts +++ b/api/@system.router.d.ts @@ -16,7 +16,8 @@ /** * Defines the option of router. * @syscap SystemCapability.ArkUI.ArkUI.Lite - * @deprecated since 8, please use @ohos.router instead. + * @deprecated since 8 + * @useinstead @ohos.router * @since 3 */ export interface RouterOptions { @@ -45,7 +46,8 @@ export interface RouterOptions { /** * Defines the option of router back. * @syscap SystemCapability.ArkUI.ArkUI.Full - * @deprecated since 8, please use @ohos.router instead. + * @deprecated since 8 + * @useinstead @ohos.router * @since 7 */ export interface BackRouterOptions { @@ -68,7 +70,8 @@ export interface BackRouterOptions { /** * Defines the state of router. * @syscap SystemCapability.ArkUI.ArkUI.Full - * @deprecated since 8, please use @ohos.router instead. + * @deprecated since 8 + * @useinstead @ohos.router * @since 3 */ export interface RouterState { @@ -98,7 +101,8 @@ export interface RouterState { /** * Defines the option of EnableAlertBeforeBackPage. * @syscap SystemCapability.ArkUI.ArkUI.Full - * @deprecated since 8, please use @ohos.router instead. + * @deprecated since 8 + * @useinstead @ohos.router * @since 6 */ export interface EnableAlertBeforeBackPageOptions { @@ -134,7 +138,8 @@ export interface EnableAlertBeforeBackPageOptions { /** * Defines the option of DisableAlertBeforeBackPage. * @syscap SystemCapability.ArkUI.ArkUI.Full - * @deprecated since 8, please use @ohos.router instead. + * @deprecated since 8 + * @useinstead @ohos.router * @since 6 */ export interface DisableAlertBeforeBackPageOptions { @@ -167,7 +172,8 @@ type ParamsInterface = { /** * Defines the Router interface. * @syscap SystemCapability.ArkUI.ArkUI.Lite - * @deprecated since 8, please use @ohos.router instead. + * @deprecated since 8 + * @useinstead @ohos.router * @since 3 */ export default class Router { diff --git a/api/@system.sensor.d.ts b/api/@system.sensor.d.ts index e5d7ecca4b7ecfa2bf648623cecc2da6814ab777..8ffdfe56241d9bfe71e0d00d3d481898c22919e5 100644 --- a/api/@system.sensor.d.ts +++ b/api/@system.sensor.d.ts @@ -15,10 +15,10 @@ /** * @syscap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; * @permission ohos.permission.ACCELEROMETER * @since 3 * @deprecated since 8 + * @useinstead ohos.sensor/sensor.AccelerometerResponse */ export interface AccelerometerResponse { /** @@ -42,10 +42,10 @@ export interface AccelerometerResponse { /** * @syscap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; * @permission ohos.permission.ACCELEROMETER * @since 3 * @deprecated since 8 + * @useinstead ohos.sensor/sensor#event:SensorId.ACCELEROMETER */ export interface subscribeAccelerometerOptions { /** @@ -74,9 +74,9 @@ export interface subscribeAccelerometerOptions { /** * @syscap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; * @since 3 * @deprecated since 8 + * @useinstead ohos.sensor/sensor.MagneticFieldResponse */ export interface CompassResponse { /** @@ -88,9 +88,9 @@ export interface CompassResponse { /** * @syscap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; * @since 3 * @deprecated since 8 + * @useinstead ohos.sensor/sensor#event:SensorId.MAGNETIC_FIELD */ export interface SubscribeCompassOptions { /** @@ -108,9 +108,9 @@ export interface SubscribeCompassOptions { /** * @syscap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; * @since 3 * @deprecated since 8 + * @useinstead ohos.sensor/sensor.ProximityResponse */ export interface ProximityResponse { /** @@ -122,9 +122,9 @@ export interface ProximityResponse { /** * @syscap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; * @since 3 * @deprecated since 8 + * @useinstead ohos.sensor/sensor#event:SensorId.PROXIMITY */ export interface SubscribeProximityOptions { /** @@ -142,9 +142,9 @@ export interface SubscribeProximityOptions { /** * @syscap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; * @since 3 * @deprecated since 8 + * @useinstead ohos.sensor/sensor.LightResponse */ export interface LightResponse { /** @@ -156,9 +156,9 @@ export interface LightResponse { /** * @syscap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; * @since 3 * @deprecated since 8 + * @useinstead ohos.sensor/sensor#event:SensorId.AMBIENT_LIGHT */ export interface SubscribeLightOptions { /** @@ -176,10 +176,10 @@ export interface SubscribeLightOptions { /** * @syscap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; * @permission ohos.permission.ACTIVITY_MOTION * @since 3 * @deprecated since 8 + * @useinstead ohos.sensor/sensor.PedometerResponse */ export interface StepCounterResponse { /** @@ -192,10 +192,10 @@ export interface StepCounterResponse { /** * @syscap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; * @permission ohos.permission.ACTIVITY_MOTION * @since 3 * @deprecated since 8 + * @useinstead ohos.sensor/sensor#event:SensorId.PEDOMETER */ export interface SubscribeStepCounterOptions { /** @@ -213,9 +213,9 @@ export interface SubscribeStepCounterOptions { /** * @syscap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; * @since 3 * @deprecated since 8 + * @useinstead ohos.sensor/sensor.BarometerResponse */ export interface BarometerResponse { /** @@ -227,9 +227,9 @@ export interface BarometerResponse { /** * @syscap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; * @since 3 * @deprecated since 8 + * @useinstead ohos.sensor/sensor#event:SensorId.BAROMETER */ export interface SubscribeBarometerOptions { /** @@ -247,10 +247,10 @@ export interface SubscribeBarometerOptions { /** * @syscap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; * @permission ohos.permission.READ_HEALTH_DATA * @since 3 * @deprecated since 8 + * @useinstead ohos.sensor/sensor.HeartRateResponse */ export interface HeartRateResponse { /** @@ -263,10 +263,10 @@ export interface HeartRateResponse { /** * @syscap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; * @permission ohos.permission.READ_HEALTH_DATA * @since 3 * @deprecated since 8 + * @useinstead ohos.sensor/sensor#event:SensorId.HEART_RATE */ export interface SubscribeHeartRateOptions { /** @@ -284,9 +284,9 @@ export interface SubscribeHeartRateOptions { /** * @syscap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; * @since 3 * @deprecated since 8 + * @useinstead ohos.sensor/sensor.WearDetectionResponse */ export interface OnBodyStateResponse { /** @@ -298,9 +298,9 @@ export interface OnBodyStateResponse { /** * @syscap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; * @since 3 * @deprecated since 8 + * @useinstead ohos.sensor/sensor#event:SensorId.WEAR_DETECTION */ export interface SubscribeOnBodyStateOptions { /** @@ -318,9 +318,9 @@ export interface SubscribeOnBodyStateOptions { /** * @syscap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; * @since 3 * @deprecated since 8 + * @useinstead ohos.sensor/sensor#event:SensorId.WEAR_DETECTION */ export interface GetOnBodyStateOptions { /** @@ -344,9 +344,9 @@ export interface GetOnBodyStateOptions { /** * @syscap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; * @since 6 * @deprecated since 8 + * @useinstead ohos.sensor/sensor.OrientationResponse */ export interface DeviceOrientationResponse { /** @@ -370,9 +370,9 @@ export interface DeviceOrientationResponse { /** * @syscap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; * @since 6 * @deprecated since 8 + * @useinstead ohos.sensor/sensor#event:SensorId.ORIENTATION */ export interface SubscribeDeviceOrientationOptions { /** @@ -401,10 +401,10 @@ export interface SubscribeDeviceOrientationOptions { /** * @syscap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; * @permission ohos.permission.GYROSCOPE * @since 6 * @deprecated since 8 + * @useinstead ohos.sensor/sensor#.GyroscopeResponse */ export interface GyroscopeResponse { /** @@ -428,10 +428,10 @@ export interface GyroscopeResponse { /** * @syscap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; * @permission ohos.permission.GYROSCOPE * @since 6 * @deprecated since 8 + * @useinstead ohos.sensor/sensor#event:SensorId.GYROSCOPE */ export interface SubscribeGyroscopeOptions { /** @@ -460,9 +460,9 @@ export interface SubscribeGyroscopeOptions { /** * @syscap SystemCapability.Sensors.Sensor - * @import import sensor from '@system.sensor'; * @since 6 * @deprecated since 8 + * @useinstead ohos.sensor/sensor */ export default class Sensor { /** @@ -473,6 +473,7 @@ export default class Sensor { * @permission ohos.permission.ACCELEROMETER * @since 3 * @deprecated since 8 + * @useinstead ohos.sensor/sensor#event:SensorId.ACCELEROMETER */ static subscribeAccelerometer(options: subscribeAccelerometerOptions): void; @@ -482,6 +483,7 @@ export default class Sensor { * @permission ohos.permission.ACCELEROMETER * @since 3 * @deprecated since 8 + * @useinstead ohos.sensor/sensor#event:SensorId.ACCELEROMETER */ static unsubscribeAccelerometer(): void; @@ -492,6 +494,7 @@ export default class Sensor { * @syscap SystemCapability.Sensors.Sensor * @since 3 * @deprecated since 8 + * @useinstead ohos.sensor/sensor#event:SensorId.MAGNETIC_FIELD */ static subscribeCompass(options: SubscribeCompassOptions): void; @@ -500,6 +503,7 @@ export default class Sensor { * @syscap SystemCapability.Sensors.Sensor * @since 3 * @deprecated since 8 + * @useinstead ohos.sensor/sensor#event:SensorId.MAGNETIC_FIELD */ static unsubscribeCompass(): void; @@ -510,6 +514,7 @@ export default class Sensor { * @syscap SystemCapability.Sensors.Sensor * @since 3 * @deprecated since 8 + * @useinstead ohos.sensor/sensor#event:SensorId.PROXIMITY */ static subscribeProximity(options: SubscribeProximityOptions): void; @@ -519,6 +524,7 @@ export default class Sensor { * @syscap SystemCapability.Sensors.Sensor * @since 3 * @deprecated since 8 + * @useinstead ohos.sensor/sensor#event:SensorId.PROXIMITY */ static unsubscribeProximity(): void; @@ -529,6 +535,7 @@ export default class Sensor { * @syscap SystemCapability.Sensors.Sensor * @since 3 * @deprecated since 8 + * @useinstead ohos.sensor/sensor#event:SensorId.AMBIENT_LIGHT */ static subscribeLight(options: SubscribeLightOptions): void; @@ -537,6 +544,7 @@ export default class Sensor { * @syscap SystemCapability.Sensors.Sensor * @since 3 * @deprecated since 8 + * @useinstead ohos.sensor/sensor#event:SensorId.AMBIENT_LIGHT */ static unsubscribeLight(): void; @@ -548,6 +556,7 @@ export default class Sensor { * @permission ohos.permission.ACTIVITY_MOTION * @since 3 * @deprecated since 8 + * @useinstead ohos.sensor/sensor#event:SensorId.PEDOMETER */ static subscribeStepCounter(options: SubscribeStepCounterOptions): void; @@ -557,6 +566,7 @@ export default class Sensor { * @permission ohos.permission.ACTIVITY_MOTION * @since 3 * @deprecated since 8 + * @useinstead ohos.sensor/sensor#event:SensorId.PEDOMETER */ static unsubscribeStepCounter(): void; @@ -567,6 +577,7 @@ export default class Sensor { * @syscap SystemCapability.Sensors.Sensor * @since 3 * @deprecated since 8 + * @useinstead ohos.sensor/sensor#event:SensorId.BAROMETER */ static subscribeBarometer(options: SubscribeBarometerOptions): void; @@ -575,6 +586,7 @@ export default class Sensor { * @syscap SystemCapability.Sensors.Sensor * @since 3 * @deprecated since 8 + * @useinstead ohos.sensor/sensor#event:SensorId.BAROMETER */ static unsubscribeBarometer(): void; @@ -586,6 +598,7 @@ export default class Sensor { * @permission ohos.permission.READ_HEALTH_DATA * @since 3 * @deprecated since 8 + * @useinstead ohos.sensor/sensor#event:SensorId.HEART_RATE */ static subscribeHeartRate(options: SubscribeHeartRateOptions): void; @@ -595,6 +608,7 @@ export default class Sensor { * @permission ohos.permission.READ_HEALTH_DATA * @since 3 * @deprecated since 8 + * @useinstead ohos.sensor/sensor#event:SensorId.HEART_RATE */ static unsubscribeHeartRate(): void; @@ -605,6 +619,7 @@ export default class Sensor { * @syscap SystemCapability.Sensors.Sensor * @since 3 * @deprecated since 8 + * @useinstead ohos.sensor/sensor#event:SensorId.WEAR_DETECTION */ static subscribeOnBodyState(options: SubscribeOnBodyStateOptions): void; @@ -613,6 +628,7 @@ export default class Sensor { * @syscap SystemCapability.Sensors.Sensor * @since 3 * @deprecated since 8 + * @useinstead ohos.sensor/sensor#event:SensorId.WEAR_DETECTION */ static unsubscribeOnBodyState(): void; @@ -622,6 +638,7 @@ export default class Sensor { * @syscap SystemCapability.Sensors.Sensor * @since 3 * @deprecated since 8 + * @useinstead ohos.sensor/sensor#event:SensorId.WEAR_DETECTION */ static getOnBodyState(options: GetOnBodyStateOptions): void; @@ -632,6 +649,7 @@ export default class Sensor { * @syscap SystemCapability.Sensors.Sensor * @since 6 * @deprecated since 8 + * @useinstead ohos.sensor/sensor#event:SensorId.ORIENTATION */ static subscribeDeviceOrientation(options: SubscribeDeviceOrientationOptions): void; @@ -640,6 +658,7 @@ export default class Sensor { * @syscap SystemCapability.Sensors.Sensor * @since 6 * @deprecated since 8 + * @useinstead ohos.sensor/sensor#event:SensorId.ORIENTATION */ static unsubscribeDeviceOrientation(): void; @@ -651,6 +670,7 @@ export default class Sensor { * @permission ohos.permission.GYROSCOPE * @since 6 * @deprecated since 8 + * @useinstead ohos.sensor/sensor#event:SensorId.GYROSCOPE */ static subscribeGyroscope(options: SubscribeGyroscopeOptions): void; @@ -660,6 +680,7 @@ export default class Sensor { * @permission ohos.permission.GYROSCOPE * @since 6 * @deprecated since 8 + * @useinstead ohos.sensor/sensor#event:SensorId.GYROSCOPE */ static unsubscribeGyroscope(): void; } diff --git a/api/@system.storage.d.ts b/api/@system.storage.d.ts index ad103508c8f40f1ea574550b0fcf264be4c05746..ee70b15efea49e65686a7deafc4ba49ab6d98f2b 100644 --- a/api/@system.storage.d.ts +++ b/api/@system.storage.d.ts @@ -14,7 +14,6 @@ */ /** - * @import import storage from '@system.storage'; * @since 3 * @syscap SystemCapability.DistributedDataManager.Preferences.Core * @deprecated since 6 @@ -65,7 +64,6 @@ export interface GetStorageOptions { } /** - * @import import storage from '@system.storage'; * @since 3 * @syscap SystemCapability.DistributedDataManager.Preferences.Core * @deprecated since 6 @@ -115,7 +113,6 @@ export interface SetStorageOptions { } /** - * @import import storage from '@system.storage'; * @since 3 * @syscap SystemCapability.DistributedDataManager.Preferences.Core * @deprecated since 6 @@ -148,7 +145,6 @@ export interface ClearStorageOptions { } /** - * @import import storage from '@system.storage'; * @since 3 * @deprecated since 6 * @FAModelOnly @@ -190,7 +186,6 @@ export interface DeleteStorageOptions { } /** - * @import import storage from '@system.storage'; * @since 3 * @syscap SystemCapability.DistributedDataManager.Preferences.Core * @deprecated since 6 @@ -201,6 +196,7 @@ export default class Storage { * Reads the stored content. * @param options Options. * @deprecated since 6 + * @useinstead ohos.preferences.preferences.get * @FAModelOnly */ static get(options: GetStorageOptions): void; @@ -217,6 +213,7 @@ export default class Storage { * Clears the stored content. * @param options Options. * @deprecated since 6 + * @useinstead ohos.preferences.preferences.clear * @FAModelOnly */ static clear(options?: ClearStorageOptions): void; @@ -225,6 +222,7 @@ export default class Storage { * Deletes the stored content. * @param options Options. * @deprecated since 6 + * @useinstead ohos.preferences.preferences.delete * @FAModelOnly */ static delete(options: DeleteStorageOptions): void; diff --git a/api/@system.vibrator.d.ts b/api/@system.vibrator.d.ts index f8fd9d1be2962baa1b34bfa92fa54e26cbda0f38..864ed279fe213a9fb7e3881e8833ad6fa2b2538d 100644 --- a/api/@system.vibrator.d.ts +++ b/api/@system.vibrator.d.ts @@ -1,66 +1,67 @@ -/* - * Copyright (c) 2020 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. - */ - -/** - * @syscap SystemCapability.Sensors.MiscDevice - * @import import vibrator from '@system.vibrator'; - * @permission ohos.permission.VIBRATE - * @since 3 - * @deprecated since 8 - */ -export interface VibrateOptions { - /** - * Vibration mode. The value long indicates long vibration, and short indicates short vibration. - * The default value is long. - * @since 3 - */ - mode?: "long" | "short"; - - /** - * Called when success to trigger vibration. - * @since 3 - */ - success: () => void; - - /** - * Called when fail to trigger vibration. - * @since 3 - */ - fail?: (data: string, code: number) => void; - - /** - * Called when the execution is completed. - * @since 3 - */ - complete?: () => void; -} - -/** - * @syscap SystemCapability.Sensors.MiscDevice - * @import import vibrator from '@system.vibrator'; - * @permission ohos.permission.VIBRATE - * @since 3 - * @deprecated since 8 - */ -export default class Vibrator { - /** - * Triggers vibration. - * @param options Options. - * @permission ohos.permission.VIBRATE - * @since 3 - * @deprecated since 8 - */ - static vibrate(options?: VibrateOptions): void; -} +/* + * Copyright (c) 2020 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. + */ + +/** + * @syscap SystemCapability.Sensors.MiscDevice + * @permission ohos.permission.VIBRATE + * @since 3 + * @deprecated since 8 + * @useinstead ohos.vibrator/vibrator.VibrateTime + */ + export interface VibrateOptions { + /** + * Vibration mode. The value long indicates long vibration, and short indicates short vibration. + * The default value is long. + * @since 3 + */ + mode?: "long" | "short"; + + /** + * Called when success to trigger vibration. + * @since 3 + */ + success: () => void; + + /** + * Called when fail to trigger vibration. + * @since 3 + */ + fail?: (data: string, code: number) => void; + + /** + * Called when the execution is completed. + * @since 3 + */ + complete?: () => void; +} + + /** + * @syscap SystemCapability.Sensors.MiscDevice + * @permission ohos.permission.VIBRATE + * @since 3 + * @deprecated since 8 + * @useinstead ohos.vibrator/vibrator + */ + export default class Vibrator { + /** + * Triggers vibration. + * @param options Options. + * @permission ohos.permission.VIBRATE + * @since 3 + * @deprecated since 8 + * @useinstead ohos.vibrator/vibrator#startVibration + */ + static vibrate(options?: VibrateOptions): void; +} \ No newline at end of file diff --git a/api/app/context.d.ts b/api/app/context.d.ts index e24a3dd24bd4235eaf348920f06d417e707ecfa1..41644a838e2eb7682415b92a3c84ecf67545f522 100644 --- a/api/app/context.d.ts +++ b/api/app/context.d.ts @@ -31,7 +31,6 @@ import bundle from '../@ohos.bundle'; * * @since 6 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @import import abilityManager from 'app/context' * @permission N/A * @FAModelOnly */ @@ -40,12 +39,12 @@ 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 + * 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 + * @returns the root dir * @FAModelOnly */ getOrCreateLocalDir(): Promise; @@ -53,14 +52,14 @@ export interface Context extends BaseContext { /** * Verify whether the specified permission is allowed for a particular * pid and uid running in the system. + * Pid and uid are optional. If you do not pass in pid and uid, + * it will check your own permission. * @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 + * @returns asynchronous callback with {@code 0} if the PID * and UID have the permission; callback with {@code -1} otherwise. * @FAModelOnly */ @@ -253,14 +252,14 @@ export interface Context extends BaseContext { * 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. + * @returns 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. + * Inform the system of the time required for drawing this Page ability. * @since 7 * @syscap SystemCapability.Ability.AbilityRuntime.Core * @FAModelOnly diff --git a/api/application/AbilityContext.d.ts b/api/application/AbilityContext.d.ts index c42a2a2981bb67cd740d475160dd03b0764c3191..10d68a0f20b1021e53d3119b7f4b4351f9a8c5f6 100755 --- a/api/application/AbilityContext.d.ts +++ b/api/application/AbilityContext.d.ts @@ -15,207 +15,370 @@ /// -import { AbilityInfo } from "../bundle/abilityInfo"; +import { AbilityInfo } from "../bundleManager/abilityInfo"; import { AbilityResult } from "../ability/abilityResult"; import { AsyncCallback } from "../basic"; import { ConnectOptions } from "../ability/connectOptions"; -import { HapModuleInfo } from "../bundle/hapModuleInfo"; +import { HapModuleInfo } from "../bundleManager/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.application.Ability'; +import { Configuration } from '../@ohos.app.ability.Configuration'; +import { Caller } from '../@ohos.app.ability.UIAbility'; 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 + * @since 9 */ export default class AbilityContext extends Context { /** * Indicates configuration information about an ability. - * - * @since 9 + * @type { AbilityInfo } * @syscap SystemCapability.Ability.AbilityRuntime.Core * @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 + * @since 9 */ currentHapModuleInfo: HapModuleInfo; /** * Indicates configuration information. - * - * @since 9 + * @type { Configuration } * @syscap SystemCapability.Ability.AbilityRuntime.Core * @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 + * @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 + * @systemapi * @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 + * @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 + * @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 + * @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 - + * @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 + * @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 - * @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. + * @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 - + * @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 + * @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 - * @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. + * @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 + * @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 + * @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; /** @@ -228,6 +391,8 @@ export default class AbilityContext extends Context { * @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; @@ -243,6 +408,8 @@ export default class AbilityContext extends Context { * @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; @@ -254,63 +421,148 @@ export default class AbilityContext extends Context { * @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 + * @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 + * @StageModelOnly + * @since 9 + */ + connectServiceExtensionAbility(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 + */ + connectServiceExtensionAbilityWithAccount(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 + * @StageModelOnly + * @since 9 + */ + disconnectServiceExtensionAbility(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 + * @StageModelOnly + * @since 9 + */ + disconnectServiceExtensionAbility(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 + * @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 - + * @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 + * @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 + * @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 + * @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 + * @since 9 */ isTerminating(): boolean; } diff --git a/api/application/AbilityRunningInfo.d.ts b/api/application/AbilityRunningInfo.d.ts index 864465c87b22972ca735b6293fb3b5ad2e39de80..63b82692d4882b7fb2ee1e533577287609fff864 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/AbilityStageContext.d.ts b/api/application/AbilityStageContext.d.ts index 4b2777b37d1f0f7a7441e4e0c7661829f3fce56b..d5feff64cf43cbc4652446562f0b2a6b6058dfd6 100644 --- a/api/application/AbilityStageContext.d.ts +++ b/api/application/AbilityStageContext.d.ts @@ -13,8 +13,8 @@ * limitations under the License. */ -import { HapModuleInfo } from "../bundle/hapModuleInfo"; -import { Configuration } from '../@ohos.application.Configuration'; +import { HapModuleInfo } from "../bundleManager/hapModuleInfo"; +import { Configuration } from '../@ohos.app.ability.Configuration'; import Context from "./Context"; /** diff --git a/api/application/AccessibilityExtensionContext.d.ts b/api/application/AccessibilityExtensionContext.d.ts index 76ee1b0e0bc988890bed83dc459bcc4a5ddd059e..d3c38cddded2ee8d53cf57cc0e92b4948f1dbc90 100644 --- a/api/application/AccessibilityExtensionContext.d.ts +++ b/api/application/AccessibilityExtensionContext.d.ts @@ -28,6 +28,7 @@ export default class AccessibilityExtensionContext extends ExtensionContext { /** * Set the name of the bundle name that is interested in sending the event. * @param targetNames + * @throws { BusinessError } 401 - Input parameter error. */ setTargetBundleName(targetNames: Array): Promise; setTargetBundleName(targetNames: Array, callback: AsyncCallback): void; @@ -35,6 +36,7 @@ export default class AccessibilityExtensionContext extends ExtensionContext { /** * Get focus element. * @param isAccessibilityFocus Indicates whether the acquired element has an accessibility focus. + * @throws { BusinessError } 9300003 - Do not have accessibility right for this operation. */ getFocusElement(isAccessibilityFocus?: boolean): Promise; getFocusElement(callback: AsyncCallback): void; @@ -43,6 +45,7 @@ export default class AccessibilityExtensionContext extends ExtensionContext { /** * Get window root element. * @param windowId Indicates the window ID. + * @throws { BusinessError } 9300003 - Do not have accessibility right for this operation. */ getWindowRootElement(windowId?: number): Promise; getWindowRootElement(callback: AsyncCallback): void; @@ -51,6 +54,7 @@ export default class AccessibilityExtensionContext extends ExtensionContext { /** * Get window list. * @param displayId Indicates the display ID. + * @throws { BusinessError } 9300003 - Do not have accessibility right for this operation. */ getWindows(displayId?: number): Promise>; getWindows(callback: AsyncCallback>): void; @@ -59,6 +63,8 @@ export default class AccessibilityExtensionContext extends ExtensionContext { /** * Inject gesture path events. * @param gesturePath Indicates the gesture path. + * @throws { BusinessError } 401 - Input parameter error. + * @throws { BusinessError } 9300003 - Do not have accessibility right for this operation. */ injectGesture(gesturePath: GesturePath): Promise; injectGesture(gesturePath: GesturePath, callback: AsyncCallback): void; @@ -81,6 +87,8 @@ declare interface AccessibilityElement { /** * Get the value of an attribute. * @param attributeName Indicates the attribute name. + * @throws { BusinessError } 401 - Input parameter error. + * @throws { BusinessError } 9300004 - This property does not exist. */ attributeValue(attributeName: T): Promise; attributeValue(attributeName: T, @@ -96,15 +104,18 @@ declare interface AccessibilityElement { * Perform the specified action. * @param actionName Indicates the action name. * @param parameters Indicates the parameters needed to execute the action. + * @throws { BusinessError } 401 - Input parameter error. + * @throws { BusinessError } 9300005 - This action is not supported. */ - performAction(actionName: string, parameters?: object): Promise; - performAction(actionName: string, callback: AsyncCallback): void; - performAction(actionName: string, parameters: object, callback: AsyncCallback): void; + performAction(actionName: string, parameters?: object): Promise; + performAction(actionName: string, callback: AsyncCallback): void; + performAction(actionName: string, parameters: object, callback: AsyncCallback): void; /** * Find elements that match the condition. * @param type The type of query condition is content. * @param condition Indicates the specific content to be queried. + * @throws { BusinessError } 401 - Input parameter error. */ findElement(type: 'content', condition: string): Promise>; findElement(type: 'content', condition: string, callback: AsyncCallback>): void @@ -113,6 +124,7 @@ declare interface AccessibilityElement { * Find elements that match the condition. * @param type The type of query condition is focus type. * @param condition Indicates the type of focus to query. + * @throws { BusinessError } 401 - Input parameter error. */ findElement(type: 'focusType', condition: FocusType): Promise; findElement(type: 'focusType', condition: FocusType, callback: AsyncCallback): void @@ -121,6 +133,7 @@ declare interface AccessibilityElement { * Find elements that match the condition. * @param type The type of query condition is focus direction. * @param condition Indicates the direction of search focus to query. + * @throws { BusinessError } 401 - Input parameter error. */ findElement(type: 'focusDirection', condition: FocusDirection): Promise; findElement(type: 'focusDirection', condition: FocusDirection, callback: AsyncCallback): void diff --git a/api/application/ApplicationContext.d.ts b/api/application/ApplicationContext.d.ts index 2f605c61cf00e4bfa78422ab766a12527bcc5db8..891d6611461dec4125311e7070bb1d59d0fb46d9 100755 --- a/api/application/ApplicationContext.d.ts +++ b/api/application/ApplicationContext.d.ts @@ -15,16 +15,15 @@ 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"; /** * The context of an application. It allows access to application-specific resources. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @permission N/A * @StageModelOnly + * @since 9 */ export default class ApplicationContext extends Context { /** @@ -33,8 +32,10 @@ export default class ApplicationContext extends Context { * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core * @param callback The ability lifecycle callback. - * @return Returns the number code of the callback. + * @returns Returns the number code of the callback. * @StageModelOnly + * @deprecated since 9 + * @useinstead on */ registerAbilityLifecycleCallback(callback: AbilityLifecycleCallback): number; @@ -44,8 +45,10 @@ export default class ApplicationContext extends Context { * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core * @param callbackId Indicates the number code of the callback. - * @return - + * @returns - * @StageModelOnly + * @deprecated since 9 + * @useinstead off */ unregisterAbilityLifecycleCallback(callbackId: number, callback: AsyncCallback): void; unregisterAbilityLifecycleCallback(callbackId: number): Promise; @@ -56,8 +59,10 @@ export default class ApplicationContext extends Context { * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core * @param callback The environment callback. - * @return Returns the number code of the callback. + * @returns Returns the number code of the callback. * @StageModelOnly + * @deprecated since 9 + * @useinstead on */ registerEnvironmentCallback(callback: EnvironmentCallback): number; @@ -67,9 +72,123 @@ export default class ApplicationContext extends Context { * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core * @param callbackId Indicates the number code of the callback. - * @return - + * @returns - * @StageModelOnly + * @deprecated since 9 + * @useinstead off */ unregisterEnvironmentCallback(callbackId: number, callback: AsyncCallback): void; unregisterEnvironmentCallback(callbackId: number): Promise; + + /** + * 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. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + 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 off. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + 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. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + 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. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + 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. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + 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. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + * @since 9 + */ + 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/ApplicationStateObserver.d.ts b/api/application/ApplicationStateObserver.d.ts index 71cab9a6b377e4695fd7af99c284b0ec5b970f0c..3833740a53879d407201677dd9bc99ded7d335b3 100644 --- a/api/application/ApplicationStateObserver.d.ts +++ b/api/application/ApplicationStateObserver.d.ts @@ -33,7 +33,7 @@ export default class ApplicationStateObserver { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @param appStateData State changed Application info. * @systemapi hide for inner use. - * @return - + * @returns - */ onForegroundApplicationChanged(appStateData: AppStateData): void; @@ -44,7 +44,7 @@ export default class ApplicationStateObserver { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @param abilityStateData State changed ability info. * @systemapi hide for inner use. - * @return - + * @returns - */ onAbilityStateChanged(abilityStateData: AbilityStateData): void; @@ -55,7 +55,7 @@ export default class ApplicationStateObserver { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @param processData Process info. * @systemapi hide for inner use. - * @return - + * @returns - */ onProcessCreated(processData: ProcessData): void; @@ -66,7 +66,7 @@ export default class ApplicationStateObserver { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @param processData Process info. * @systemapi hide for inner use. - * @return - + * @returns - */ onProcessDied(processData: ProcessData): void; @@ -77,7 +77,7 @@ export default class ApplicationStateObserver { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @param processData Process info. * @systemapi hide for inner use. - * @return - + * @returns - */ onProcessStateChanged(processData: ProcessData): void; } diff --git a/api/application/Context.d.ts b/api/application/Context.d.ts index 26c6eadcadde30f17ddc7dac2d1dcd787881ad7b..20f40a64a0d691fd5f48849232c6ec31306d36b9 100755 --- a/api/application/Context.d.ts +++ b/api/application/Context.d.ts @@ -13,7 +13,7 @@ * limitations under the License. */ -import { ApplicationInfo } from "../bundle/applicationInfo"; +import { ApplicationInfo } from "../bundleManager/applicationInfo"; import resmgr from "../@ohos.resourceManager"; import BaseContext from "./BaseContext"; import EventHub from "./EventHub"; @@ -22,166 +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 + * @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 + * @since 9 */ resourceManager: resmgr.ResourceManager; /** * Indicates configuration information about an application. - * - * @since 9 + * @type { ApplicationInfo } * @syscap SystemCapability.Ability.AbilityRuntime.Core * @StageModelOnly + * @since 9 */ applicationInfo: ApplicationInfo; /** * Indicates app cache dir. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.Core * @StageModelOnly + * @since 9 */ cacheDir: string; /** * Indicates app temp dir. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.Core * @StageModelOnly + * @since 9 */ tempDir: string; /** * Indicates app files dir. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.Core * @StageModelOnly + * @since 9 */ - filesDir : string; + filesDir: string; /** * Indicates app database dir. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.Core * @StageModelOnly + * @since 9 */ - databaseDir : string; + databaseDir: string; /** * Indicates app preferences dir. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.Core * @StageModelOnly + * @since 9 */ - preferencesDir : string; + preferencesDir: string; /** * Indicates app bundle code dir. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.Core * @StageModelOnly + * @since 9 */ - bundleCodeDir : string; + bundleCodeDir: string; /** * Indicates app distributed files dir. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.Core * @StageModelOnly + * @since 9 */ distributedFilesDir: string; /** * Indicates event hub. - * - * @since 9 + * @type { EventHub } * @syscap SystemCapability.Ability.AbilityRuntime.Core * @StageModelOnly + * @since 9 */ eventHub: EventHub; /** * Indicates file area. - * - * @since 9 + * @type { AreaMode } * @syscap SystemCapability.Ability.AbilityRuntime.Core * @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 + * @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 + * @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 + * @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 + * @since 9 */ getApplicationContext(): ApplicationContext; } /** - * File area mode - * - * @since 9 + * Enum for the file area mode + * @enum { number } * @syscap SystemCapability.Ability.AbilityRuntime.Core * @StageModelOnly + * @since 9 */ export enum AreaMode { /** diff --git a/api/application/ContinueDeviceInfo.d.ts b/api/application/ContinueDeviceInfo.d.ts index d6402c3d069e39fdfa74fa898ff9702d38925edf..e557838b04dd89a2412ab64ef8d87c8fb8ff60c4 100644 --- a/api/application/ContinueDeviceInfo.d.ts +++ b/api/application/ContinueDeviceInfo.d.ts @@ -44,10 +44,10 @@ */ missionId: number; /** - * Indicates the extended params. + * Indicates the extended param. * * @syscap SystemCapability.Ability.AbilityRuntime.Mission * @since 9 */ - wantParams: {[key: string]: any}; + wantParam: {[key: string]: any}; } \ No newline at end of file diff --git a/api/application/ErrorObserver.d.ts b/api/application/ErrorObserver.d.ts index 47651854287766467ec1e6e22c48afeb9eaa3394..0e6912defe75dfb0e3b52e0172dec3c7c14cfbb6 100644 --- a/api/application/ErrorObserver.d.ts +++ b/api/application/ErrorObserver.d.ts @@ -27,7 +27,7 @@ export default class ErrorObserver { * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core * @param errMsg the message and error stacktrace about the exception. - * @return - + * @returns - */ onUnhandledException(errMsg: string): void; } \ No newline at end of file diff --git a/api/application/EventHub.d.ts b/api/application/EventHub.d.ts index 7fe3d203caeeacd2d0139d830ecb382e61b02538..5c94424b9f0a3685f9318d14594e3b4562564ee1 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,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 + * @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 + * @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 + * @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 + * @since 9 */ emit(event: string, ...args: Object[]): void } \ No newline at end of file diff --git a/api/application/ExtensionContext.d.ts b/api/application/ExtensionContext.d.ts index 3e20d41b8e4306a128b5142a89b509a5067cdcb1..472c4471939624685b80512703f156cf3282a290 100644 --- a/api/application/ExtensionContext.d.ts +++ b/api/application/ExtensionContext.d.ts @@ -13,10 +13,10 @@ * limitations under the License. */ -import { HapModuleInfo } from "../bundle/hapModuleInfo"; -import { Configuration } from '../@ohos.application.Configuration'; +import { HapModuleInfo } from "../bundleManager/hapModuleInfo"; +import { Configuration } from '../@ohos.app.ability.Configuration'; import Context from "./Context"; -import { ExtensionAbilityInfo } from "../bundle/extensionAbilityInfo"; +import { ExtensionAbilityInfo } from "../bundleManager/extensionAbilityInfo"; /** * The context of an extension. It allows access to extension-specific resources. diff --git a/api/application/ExtensionRunningInfo.d.ts b/api/application/ExtensionRunningInfo.d.ts index 32abe9c2647daf5c7c6f5f7f8ce0ddd4515a4cbc..7a4ef741fa8afba569aed1da0a01adb84f6a9b91 100644 --- a/api/application/ExtensionRunningInfo.d.ts +++ b/api/application/ExtensionRunningInfo.d.ts @@ -13,8 +13,8 @@ * limitations under the License. */ -import { ElementName } from '../bundle/elementName'; -import bundle from '../@ohos.bundle'; +import { ElementName } from '../bundleManager/elementName'; +import bundle from '../@ohos.bundle.bundleManager'; /** * The class of an extension running information. @@ -74,7 +74,7 @@ export interface ExtensionRunningInfo { clientPackage: Array; /** - * @default Enumerates types of the entension info + * @default Enumerates types of the extension info * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi hide this for inner system use diff --git a/api/application/FormExtensionContext.d.ts b/api/application/FormExtensionContext.d.ts index 95952a3bb000c6d432dd80a43816720969c30b57..062c5033baddc35838333d9982fe3e598b31e055 100644 --- a/api/application/FormExtensionContext.d.ts +++ b/api/application/FormExtensionContext.d.ts @@ -22,7 +22,7 @@ import Want from '../@ohos.application.Want'; * The context of form extension. It allows access to * formExtension-specific resources. * @syscap SystemCapability.Ability.Form - * @stagemodelonly + * @StageModelOnly * @since 9 */ export default class FormExtensionContext extends ExtensionContext { @@ -33,7 +33,7 @@ export default class FormExtensionContext extends ExtensionContext { * @returns { Promise } The promise returned by the function. * @syscap SystemCapability.Ability.Form * @systemapi - * @stagemodelonly + * @StageModelOnly * @since 9 */ startAbility(want: Want, callback: AsyncCallback): void; diff --git a/api/application/MissionInfo.d.ts b/api/application/MissionInfo.d.ts index 5233bce35ebd239f203655f55dfa93045eece809..6402b4fdfe1ff374c5e9ef2c9cbdbccdbf38ec27 100644 --- a/api/application/MissionInfo.d.ts +++ b/api/application/MissionInfo.d.ts @@ -1,90 +1,89 @@ -/* - * 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 Want from "../@ohos.application.Want"; - -/** - * Mission information corresponding to ability. - * - * @since 8 - * @syscap SystemCapability.Ability.AbilityRuntime.Mission - * @permission N/A - * @systemapi hide for inner use. - */ -export interface MissionInfo { - /** - * Indicates mission id. - * - * @since 8 - * @syscap SystemCapability.Ability.AbilityRuntime.Mission - */ - missionId: number; - - /** - * Indicates running state. - * - * @since 8 - * @syscap SystemCapability.Ability.AbilityRuntime.Mission - */ - runningState: number; - - /** - * Indicates locked state. - * - * @since 8 - * @syscap SystemCapability.Ability.AbilityRuntime.Mission - */ - lockedState: boolean; - - /** - * Indicates the recent create or update time of the mission. - * - * @since 8 - * @syscap SystemCapability.Ability.AbilityRuntime.Mission - */ - timestamp: string; - - /** - * Indicates want of the mission. - * - * @since 8 - * @syscap SystemCapability.Ability.AbilityRuntime.Mission - */ - want: Want; - - /** - * Indicates label of the mission. - * - * @since 8 - * @syscap SystemCapability.Ability.AbilityRuntime.Mission - */ - label: string; - - /** - * Indicates icon path of the mission. - * - * @since 8 - * @syscap SystemCapability.Ability.AbilityRuntime.Mission - */ - iconPath: string; - - /** - * Indicates whether the mision is continuable. - * - * @since 8 - * @syscap SystemCapability.Ability.AbilityRuntime.Mission - */ - continuable: boolean; +/* + * 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 Want from "../@ohos.application.Want"; + +/** + * Mission information corresponding to ability. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @systemapi hide for inner use. + */ +export interface MissionInfo { + /** + * Indicates mission id. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + */ + missionId: number; + + /** + * Indicates running state. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + */ + runningState: number; + + /** + * Indicates locked state. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + */ + lockedState: boolean; + + /** + * Indicates the recent created or updated time of the mission. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + */ + timestamp: string; + + /** + * Indicates want of the mission. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + */ + want: Want; + + /** + * Indicates label of the mission. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + */ + label: string; + + /** + * Indicates icon path of the mission. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + */ + iconPath: string; + + /** + * Indicates whether the mission is continuable. + * + * @since 8 + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + */ + continuable: boolean; } \ No newline at end of file diff --git a/api/application/MissionListener.d.ts b/api/application/MissionListener.d.ts index e80aaa7d62eabd8f11d8abe2074723f7c85276ec..ffae5f46c58674eaaabce86d576092070ecba9fd 100644 --- a/api/application/MissionListener.d.ts +++ b/api/application/MissionListener.d.ts @@ -31,7 +31,7 @@ import image from "../@ohos.multimedia.image"; * @since 8 * @syscap SystemCapability.Ability.AbilityRuntime.Mission * @param mission Indicates the id of created mission. - * @return - + * @returns - */ onMissionCreated(mission: number): void; @@ -41,27 +41,27 @@ import image from "../@ohos.multimedia.image"; * @since 8 * @syscap SystemCapability.Ability.AbilityRuntime.Mission * @param mission Indicates the id of destroyed mission. - * @return - + * @returns - */ onMissionDestroyed(mission: number): void; /** - * Called by system when mission shapshot changed. + * Called by system when mission snapshot changed. * * @since 8 * @syscap SystemCapability.Ability.AbilityRuntime.Mission * @param mission Indicates the id of the mission which the snapshot changes - * @return - + * @returns - */ onMissionSnapshotChanged(mission: number): void; /** - * Called by system when mission moved to fornt. + * Called by system when mission moved to front. * * @since 8 * @syscap SystemCapability.Ability.AbilityRuntime.Mission * @param mission Indicates the id of the mission being moved to the foreground. - * @return - + * @returns - */ onMissionMovedToFront(mission: number): void; @@ -71,7 +71,7 @@ import image from "../@ohos.multimedia.image"; * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Mission * @param mission Indicates the id of the mission whose label has changed. - * @return - + * @returns - */ onMissionLabelUpdated(mission: number): void; @@ -82,7 +82,7 @@ import image from "../@ohos.multimedia.image"; * @syscap SystemCapability.Ability.AbilityRuntime.Mission * @param mission Indicates the id of the mission whose icon has changed. * @param icon Indicates the icon of the mission whose icon has changed. - * @return - + * @returns - */ onMissionIconUpdated(mission: number, icon: image.PixelMap): void; @@ -92,7 +92,7 @@ import image from "../@ohos.multimedia.image"; * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Mission * @param mission Indicates the id of the mission whose ability instance is destroyed. - * @return - + * @returns - */ onMissionClosed(mission: number): void; } \ No newline at end of file diff --git a/api/application/MissionParameter.d.ts b/api/application/MissionParameter.d.ts index e1b67f209e1602d710d58b85cb3b78f9c297bd18..a21e1097451d8bbcdf394d83aa99ce7c72040d58 100755 --- a/api/application/MissionParameter.d.ts +++ b/api/application/MissionParameter.d.ts @@ -31,7 +31,7 @@ export interface MissionParameter { deviceId: string; /** - * If needed to fix the versions confilct. + * If needed to fix the versions conflict. * * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Mission diff --git a/api/application/ServiceExtensionContext.d.ts b/api/application/ServiceExtensionContext.d.ts index dd21ca7d0a1e5c23fa5b7bd77e6e709f5779c922..b9df2f2f3dd45e364e9afb4cb4b654e5aadbb184 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,119 +15,223 @@ import { AsyncCallback } from "../basic"; import { ConnectOptions } from "../ability/connectOptions"; -import Caller from '../@ohos.application.Ability'; +import { Caller } from '../@ohos.app.ability.UIAbility'; 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 * serviceExtension-specific resources. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi hide for inner use. - * @permission N/A + * @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 - + * @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 - + * @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 - + * @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 + * @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 - * @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. + * @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 - + * @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 + * @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 - * @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. + * @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 - + * @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; /** @@ -142,8 +246,10 @@ export default class ServiceExtensionContext extends ExtensionContext { * @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. + * @returns connection id, int value. * @StageModelOnly + * @deprecated since 9 + * @useinstead connectServiceExtensionAbility */ connectAbility(want: Want, options: ConnectOptions): number; @@ -160,33 +266,92 @@ export default class ServiceExtensionContext extends ExtensionContext { * @param accountId Indicates the account to connect. * @param options Indicates the callback of connection. * @systemapi hide for inner use. - * @return connection id, int value. + * @returns 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 + * Disconnect 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 - + * @returns - * @StageModelOnly + * @deprecated since 9 + * @useinstead disconnectServiceExtensionAbility */ disconnectAbility(connection: number, callback:AsyncCallback): void; disconnectAbility(connection: number): Promise; /** - * Get the caller object of the startup capability - * + * 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 + * @StageModelOnly + * @since 9 + */ + connectServiceExtensionAbility(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 + */ + connectServiceExtensionAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number; + + /** + * Disconnect 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 + * @StageModelOnly + * @since 9 + */ + disconnectServiceExtensionAbility(connection: number, callback: AsyncCallback): void; + + /** + * Disconnect 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 + * @StageModelOnly * @since 9 + */ + disconnectServiceExtensionAbility(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 - * @param want Indicates the ability to start. - * @return Returns to the Caller interface on success Returns empty or undefined on failure + * @systemapi * @StageModelOnly + * @since 9 */ - startAbilityByCall(want: Want): Promise; + startAbilityByCall(want: Want): Promise; } \ No newline at end of file diff --git a/api/application/UIAbilityContext.d.ts b/api/application/UIAbilityContext.d.ts new file mode 100755 index 0000000000000000000000000000000000000000..bfa3f641854f5b2d37eee72f72bfd10482441e48 --- /dev/null +++ b/api/application/UIAbilityContext.d.ts @@ -0,0 +1,522 @@ +/* + * 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 "../bundleManager/abilityInfo"; +import { AbilityResult } from "../ability/abilityResult"; +import { AsyncCallback } from "../basic"; +import { ConnectOptions } from "../ability/connectOptions"; +import { HapModuleInfo } from "../bundleManager/hapModuleInfo"; +import Context from "./Context"; +import Want from "../@ohos.application.Want"; +import StartOptions from "../@ohos.app.ability.StartOptions"; +import PermissionRequestResult from "./PermissionRequestResult"; +import { Configuration } from '../@ohos.app.ability.Configuration'; +import { Caller } from '../@ohos.app.ability.UIAbility'; +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 UIAbilityContext 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 + * @systemapi + * @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 + * @StageModelOnly + * @since 9 + */ + connectServiceExtensionAbility(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 + */ + connectServiceExtensionAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number; + + /** + * The callback interface is connected 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 + * @StageModelOnly + * @since 9 + */ + disconnectServiceExtensionAbility(connection: number, callback: AsyncCallback): void; + + /** + * The callback interface is connected 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 + * @StageModelOnly + * @since 9 + */ + disconnectServiceExtensionAbility(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 + * @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 + * @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 + * @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 + * @StageModelOnly + * @since 9 + */ + isTerminating(): boolean; +} diff --git a/api/application/abilityDelegator.d.ts b/api/application/abilityDelegator.d.ts index d6e08d73b2da9897b764087e2fb95667bd74c348..7057c64bfffb1522d2e51cbd2652a7c34db09bc2 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,8 +14,8 @@ */ import { AsyncCallback } from '../basic'; -import Ability from '../@ohos.application.Ability'; -import AbilityStage from '../@ohos.application.AbilityStage'; +import UIAbility from '../@ohos.app.ability.UIAbility'; +import AbilityStage from '../@ohos.app.ability.AbilityStage'; import { AbilityMonitor } from './abilityMonitor'; import { AbilityStageMonitor } from './abilityStageMonitor'; import Context from './Context'; @@ -24,140 +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 + * @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. - * + * @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 - * @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; - waitAbilityMonitor(monitor: AbilityMonitor, timeout: number, callback: AsyncCallback): void; - waitAbilityMonitor(monitor: AbilityMonitor, timeout?: number): Promise; + 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 - * @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, callback: AsyncCallback): void; /** - * Obtain the application context. - * + * 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 - * @return App Context + * @since 9 */ getAppContext(): Context; /** * Obtain the lifecycle state of a specified ability. - * - * @since 9 + * @param { UIAbility } 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; + getAbilityState(ability: UIAbility): 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 - * @return The top ability of the current application + * @since 9 */ - getCurrentTopAbility(callback: AsyncCallback): void; - getCurrentTopAbility(): Promise + 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 { UIAbility } 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: UIAbility, callback: AsyncCallback): void; + + /** + * Invoke the Ability.onForeground() callback of a specified ability without changing its lifecycle state. + * @param { UIAbility } 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: UIAbility): Promise; /** * Invoke the Ability.onBackground() callback of a specified ability without changing its lifecycle state. - * + * @param { UIAbility } 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: UIAbility, callback: AsyncCallback): void; + + /** + * Invoke the Ability.onBackground() callback of a specified ability without changing its lifecycle state. + * @param { UIAbility } 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: UIAbility): Promise; /** * Prints log information to the unit testing console. @@ -173,12 +282,12 @@ 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. - * - * @since 9 + * @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. @@ -187,7 +296,7 @@ export interface AbilityDelegator { * @syscap SystemCapability.Ability.AbilityRuntime.Core * @param cmd Shell command * @param timeoutSecs Timeout, in seconds - * @return ShellCmdResult object + * @returns ShellCmdResult object */ executeShellCommand(cmd: string, callback: AsyncCallback): void; executeShellCommand(cmd: string, timeoutSecs: number, callback: AsyncCallback): void; @@ -196,13 +305,25 @@ export interface AbilityDelegator { /** * 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/application/abilityDelegatorArgs.d.ts b/api/application/abilityDelegatorArgs.d.ts index f140bc13d89c9c29c89e85b85b480d4cd9522b95..b61dadb149b29d2116f7b98c518b3187e04a31bf 100644 --- a/api/application/abilityDelegatorArgs.d.ts +++ b/api/application/abilityDelegatorArgs.d.ts @@ -19,7 +19,6 @@ * * @since 8 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @import import AbilityDelegatorArgs from 'application/abilityDelegatorArgs.d' * @permission N/A */ export interface AbilityDelegatorArgs { diff --git a/api/application/abilityMonitor.d.ts b/api/application/abilityMonitor.d.ts index 6af8397d2af4374028708d8c240d8dcc38d3f524..d613f964db169f9ea2f7a936ea9a0ddff5bf0dcf 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 UIAbility from '../@ohos.app.ability.UIAbility'; /** * Provide methods for matching monitored Ability objects that meet specified conditions. @@ -21,7 +21,6 @@ import Ability from '../@ohos.application.Ability'; * * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @import import AbilityMonitor from 'application/abilityMonitor.d' * @permission N/A */ export interface AbilityMonitor { @@ -33,13 +32,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: UIAbility) => void; /** * Called back when the state of the ability changes to foreground. @@ -47,7 +54,7 @@ export interface AbilityMonitor { * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core */ - onAbilityForeground?:(data: Ability) => void; + onAbilityForeground?:(ability: UIAbility) => void; /** * Called back when the state of the ability changes to background. @@ -55,7 +62,7 @@ export interface AbilityMonitor { * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core */ - onAbilityBackground?:(data: Ability) => void; + onAbilityBackground?:(ability: UIAbility) => void; /** * Called back before the ability is destroyed. @@ -63,7 +70,7 @@ export interface AbilityMonitor { * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core */ - onAbilityDestroy?:(data: Ability) => void; + onAbilityDestroy?:(ability: UIAbility) => void; /** * Called back when an ability window stage is created. @@ -71,7 +78,7 @@ export interface AbilityMonitor { * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core */ - onWindowStageCreate?:(data: Ability) => void; + onWindowStageCreate?:(ability: UIAbility) => void; /** * Called back when an ability window stage is restored. @@ -79,7 +86,7 @@ export interface AbilityMonitor { * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core */ - onWindowStageRestore?:(data: Ability) => void; + onWindowStageRestore?:(ability: UIAbility) => void; /** * Called back when an ability window stage is destroyed. @@ -87,7 +94,7 @@ export interface AbilityMonitor { * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core */ - onWindowStageDestroy?:(data: Ability) => void; + onWindowStageDestroy?:(ability: UIAbility) => void; } export default AbilityMonitor; \ No newline at end of file diff --git a/api/application/abilityStageMonitor.d.ts b/api/application/abilityStageMonitor.d.ts index 6ca989090dd304e924c2ac33a960948b7e8ba9a2..cbe57c44db739c65d360233dc70d9d25b3848426 100644 --- a/api/application/abilityStageMonitor.d.ts +++ b/api/application/abilityStageMonitor.d.ts @@ -19,7 +19,6 @@ * * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @import import AbilityStageMonitor from 'application/AbilityStageMonitor.d' * @permission N/A */ export interface AbilityStageMonitor { diff --git a/api/bundle/PermissionDef.d.ts b/api/bundle/PermissionDef.d.ts index 6be050d5d9c4f317090f05de501fd41b9ac49346..fcb7d7a70d19b33a29fc3a044d246e6dc6d6c27c 100644 --- a/api/bundle/PermissionDef.d.ts +++ b/api/bundle/PermissionDef.d.ts @@ -17,8 +17,9 @@ * @name Indicates the defined permission details in file config.json * @since 8 * @syscap SystemCapability.BundleManager.BundleFramework - * @permission NA * @systemapi + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager.PermissionDef */ export interface PermissionDef { /** diff --git a/api/bundle/abilityInfo.d.ts b/api/bundle/abilityInfo.d.ts index b1ae1d907f5d8290801f0f1eef179f6ff5ad5a63..a37c9d8b431b9a775538fda697778083da45e1a4 100644 --- a/api/bundle/abilityInfo.d.ts +++ b/api/bundle/abilityInfo.d.ts @@ -15,14 +15,14 @@ import { ApplicationInfo } from './applicationInfo'; import { CustomizeData } from './customizeData' -import { Metadata } from './metadata' import bundle from './../@ohos.bundle'; /** * @name Obtains configuration information about an ability * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework - * @permission NA + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager.AbilityInfo */ export interface AbilityInfo { /** @@ -215,67 +215,10 @@ export interface AbilityInfo { */ readonly metaData: Array; - /** - * @default Indicates the metadata of ability - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * - */ - readonly metadata: Array; - /** * @default Indicates whether the ability is enabled * @since 8 * @syscap SystemCapability.BundleManager.BundleFramework */ readonly enabled: boolean; - - /** - * @default Indicates which window mode is supported - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly supportWindowMode: Array; - - /** - * @default Indicates maximum ratio of width over height of window under free window status. - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly maxWindowRatio: number; - - /** - * @default Indicates minimum ratio of width over height of window under free window status. - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly minWindowRatio: number; - - /** - * @default Indicates maximum width of window under free window status. - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly maxWindowWidth: number; - - /** - * @default Indicates minimum width of window under free window status. - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly minWindowWidth: number; - - /** - * @default Indicates maximum height of window under free window status. - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly maxWindowHeight: number; - - /** - * @default Indicates minimum height of window under free window status. - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly minWindowHeight: number; } diff --git a/api/bundle/applicationInfo.d.ts b/api/bundle/applicationInfo.d.ts index 73477bb49bc2aab39ecb3ae0367e76a56f8469fe..8f9f27ded1e01807ed2af79af66ca58682a8ec5a 100644 --- a/api/bundle/applicationInfo.d.ts +++ b/api/bundle/applicationInfo.d.ts @@ -15,15 +15,13 @@ import { ModuleInfo } from './moduleInfo'; import { CustomizeData } from './customizeData'; -import { Metadata } from './metadata'; -import { Resource } from './../global/resource'; /** * @name Obtains configuration information about an application * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework - * @permission NA - * + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager.ApplicationInfo */ export interface ApplicationInfo { /** @@ -72,17 +70,11 @@ export interface ApplicationInfo { * @default Indicates the label id of the application * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework - * @deprecated since 9, use labelIndex + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager.ApplicationInfo.labelIndex */ readonly labelId: string; - /** - * @default Indicates the label index of the application - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly labelIndex: number; - /** * @default Indicates the icon of the application * @since 7 @@ -94,17 +86,11 @@ export interface ApplicationInfo { * @default Indicates the icon id of the application * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework - * @deprecated since 9, use iconIndex + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager.ApplicationInfo.iconIndex */ readonly iconId: string; - /** - * @default Indicates the icon index of the application - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly iconIndex: number; - /** * @default Process of application, if user do not set it ,the value equal bundleName * @since 7 @@ -161,13 +147,6 @@ export interface ApplicationInfo { */ readonly metaData: Map>; - /** - * @default Indicates the metadata of module - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly metadata: Map>; - /** * @default Indicates whether or not this application may be removable * @since 8 @@ -195,45 +174,4 @@ export interface ApplicationInfo { * @syscap SystemCapability.BundleManager.BundleFramework */ readonly entityType: string; - - /** - * @default Indicates fingerprint of the certificate - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly fingerprint: string; - - /** - * @default Indicates icon resource of the application - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly iconResource: Resource; - - /** - * @default Indicates label resource of the application - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly labelResource: Resource; - /** - * @default Indicates description resource of the application - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly descriptionResource: Resource; - - /** - * @default Indicates the appDistributionType of the application - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly appDistributionType: string; - - /** - * @default Indicates the appProvisionType of the application - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly appProvisionType: string; } diff --git a/api/bundle/bundleInfo.d.ts b/api/bundle/bundleInfo.d.ts index 4da8310f4300f390e4faf00594cd3c43730c4cca..de3c304a3f03cca565a18db553fe585080a8a6e4 100644 --- a/api/bundle/bundleInfo.d.ts +++ b/api/bundle/bundleInfo.d.ts @@ -15,14 +15,14 @@ import { AbilityInfo } from './abilityInfo'; import { ApplicationInfo } from './applicationInfo'; -import { ExtensionAbilityInfo } from './extensionAbilityInfo'; import { HapModuleInfo } from './hapModuleInfo'; /** * @name The scene which is used * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework - * @permission NA + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager.UsedScene * */ export interface UsedScene { @@ -45,8 +45,8 @@ export interface UsedScene { * @name Indicates the required permissions details defined in file config.json * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework - * @permission NA - * + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager.ReqPermissionDetail */ export interface ReqPermissionDetail { /** @@ -63,13 +63,6 @@ export interface ReqPermissionDetail { */ reason: string; - /** - * @default Indicates the reason id of this required permissions - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - reasonId: number; - /** * @default Indicates the used scene of this required permissions * @since 7 @@ -82,8 +75,8 @@ export interface ReqPermissionDetail { * @name Obtains configuration information about a bundle * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework - * @permission NA - * + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager.BundleInfo */ export interface BundleInfo { /** @@ -249,11 +242,4 @@ export interface BundleInfo { * @syscap SystemCapability.BundleManager.BundleFramework */ readonly reqPermissionStates: Array; - - /** - * @default Obtains configuration information about an ability - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly extensionAbilityInfo: Array; } diff --git a/api/bundle/bundleInstaller.d.ts b/api/bundle/bundleInstaller.d.ts index a2e31165f8399857295d904a3bae7aa1c19a3f5d..f5c0832d0f4acb6384ca404e29e5206606b66719 100644 --- a/api/bundle/bundleInstaller.d.ts +++ b/api/bundle/bundleInstaller.d.ts @@ -16,41 +16,21 @@ import { AsyncCallback } from './../basic'; import bundle from './../@ohos.bundle'; -/** - * @name Provides parameters required for hashParam. - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @permission NA - * @systemapi Hide this for inner system use - */ - export interface HashParam { - /** - * @default Indicates the moduleName - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - moduleName: string; - - /** - * @default Indicates the hash value - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - hashValue: string; -} - /** * @name Provides parameters required for installing or uninstalling an application. * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework - * @permission NA * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead ohos.bundle.installer#InstallParam */ export interface InstallParam { /** * @default Indicates the user id * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework + * @deprecated since 9 + * @useinstead ohos.bundle.installer.InstallParam#userId */ userId: number; @@ -58,6 +38,8 @@ export interface InstallParam { * @default Indicates the install flag * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework + * @deprecated since 9 + * @useinstead ohos.bundle.installer.InstallParam#installFlag */ installFlag: number; @@ -65,30 +47,18 @@ export interface InstallParam { * @default Indicates whether the param has data * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework + * @deprecated since 9 + * @useinstead ohos.bundle.installer.InstallParam#isKeepData */ isKeepData: boolean; - - /** - * @default Indicates the hash params - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - hashParams?: Array; - - /** - * @default Indicates the deadline of the crowdtesting bundle - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - crowdtestDeadline?: number; } /** * @name Indicates the install or uninstall status * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework - * @permission NA * @systemapi Hide this for inner system use + * @deprecated since 9 */ export interface InstallStatus { @@ -96,6 +66,7 @@ export interface InstallStatus { * @default Indicates the install or uninstall error code * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework + * @deprecated since 9 */ status: bundle.InstallErrorCode; @@ -103,6 +74,7 @@ export interface InstallStatus { * @default Indicates the install or uninstall result string message * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework + * @deprecated since 9 */ statusMessage: string; } @@ -111,8 +83,9 @@ export interface InstallStatus { * @name Offers install, upgrade, and remove bundles on the devices. * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework - * @permission NA * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead ohos.bundle.installer#BundleInstaller */ export interface BundleInstaller { /** @@ -123,9 +96,11 @@ export interface BundleInstaller { * * @param bundleFilePaths Indicates the path where the bundle of the application is stored. The path should be the * relative path to the data directory of the current application. - * @param installParam Indicates other parameters required for the installation. - * @return InstallStatus + * @param param Indicates other parameters required for the installation. + * @returns InstallStatus * @permission ohos.permission.INSTALL_BUNDLE + * @deprecated since 9 + * @useinstead ohos.bundle.installer.BundleInstaller#install */ install(bundleFilePaths: Array, param: InstallParam, callback: AsyncCallback): void; @@ -136,9 +111,11 @@ export interface BundleInstaller { * @syscap SystemCapability.BundleManager.BundleFramework * * @param bundleName Indicates the bundle name of the application to be uninstalled. - * @param installParam Indicates other parameters required for the uninstallation. - * @return InstallStatus + * @param param Indicates other parameters required for the uninstall. + * @returns InstallStatus * @permission ohos.permission.INSTALL_BUNDLE + * @deprecated since 9 + * @useinstead ohos.bundle.installer.BundleInstaller#uninstall */ uninstall(bundleName: string, param: InstallParam, callback: AsyncCallback): void; @@ -149,10 +126,12 @@ export interface BundleInstaller { * @syscap SystemCapability.BundleManager.BundleFramework * * @param bundleName Indicates the bundle name of the application to be recovered. - * @param installParam Indicates other parameters required for the recover. - * @return InstallStatus + * @param param Indicates other parameters required for the recover. + * @returns InstallStatus * @permission ohos.permission.INSTALL_BUNDLE * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead ohos.bundle.installer.BundleInstaller#recover */ recover(bundleName: string, param: InstallParam, callback: AsyncCallback): void; } \ No newline at end of file diff --git a/api/bundle/bundleStatusCallback.d.ts b/api/bundle/bundleStatusCallback.d.ts index b5c4d368583d4bffdefc1f34d8fe4d41654cdf0c..7b1a2107dc6b3e194765b94cfc43a1b40822d320 100644 --- a/api/bundle/bundleStatusCallback.d.ts +++ b/api/bundle/bundleStatusCallback.d.ts @@ -23,6 +23,7 @@ * * @permission ohos.permission.LISTEN_BUNDLE_CHANGE * @systemapi Hide this for inner system use + * @deprecated since 9 */ export interface BundleStatusCallback { /** diff --git a/api/bundle/customizeData.d.ts b/api/bundle/customizeData.d.ts index 4427daf06140214d97ac34ea92efb612e3812218..8eb7c2f5faa78d381a39fcb5fbaf086e9a697441 100644 --- a/api/bundle/customizeData.d.ts +++ b/api/bundle/customizeData.d.ts @@ -17,7 +17,8 @@ * @name Indicates the custom metadata * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework - * @permission NA + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager.Metadata * */ export interface CustomizeData { @@ -27,14 +28,14 @@ * @syscap SystemCapability.BundleManager.BundleFramework */ name: string; - + /** * @default Indicates the custom metadata value * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework */ value: string; - + /** * @default Indicates the custom metadata resource * @since 8 diff --git a/api/bundle/elementName.d.ts b/api/bundle/elementName.d.ts index 3eeff9218e709706e4821e0a0b66f6186e924396..662559af6f29f9e9949185e8b900d3470dab8948 100644 --- a/api/bundle/elementName.d.ts +++ b/api/bundle/elementName.d.ts @@ -20,8 +20,8 @@ * @name Contains basic Ability information, which uniquely identifies an ability * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework - * - * @permission N/A + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager.ElementName */ export interface ElementName { /** @@ -68,13 +68,4 @@ * @syscap SystemCapability.BundleManager.BundleFramework */ shortName?: string; - - /** - * module name - * @default - - * - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - moduleName?: string; } diff --git a/api/bundle/hapModuleInfo.d.ts b/api/bundle/hapModuleInfo.d.ts index 5ed5be922e699bba39e878bdec513cbdfba1df67..c544a57d256fde9e42851bdb9cd10454fc16b1bd 100644 --- a/api/bundle/hapModuleInfo.d.ts +++ b/api/bundle/hapModuleInfo.d.ts @@ -14,15 +14,13 @@ */ import { AbilityInfo } from "./abilityInfo"; -import { ExtensionAbilityInfo } from "./extensionAbilityInfo"; -import { Metadata } from './metadata' /** * @name Obtains configuration information about an module. * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework - * @permission NA - * + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager.HapModuleInfo */ export interface HapModuleInfo { /** @@ -115,31 +113,4 @@ export interface HapModuleInfo { * @syscap SystemCapability.BundleManager.BundleFramework */ readonly installationFree: boolean; - - /** - * @default Indicates main elementName of the module - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly mainElementName: string; - - /** - * @default Obtains configuration information about extension ability - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly extensionAbilityInfo: Array; - /** - * @default Indicates the metadata of ability - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * - */ - readonly metadata: Array; - /** - * @default Indicates the hash value of the module - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly hashValue: string; } \ No newline at end of file diff --git a/api/bundle/launcherAbilityInfo.d.ts b/api/bundle/launcherAbilityInfo.d.ts index a73f3ce63f7f6ffc9a3a054479a95437c99d0e72..62bfc257a50bba539b492fa0647c9deb02a0ade8 100644 --- a/api/bundle/launcherAbilityInfo.d.ts +++ b/api/bundle/launcherAbilityInfo.d.ts @@ -23,17 +23,15 @@ import { ElementName } from './elementName' * @name Contains basic launcher Ability information, which uniquely identifies an LauncherAbilityInfo * @since 8 * @syscap SystemCapability.BundleManager.BundleFramework - * - * @permission N/A * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager.LauncherAbilityInfo */ export interface LauncherAbilityInfo { /** * @name Obtains application info information about an launcher ability. * @since 8 * @syscap SystemCapability.BundleManager.BundleFramework - * @permission NA - * */ readonly applicationInfo: ApplicationInfo; @@ -41,8 +39,6 @@ export interface LauncherAbilityInfo { * @name Obtains element name about an launcher ability. * @since 8 * @syscap SystemCapability.BundleManager.BundleFramework - * @permission NA - * */ readonly elementName : ElementName; @@ -50,8 +46,6 @@ export interface LauncherAbilityInfo { * @name Obtains labelId about an launcher ability. * @since 8 * @syscap SystemCapability.BundleManager.BundleFramework - * @permission NA - * */ readonly labelId: number; @@ -59,8 +53,6 @@ export interface LauncherAbilityInfo { * @name Obtains iconId about an launcher ability. * @since 8 * @syscap SystemCapability.BundleManager.BundleFramework - * @permission NA - * */ readonly iconId: number; @@ -68,8 +60,6 @@ export interface LauncherAbilityInfo { * @name Obtains userId about an launcher ability. * @since 8 * @syscap SystemCapability.BundleManager.BundleFramework - * @permission NA - * */ readonly userId: number; @@ -77,8 +67,6 @@ export interface LauncherAbilityInfo { * @name Obtains installTime about an launcher ability. * @since 8 * @syscap SystemCapability.BundleManager.BundleFramework - * @permission NA - * */ readonly installTime : number; } diff --git a/api/bundle/moduleInfo.d.ts b/api/bundle/moduleInfo.d.ts index f961a10b9d6cabbadef869709aaa1a848f860e43..0f504cb0bbcdb24e13f6cb6871bb01ec336cdeef 100644 --- a/api/bundle/moduleInfo.d.ts +++ b/api/bundle/moduleInfo.d.ts @@ -17,8 +17,8 @@ * @name Stores module information about an application. * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework - * @permission NA - * + * @deprecated since 9 + * @useinstead ohos.bundle.bundleManager.HapModuleInfo */ export interface ModuleInfo { /** diff --git a/api/bundle/packInfo.d.ts b/api/bundle/packInfo.d.ts deleted file mode 100644 index 1c4a45903d8717db95af7b2fc2ca5ae93fd72b60..0000000000000000000000000000000000000000 --- a/api/bundle/packInfo.d.ts +++ /dev/null @@ -1,389 +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. - */ - -/** - * @name The bundle pack info class. - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @systemapi hide this for inner system use - */ -export interface BundlePackInfo { - /** - * @default This contains package information in pack.info - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly packages: Array; - - /** - * @default This contains bundle summary information in pack.info - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly summary: PackageSummary; -} - -/** - * @name PackageConfig: the package info class. - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @systemapi hide this for inner system use - */ -export interface PackageConfig { - /** - * @default Indicates the device type of this package - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly deviceType: Array; - - /** - * @default Indicates the name of this package - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly name: string; - - /** - * @default Indicates the module type of this package - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly moduleType: string; - - /** - * @default Indicates whether this package is delivery and install - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly deliveryWithInstall: boolean; -} - -/** - * @name PackageSummary: the package summary class. - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @systemapi hide this for inner system use - */ -export interface PackageSummary { - /** - * @default Indicates the bundle config info of this package - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly app: BundleConfigInfo; - - /** - * @default Indicates the modules config info of this package - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly modules: Array; -} - -/** - * @name BundleConfigInfo: the bundle summary class. - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @systemapi hide this for inner system use - */ -export interface BundleConfigInfo { - /** - * @default Indicates the name of this bundle - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly bundleName: string; - - /** - * @default Indicates the bundle version - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly version: Version; -} - -/** - * @name ExtensionAbilities: the extension ability forms class. - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @systemapi hide this for inner system use - */ - export interface ExtensionAbilities { - /** - * @default Indicates the name of this extension ability - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly name: string; - - /** - * @default Indicates the ability forms info - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly forms: Array; -} - -/** - * @name ModuleConfigInfo: the module summary of a bundle. - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @systemapi hide this for inner system use - */ -export interface ModuleConfigInfo { - /** - * @default Indicates the api version - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly apiVersion: ApiVersion; - - /** - * @default Indicates the devices type - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly deviceType: Array; - - /** - * @default Indicates the module distro info - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly distro: ModuleDistroInfo; - - /** - * @default Indicates the abilities info of this module - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly abilities: Array; - - /** - * @default Indicates extension abilities info of this module - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly extensionAbilities: Array; -} - -/** - * @name ModuleDistroInfo: the bundle info summary class. - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @systemapi hide this for inner system use - */ -export interface ModuleDistroInfo { - /** - * @default Indicates the name of main ability - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly mainAbility: string; - - /** - * @default Indicates is delivery with install - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly deliveryWithInstall: boolean; - - /** - * @default Indicates is free install - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly installationFree: boolean; - - /** - * @default Indicates the module name - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly moduleName: string; - - /** - * @default Indicates the module type - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly moduleType: string; -} - -/** - * @name ModuleAbilityInfo: the ability info of a module. - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @systemapi hide this for inner system use - */ -export interface ModuleAbilityInfo { - /** - * @default Indicates the name of this module ability - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly name: string; - - /** - * @default Indicates the label of this module ability - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly label: string; - - /** - * @default Indicates is visible - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly visible: boolean; - - /** - * @default Indicates the ability forms info - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly forms: Array; -} - -/** - * @name AbilityFormInfo: the form info of an ability. - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @systemapi hide this for inner system use - */ -export interface AbilityFormInfo { - /** - * @default Indicates the name of this ability - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly name: string; - - /** - * @default Indicates the type of this ability - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly type: string; - - /** - * @default Indicates is enabled update - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly updateEnabled: boolean; - - /** - * @default Indicates the scheduled update time - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly scheduledUpdateTime: string; - - /** - * @default Indicates the update duration - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly updateDuration: number; - - /** - * @default Indicates the ability support dimensions - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly supportDimensions: Array; - - /** - * @default Indicates the ability default dimension - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly defaultDimension: number; -} - -/** - * @name Version: the bundle version class. - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @systemapi hide this for inner system use - */ -export interface Version { - /** - * @default Indicates the min compatible code of this version - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly minCompatibleVersionCode: number; - - /** - * @default Indicates the name of this version - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly name: string; - - /** - * @default Indicates the code of this version - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly code: number; -} - -/** - * @name ApiVersion: the bundle Api version class. - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @systemapi hide this for inner system use - */ -export interface ApiVersion { - /** - * @default Indicates the min compatible code of this version - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly releaseType: string; - - /** - * @default Indicates the name of this version - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly compatible: number; - - /** - * @default Indicates the code of this version - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly target: number; -} - -/** -* @name BundlePackFlag -* @since 9 -* @syscap SystemCapability.BundleManager.BundleFramework -* @import NA -* @systemapi hide this for inner system use -*/ -export enum BundlePackFlag { - GET_PACK_INFO_ALL = 0x00000000, - GET_PACKAGES = 0x00000001, - GET_BUNDLE_SUMMARY = 0x00000002, - GET_MODULE_SUMMARY = 0x00000004, -} \ No newline at end of file diff --git a/api/bundle/remoteAbilityInfo.d.ts b/api/bundle/remoteAbilityInfo.d.ts index e9a1585c266935fe61704347a15a25eaebd4ccb3..59e0630bd053e66d3751d351120820efd9065cb4 100644 --- a/api/bundle/remoteAbilityInfo.d.ts +++ b/api/bundle/remoteAbilityInfo.d.ts @@ -20,8 +20,8 @@ import { ElementName } from './elementName'; * @since 8 * @syscap SystemCapability.BundleManager.DistributedBundleFramework * @systemapi - * - * @permission N/A + * @deprecated since 9 + * @useinstead ohos.bundle.distributedBundle.RemoteAbilityInfo */ export interface RemoteAbilityInfo { /** @@ -30,14 +30,14 @@ export interface RemoteAbilityInfo { * @syscap SystemCapability.BundleManager.DistributedBundleFramework */ readonly elementName: ElementName; - + /** * @default Indicates the label of the ability * @since 8 * @syscap SystemCapability.BundleManager.DistributedBundleFramework */ readonly label: string; - + /** * @default Indicates the icon of the ability * @since 8 diff --git a/api/bundle/shortcutInfo.d.ts b/api/bundle/shortcutInfo.d.ts index 98c0a85563cd95a2dad1f72bd0a3305fe0fc7a15..747cebec72ea580e72de33d9fb8d12af3ab963b5 100644 --- a/api/bundle/shortcutInfo.d.ts +++ b/api/bundle/shortcutInfo.d.ts @@ -18,115 +18,93 @@ * bundle name, target module name and ability class name. * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework - * @permission NA * @systemapi Hide this for inner system use + * @deprecated since 9 + * @useinstead ohos.bundle.launcherBundleManager.ShortcutWant */ export interface ShortcutWant{ /** - * @default Indicates the target bundle of the shortcut want * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework */ readonly targetBundle: string; /** - * @default Indicates the target module of the shortcut want - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly targetModule: string; - /** - * @default Indicates the target class of the shortcut want * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework */ readonly targetClass: string; } - + /** * @name Provides information about a shortcut, including the shortcut ID and label. * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework - * @permission NA - * + * @deprecated since 9 + * @useinstead ohos.bundle.launcherBundleManager.ShortcutInfo */ export interface ShortcutInfo { /** - * @default Indicates the ID of the application to which this shortcut belongs * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework + * */ readonly id: string; /** - * @default Indicates the name of the bundle containing the shortcut * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework */ readonly bundleName: string; /** - * @default Indicates the host ability of the shortcut * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework */ readonly hostAbility: string; /** - * @default Indicates the icon of the shortcut * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework */ readonly icon: string; /** - * @default Indicate s the icon id of the shortcut * @since 8 * @syscap SystemCapability.BundleManager.BundleFramework */ readonly iconId: number; /** - * @default Indicates the label of the shortcut * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework */ readonly label: string; /** - * @default Indicates the label id of the shortcut * @since 8 * @syscap SystemCapability.BundleManager.BundleFramework */ readonly labelId: number; /** - * @default Indicates the disableMessage of the shortcut * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework */ readonly disableMessage: string; /** - * @default Indicates the wants of the shortcut * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework */ readonly wants: Array; /** - * @default Indicates whether the shortcut is static + * @default false * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework */ readonly isStatic?: boolean /** - * @default Indicates whether the shortcut is homeshortcut + * @default false * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework */ readonly isHomeShortcut?: boolean; /** - * @default Indicates whether the shortcut is enabled + * @default false * @since 7 * @syscap SystemCapability.BundleManager.BundleFramework */ readonly isEnabled?: boolean; - - /** - * @default Indicates the moduleName of the shortcut - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly moduleName?: string; } \ No newline at end of file diff --git a/api/bundleManager/abilityInfo.d.ts b/api/bundleManager/abilityInfo.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5fe7f0a7bef5eb5713682e64d6d5613397922c1a --- /dev/null +++ b/api/bundleManager/abilityInfo.d.ts @@ -0,0 +1,278 @@ +/* + * 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 './applicationInfo'; +import { Metadata } from './metadata'; +import bundleManager from './../@ohos.bundle.bundleManager'; + +/** + * Obtains configuration information about an ability + * @typedef AbilityInfo + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ +export interface AbilityInfo { + /** + * Indicates the name of the bundle containing the ability + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly bundleName: string; + + /** + * Indicates the name of the .hap package to which the capability belongs + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly moduleName: string; + + /** + * Ability simplified class name + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly name: string; + + /** + * Indicates the label of the ability + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly label: string; + + /** + * Indicates the label id of the ability + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly labelId: number; + + /** + * Indicates the ability + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly description: string; + + /** + * Indicates the description id of the ability + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly descriptionId: number; + + /** + * Indicates the icon of the ability + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly icon: string; + + /** + * Indicates the icon id of the ability + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly iconId: number; + + /** + * Process of ability, if user do not set it, the value equal application process + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly process: string; + + /** + * Indicates whether an ability can be called by other abilities + * @type {boolean} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly isVisible: boolean; + + /** + * Enumerates types of templates that can be used by an ability + * @type {bundleManager.AbilityType} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @FAModelOnly + * @since 9 + */ + readonly type: bundleManager.AbilityType; + + /** + * Enumerates ability display orientations + * @type {bundleManager.DisplayOrientation} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly orientation: bundleManager.DisplayOrientation; + + /** + * Enumerates ability launch type + * @type {bundleManager.LaunchType} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly launchType: bundleManager.LaunchType; + + /** + * The permissions that others need to launch this ability + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly permissions: Array; + + /** + * Indicates the permission required for reading ability data + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @FAModelOnly + * @since 9 + */ + readonly readPermission: string; + + /** + * Indicates the permission required for writing data to the ability + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @FAModelOnly + * @since 9 + */ + readonly writePermission: string; + + /** + * Uri of ability + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @FAModelOnly + * @since 9 + */ + readonly uri: string; + + /** + * The device types that this ability can run on + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly deviceTypes: Array; + + /** + * Obtains configuration information about an application + * @type {ApplicationInfo} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly applicationInfo: ApplicationInfo; + + /** + * Indicates the metadata of ability + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly metadata: Array; + + /** + * Indicates whether the ability is enabled + * @type {boolean} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly enabled: boolean; + + /** + * Indicates which window mode is supported + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly supportWindowModes: Array; + + /** + * Indicates window size + * @type {WindowSize} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly windowSize: WindowSize; +} + +/** + * Indicates the window size. + * @typedef WindowSize + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ +export interface WindowSize { + /** + * Indicates maximum ratio of width over height of window under free window status. + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly maxWindowRatio: number; + + /** + * Indicates minimum ratio of width over height of window under free window status. + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly minWindowRatio: number; + + /** + * Indicates maximum width of window under free window status. + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly maxWindowWidth: number; + + /** + * Indicates minimum width of window under free window status. + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly minWindowWidth: number; + + /** + * Indicates maximum height of window under free window status. + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly maxWindowHeight: number; + + /** + * Indicates minimum height of window under free window status. + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly minWindowHeight: number; +} diff --git a/api/bundleManager/applicationInfo.d.ts b/api/bundleManager/applicationInfo.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..881fb3c9aaf66e413173852f4f5f79644ea359ce --- /dev/null +++ b/api/bundleManager/applicationInfo.d.ts @@ -0,0 +1,193 @@ +/* + * 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 { Metadata } from './metadata'; +import { Resource } from '../global/resource'; + +/** + * Obtains configuration information about an application + * @typedef ApplicationInfo + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ +export interface ApplicationInfo { + /** + * Indicates the application name, which is the same as {@code bundleName} + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly name: string; + + /** + * Description of application + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly description: string; + + /** + * Indicates the description id of the application + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly descriptionId: number; + + /** + * Indicates whether or not this application may be instantiated + * @type {boolean} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly enabled: boolean; + + /** + * Indicates the label of the application + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly label: string; + + /** + * Indicates the label id of the application + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly labelId: number; + + /** + * Indicates the icon of the application + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly icon: string; + + /** + * Indicates the icon id of the application + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly iconId: number; + + /** + * Process of application, if user do not set it ,the value equal bundleName + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly process: string; + + /** + * Indicates the permissions required for accessing the application. + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly permissions: Array; + + /** + * Indicates the path where the {@code Entry.hap} file of the application is saved + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly entryDir: string; + + /** + * Indicates the application source code path + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly codePath: string; + + /** + * Indicates the metadata of module + * @type {Map>} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly metadata: Map>; + + /** + * Indicates whether or not this application may be removable + * @type {boolean} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly removable: boolean; + + /** + * Indicates the access token of the application + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly accessTokenId: number; + + /** + * Indicates the uid of the application + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly uid: number; + + /** + * Indicates icon resource of the application + * @type {Resource} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly iconResource: Resource; + + /** + * Indicates label resource of the application + * @type {Resource} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly labelResource: Resource; + + /** + * Indicates description resource of the application + * @type {Resource} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly descriptionResource: Resource; + + /** + * Indicates the appDistributionType of the application + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly appDistributionType: string; + + /** + * Indicates the appProvisionType of the application + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly appProvisionType: string; +} diff --git a/api/bundleManager/bundleInfo.d.ts b/api/bundleManager/bundleInfo.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a594847041883d385078623de4fc1b943d74a10f --- /dev/null +++ b/api/bundleManager/bundleInfo.d.ts @@ -0,0 +1,219 @@ +/* + * 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 './applicationInfo'; +import { HapModuleInfo } from './hapModuleInfo'; +import bundleManager from './../@ohos.bundle.bundleManager'; + +/** + * Obtains configuration information about a bundle + * @typedef BundleInfo + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ +export interface BundleInfo { + /** + * Indicates the name of this bundle + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly name: string; + + /** + * Indicates the bundle vendor + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly vendor: string; + + /** + * Indicates the version code of the bundle + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly versionCode: number; + + /** + * Indicates the version name of the bundle + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly versionName: string; + + /** + * Indicates the **minimum ** version compatible with the bundle + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly minCompatibleVersionCode: number; + + /** + * Indicates the target version number of the bundle + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly targetVersion: number; + + /** + * Obtains configuration information about an application + * @type {ApplicationInfo} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly appInfo: ApplicationInfo; + + /** + * Obtains configuration information about an module + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly hapModulesInfo: Array; + + /** + * Indicates the required permissions details defined in file config.json + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly reqPermissionDetails: Array; + + /** + * Indicates the grant state of required permissions + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly permissionGrantStates: Array; + + /** + * Indicates the SignatureInfo of the bundle + * @type {SignatureInfo} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly signatureInfo: SignatureInfo; + + /** + * Indicates the hap install time + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly installTime: number; + + /** + * Indicates the hap update time + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly updateTime: number; +} + +/** + * Indicates the required permissions details defined in configuration file + * @typedef ReqPermissionDetail + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ +export interface ReqPermissionDetail { + /** + * Indicates the name of this required permissions + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + name: string; + + /** + * Indicates the reason of this required permissions + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + reason: string; + + /** + * Indicates the reason id of this required permissions + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + reasonId: number; + + /** + * Indicates the used scene of this required permissions + * @type {UsedScene} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + usedScene: UsedScene; +} + +/** + * The scene which is used + * @typedef UsedScene + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ +export interface UsedScene { + /** + * Indicates the abilities that need the permission + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + abilities: Array; + + /** + * Indicates the time when the permission is used + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + when: string; +} + +/** + * Indicates SignatureInfo + * @typedef SignatureInfo + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ +export interface SignatureInfo { + /** + * Indicates the ID of the application to which this bundle belongs + * The application ID uniquely identifies an application. It is determined by the bundle name and signature + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly appId: string; + + /** + * Indicates the fingerprint of the certificate + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly fingerprint: string; +} \ No newline at end of file diff --git a/api/bundleManager/dispatchInfo.d.ts b/api/bundleManager/dispatchInfo.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9f734e8d903d5222890df5df87f122d764a581c3 --- /dev/null +++ b/api/bundleManager/dispatchInfo.d.ts @@ -0,0 +1,37 @@ +/* + * 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. + */ + +/** + * Dispatch info related to free install + * @typedef DispatchInfo + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ +export interface DispatchInfo { + /** + * Indicates the dispatchInfo version + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly version: string; + + /** + * Indicates the free install interface version + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly dispatchAPIVersion: string; +} diff --git a/api/bundleManager/elementName.d.ts b/api/bundleManager/elementName.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..612986c3e584c2d5a30605b1d5c28ae6340bf63b --- /dev/null +++ b/api/bundleManager/elementName.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. + */ + +/** + * Contains basic Ability information, which uniquely identifies an ability. + * You can use this class to obtain values of the fields set in an element, + * such as the device ID, bundle name, and ability name. + * @typedef ElementName + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ +export interface ElementName { + /** + * Indicates device id + * @type {?string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + deviceId?: string; + + /** + * @default Indicates bundle name + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + bundleName: string; + + /** + * @default Indicates module name + * @type {?string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + moduleName?: string; + + /** + * Indicates ability name + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + abilityName: string; + + /** + * Indicates uri + * @type {?string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + uri?: string; + + /** + * Indicates short name + * @type {?string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + shortName?: string; +} diff --git a/api/bundle/extensionAbilityInfo.d.ts b/api/bundleManager/extensionAbilityInfo.d.ts similarity index 30% rename from api/bundle/extensionAbilityInfo.d.ts rename to api/bundleManager/extensionAbilityInfo.d.ts index c533ad6dc54b7aab9eb928e0b6be0940c01001f5..e6eaf60187c13976423ebae23e18ae3c7adf2bc0 100644 --- a/api/bundle/extensionAbilityInfo.d.ts +++ b/api/bundleManager/extensionAbilityInfo.d.ts @@ -1,125 +1,138 @@ -/* - * 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 { ApplicationInfo } from './applicationInfo'; -import { Metadata } from './metadata' -import bundle from './../@ohos.bundle'; - -/** - * @name Obtains extension information about a bundle - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @permission NA - * - */ -export interface ExtensionAbilityInfo { - /** - * @default Indicates the name of the bundle - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly bundleName: string; - - /** - * @default Indicates the name of the module - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly moduleName: string; - - /** - * @default Indicates the name of the extension info - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly name: string; - - /** - * @default Indicates the label id of the entension info - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly labelId: number; - - /** - * @default Indicates the description id of the entension info - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly descriptionId: number; - - /** - * @default Indicates the icon id of the entension info - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly iconId: number; - - /** - * @default Indicates whether the entensionInfo can be visible or not - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly isVisible: boolean; - - /** - * @default Enumerates types of the entension info - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly extensionAbilityType: bundle.ExtensionAbilityType; - - /** - * @default The permissions that others need to use this extension info - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly permissions: Array; - - /** - * @default Obtains configuration information about an application - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly applicationInfo: ApplicationInfo; - - /** - * @default Indicates the metadata of bundle - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly metadata: Array; - - /** - * @default Indicates the src language to express extension info - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly enabled: boolean; - - /** - * @default Indicates the read permission extension ability info - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly readPermission: string; - - /** - * @default Indicates the write permission of extension ability info - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - readonly writePermission: string; -} +/* + * 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 './applicationInfo'; +import { Metadata } from './metadata'; +import bundleManager from './../@ohos.bundle.bundleManager'; + +/** + * Extension information about a bundle + * @typedef ExtensionAbilityInfo + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ +export interface ExtensionAbilityInfo { + /** + * Indicates the name of the bundle + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly bundleName: string; + + /** + * Indicates the name of the module + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly moduleName: string; + + /** + * Indicates the name of the extension ability info + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly name: string; + + /** + * Indicates the label id of the extension ability info + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly labelId: number; + + /** + * Indicates the description id of the extension ability info + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly descriptionId: number; + + /** + * Indicates the icon id of the extension ability info + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly iconId: number; + + /** + * Indicates whether the extension ability info can be visible or not + * @type {boolean} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly isVisible: boolean; + + /** + * Enumerates types of the extension ability info + * @type {bundleManager.ExtensionAbilityType} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly extensionAbilityType: bundleManager.ExtensionAbilityType; + + /** + * The permissions that others need to use this extension ability info + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly permissions: Array; + + /** + * Obtains configuration information about an application + * @type {ApplicationInfo} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly applicationInfo: ApplicationInfo; + + /** + * Indicates the metadata of bundle + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly metadata: Array; + + /** + * Indicates the src language to express extension ability info + * @type {boolean} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly enabled: boolean; + + /** + * Indicates the read permission extension ability info + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly readPermission: string; + + /** + * Indicates the write permission of extension ability info + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly writePermission: string; +} diff --git a/api/bundleManager/hapModuleInfo.d.ts b/api/bundleManager/hapModuleInfo.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6d54b5110297cf7fd003292ee33fe50eae06d1e4 --- /dev/null +++ b/api/bundleManager/hapModuleInfo.d.ts @@ -0,0 +1,146 @@ +/* + * 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 { AbilityInfo } from "./abilityInfo"; +import { ExtensionAbilityInfo } from "./extensionAbilityInfo"; +import { Metadata } from './metadata' + +/** + * Obtains configuration information about a hap module. + * @typedef HapModuleInfo + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ +export interface HapModuleInfo { + /** + * Indicates the name of this hap module + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly name: string; + + /** + * Indicates the icon of this hap module + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly icon: string; + + /** + * Indicates the icon id of this hap module + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly iconId: number; + + /** + * Indicates the label of this hap module + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly label: string; + + /** + * Indicates the label id of this hap module + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly labelId: number; + + /** + * Describes the hap module + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly description: string; + + /** + * Indicates the description of this hap module + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly descriptionId: number; + + /** + * Indicates main elementName of the hap module + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly mainElementName: string; + + /** + * Obtains configuration information about abilities + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly abilitiesInfo: Array; + + /** + * Obtains configuration information about extension abilities + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly extensionAbilitiesInfo: Array; + + /** + * Indicates the metadata of ability + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly metadata: Array; + + /** + * The device types that this hap module can run on + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly deviceTypes: Array; + + /** + * Indicates whether free installation of the hap module is supported + * @type {boolean} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly installationFree: boolean; + + /** + * Indicates the hash value of the hap module + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly hashValue: string; + + /** + * Indicates the module source dir of this hap module + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly moduleSourceDir: string; +} diff --git a/api/bundleManager/launcherAbilityInfo.d.ts b/api/bundleManager/launcherAbilityInfo.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0fb9f55e8b02fa4bcd2d4b5d5d54dfeed2d22b2b --- /dev/null +++ b/api/bundleManager/launcherAbilityInfo.d.ts @@ -0,0 +1,74 @@ +/* + * 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 './applicationInfo'; +import { ElementName } from './elementName' + +/** + * Contains basic launcher Ability information, which uniquely identifies an LauncherAbilityInfo + * @typedef LauncherAbilityInfo + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @systemapi + * @since 9 + */ +export interface LauncherAbilityInfo { + /** + * Obtains application info information about an launcher ability. + * @type {ApplicationInfo} + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @since 9 + */ + readonly applicationInfo: ApplicationInfo; + + /** + * Obtains element name about an launcher ability. + * @type {ElementName} + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @since 9 + */ + readonly elementName : ElementName; + + /** + * Obtains labelId about an launcher ability. + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @since 9 + */ + readonly labelId: number; + + /** + * Obtains iconId about an launcher ability. + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @since 9 + */ + readonly iconId: number; + + /** + * Obtains userId about an launcher ability. + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @since 9 + */ + readonly userId: number; + + /** + * Obtains installTime about an launcher ability. + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @since 9 + */ + readonly installTime : number; +} diff --git a/api/bundle/metadata.d.ts b/api/bundleManager/metadata.d.ts similarity index 57% rename from api/bundle/metadata.d.ts rename to api/bundleManager/metadata.d.ts index 4fba45c5348ca3d4806cf46783ba4570b1c7e6c3..4a9e28b748dea9e328f98ea442c9b553cae3b07e 100644 --- a/api/bundle/metadata.d.ts +++ b/api/bundleManager/metadata.d.ts @@ -1,44 +1,46 @@ -/* - * 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 Indicates the Metadata - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - * @permission NA - * - */ - export interface Metadata { - /** - * @default Indicates the metadata name - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - name: string; - - /** - * @default Indicates the metadata value - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - value: string; - - /** - * @default Indicates the metadata resource - * @since 9 - * @syscap SystemCapability.BundleManager.BundleFramework - */ - resource: string; +/* + * 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. + */ + + /** + * Indicates the Metadata + * @typedef Metadata + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + export interface Metadata { + /** + * Indicates the metadata name + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + name: string; + + /** + * Indicates the metadata value + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + value: string; + + /** + * Indicates the metadata resource + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + resource: string; } \ No newline at end of file diff --git a/api/bundleManager/packInfo.d.ts b/api/bundleManager/packInfo.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8c5a359d3906784fb28680b5c97bbf207a45c559 --- /dev/null +++ b/api/bundleManager/packInfo.d.ts @@ -0,0 +1,425 @@ +/* + * 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 bundle pack info class. + * @typedef BundlePackInfo + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ +export interface BundlePackInfo { + /** + * This contains package information in pack.info + * @type {PackageConfig} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly packages: Array; + + /** + * This contains bundle summary information in pack.info + * @type {PackageSummary} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly summary: PackageSummary; +} + +/** + * PackageConfig: the package info class. + * @typedef PackageConfig + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ +export interface PackageConfig { + /** + * Indicates the device types of this package + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly deviceTypes: Array; + + /** + * Indicates the name of this package + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly name: string; + + /** + * Indicates the module type of this package + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly moduleType: string; + + /** + * Indicates whether this package is delivery and install + * @type {boolean} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly deliveryWithInstall: boolean; +} + +/** + * PackageSummary: the package summary class. + * @typedef PackageSummary + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ +export interface PackageSummary { + /** + * Indicates the bundle config info of this package + * @type {BundleConfigInfo} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly app: BundleConfigInfo; + + /** + * Indicates the modules config info of this package + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly modules: Array; +} + +/** + * BundleConfigInfo: the bundle summary class. + * @typedef BundleConfigInfo + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ +export interface BundleConfigInfo { + /** + * Indicates the name of this bundle + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly bundleName: string; + + /** + * Indicates the bundle version + * @type {Version} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly version: Version; +} + +/** + * ExtensionAbility: the extension ability forms class. + * @typedef ExtensionAbility + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ + export interface ExtensionAbility { + /** + * Indicates the name of this extension ability + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly name: string; + + /** + * Indicates the ability forms info + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly forms: Array; +} + +/** + * ModuleConfigInfo: the module summary of a bundle. + * @typedef ModuleConfigInfo + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ +export interface ModuleConfigInfo { + /** + * Indicates the name of main ability + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly mainAbility: string; + + /** + * Indicates the api version + * @type {ApiVersion} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly apiVersion: ApiVersion; + + /** + * Indicates the devices type + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly deviceTypes: Array; + + /** + * Indicates the module distro info + * @type {ModuleDistroInfo} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly distro: ModuleDistroInfo; + + /** + * Indicates the abilities info of this module + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly abilities: Array; + + /** + * Indicates extension abilities info of this module + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly extensionAbilities: Array; +} + +/** + * ModuleDistroInfo: the bundle info summary class. + * @typedef ModuleDistroInfo + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ +export interface ModuleDistroInfo { + /** + * Indicates whether this package is delivered with install + * @type {boolean} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly deliveryWithInstall: boolean; + + /** + * Indicates whether this package is free install + * @type {boolean} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly installationFree: boolean; + + /** + * Indicates the module name + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly moduleName: string; + + /** + * Indicates the module type + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly moduleType: string; +} + +/** + * ModuleAbilityInfo: the ability info of a module. + * @typedef ModuleAbilityInfo + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ +export interface ModuleAbilityInfo { + /** + * Indicates the name of this module ability + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly name: string; + + /** + * Indicates the label of this module ability + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly label: string; + + /** + * Indicates whether this ability is visible + * @type {boolean} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly visible: boolean; + + /** + * Indicates the ability forms info + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly forms: Array; +} + +/** + * AbilityFormInfo: the form info of an ability. + * @typedef AbilityFormInfo + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ +export interface AbilityFormInfo { + /** + * Indicates the name of this ability + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly name: string; + + /** + * Indicates the type of this ability + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly type: string; + + /** + * Indicates whether this form is enabled update + * @type {boolean} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly updateEnabled: boolean; + + /** + * Indicates the scheduled update time + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly scheduledUpdateTime: string; + + /** + * Indicates the update duration + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly updateDuration: number; + + /** + * Indicates the ability support dimensions + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly supportDimensions: Array; + + /** + * Indicates the ability default dimension + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly defaultDimension: string; +} + +/** + * Version: the bundle version class. + * @typedef Version + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ +export interface Version { + /** + * Indicates the min compatible code of this version + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly minCompatibleVersionCode: number; + + /** + * Indicates the name of this version + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly name: string; + + /** + * Indicates the code of this version + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly code: number; +} + +/** + * ApiVersion: the bundle Api version class. + * @typedef ApiVersion + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @systemapi + * @since 9 + */ +export interface ApiVersion { + /** + * Indicates the release type of the api + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly releaseType: string; + + /** + * Indicates the compatible version code of the api + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly compatible: number; + + /** + * Indicates the target version code of the api + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.FreeInstall + * @since 9 + */ + readonly target: number; +} diff --git a/api/bundleManager/permissionDef.d.ts b/api/bundleManager/permissionDef.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..56aa968b62463e2edf6464d5dd655f2fd6686642 --- /dev/null +++ b/api/bundleManager/permissionDef.d.ts @@ -0,0 +1,55 @@ +/* + * 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. + */ + +/** + * Indicates the defined permission details in file config.json + * @typedef PermissionDef + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @systemapi + * @since 9 + */ + export interface PermissionDef { + /** + * Indicates the name of this permission + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly permissionName: string; + + /** + * Indicates the grant mode of this permission + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly grantMode: number; + + /** + * Indicates the labelId of this permission + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly labelId: number; + + /** + * Indicates the descriptionId of this permission + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Core + * @since 9 + */ + readonly descriptionId: number; + } \ No newline at end of file diff --git a/api/bundleManager/remoteAbilityInfo.d.ts b/api/bundleManager/remoteAbilityInfo.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..16b91e764145cafa3951ae58a554bee555f6f55c --- /dev/null +++ b/api/bundleManager/remoteAbilityInfo.d.ts @@ -0,0 +1,49 @@ +/* + * 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 { ElementName } from './elementName'; + +/** + * Contains basic remote ability information. + * @typedef RemoteAbilityInfo + * @syscap SystemCapability.BundleManager.DistributedBundleFramework + * @systemapi + * @since 9 + */ +export interface RemoteAbilityInfo { + /** + * Indicates the ability information + * @type {ElementName} + * @syscap SystemCapability.BundleManager.DistributedBundleFramework + * @since 9 + */ + readonly elementName: ElementName; + + /** + * Indicates the label of the ability + * @type {string} + * @syscap SystemCapability.BundleManager.DistributedBundleFramework + * @since 9 + */ + readonly label: string; + + /** + * Indicates the icon of the ability + * @type {string} + * @syscap SystemCapability.BundleManager.DistributedBundleFramework + * @since 9 + */ + readonly icon: string; +} \ No newline at end of file diff --git a/api/bundleManager/shortcutInfo.d.ts b/api/bundleManager/shortcutInfo.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..85d95df447e10a1fe86fee2325b9fdef637c8e8c --- /dev/null +++ b/api/bundleManager/shortcutInfo.d.ts @@ -0,0 +1,128 @@ +/* + * 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. + */ + +/** + * Provides information about a shortcut, including the shortcut ID and label. + * @typedef ShortcutInfo + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @systemapi + * @since 9 + */ + export interface ShortcutInfo { + /** + * Indicates the ID of the application to which this shortcut belongs + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @since 9 + */ + readonly id: string; + + /** + * Indicates the name of the bundle containing the shortcut + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @since 9 + */ + readonly bundleName: string; + + /** + * Indicates the moduleName of the shortcut + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @since 9 + */ + readonly moduleName: string; + + /** + * Indicates the host ability of the shortcut + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @since 9 + */ + readonly hostAbility: string; + + /** + * Indicates the icon of the shortcut + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @since 9 + */ + readonly icon: string; + + /** + * Indicates the icon id of the shortcut + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @since 9 + */ + readonly iconId: number; + + /** + * Indicates the label of the shortcut + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @since 9 + */ + readonly label: string; + + /** + * Indicates the label id of the shortcut + * @type {number} + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @since 9 + */ + readonly labelId: number; + + /** + * Indicates the wants of the shortcut + * @type {Array} + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @since 9 + */ + readonly wants: Array; + } + + /** + * Obtains information about the ability that a shortcut will start. + * @typedef ShortcutWant + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @systemapi + * @since 9 + */ + export interface ShortcutWant{ + /** + * Indicates the target bundle of the shortcut want + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @since 9 + */ + readonly targetBundle: string; + + /** + * Indicates the target module of the shortcut want + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @since 9 + */ + readonly targetModule: string; + + /** + * Indicates the target ability of the shortcut want + * @type {string} + * @syscap SystemCapability.BundleManager.BundleFramework.Launcher + * @since 9 + */ + readonly targetAbility: string; + } \ No newline at end of file diff --git a/api/common/full/dom.d.ts b/api/common/full/dom.d.ts index 6d9ea5aeeae658167606152d6a6901a1c23cbc0f..96a2cb5dbddc74170f484cfe6e9f70ba157f18d5 100644 --- a/api/common/full/dom.d.ts +++ b/api/common/full/dom.d.ts @@ -21,7 +21,7 @@ import { Element } from './viewmodel'; */ export declare class dom { /** - * create a dynamic dom by tag, rturn element + * create a dynamic dom by tag, return element * @param tag dom tag * @since 8 */ diff --git a/api/common/full/featureability.d.ts b/api/common/full/featureability.d.ts index 308fe6727fcb950dc4dbca24a0903ee0bf81b448..4a120bfcfc1c1692609f31650edb7886a2ac036c 100644 --- a/api/common/full/featureability.d.ts +++ b/api/common/full/featureability.d.ts @@ -44,7 +44,7 @@ export interface SubscribeMessageResponse { deviceId: string; /** - * Name of the bundle where the peer ability locates. The name is case sensitive. + * Name of the bundle where the peer ability has been located. The name is case sensitive. * @since 5 */ bundleName: string; @@ -68,7 +68,7 @@ export interface SubscribeMessageResponse { */ export interface CallAbilityParam { /** - * Name of the bundle where the ability locates. The name is case sensitive and must be the same as that on the AA side. + * Name of the bundle where the ability has been located. The name is case sensitive and must be the same as that on the AA side. * @since 5 */ bundleName: string; @@ -114,7 +114,7 @@ export interface CallAbilityParam { */ export interface SubscribeAbilityEventParam { /** - * Name of the bundle where the ability locates. The name is case sensitive and must be the same as that on the AA side. + * Name of the bundle where the ability has been located. The name is case sensitive and must be the same as that on the AA side. * @since 5 */ bundleName: string; @@ -161,7 +161,7 @@ export interface SendMessageOptions { deviceId: string; /** - * Name of the destination bundle where the ability locates. The name is case sensitive. + * Name of the destination bundle where the ability has been located. The name is case sensitive. * @since 5 */ bundleName: string; @@ -295,6 +295,7 @@ export interface FinishWithResultParams { /** * @since 5 * @deprecated since 8 + * @useinstead ohos.ability.featureAbility.FeatureAbility */ export declare class FeatureAbility { /** @@ -303,6 +304,7 @@ export declare class FeatureAbility { * @returns A Promise object is returned, which contains the result of whether to call Ability's interface successfully. * @since 5 * @deprecated since 8 + * @useinstead ohos.ability.featureAbility.FeatureAbility#startAbility */ static startAbility(request: RequestParams): Promise; @@ -312,20 +314,21 @@ export declare class FeatureAbility { * @returns A Promise object is returned, which contains the result of the data FA returned. * @since 5 * @deprecated since 8 + * @useinstead ohos.ability.featureAbility.FeatureAbility#startAbilityForResult */ static startAbilityForResult(request: RequestParams): Promise; /** - * FA call the interface to destory itself and set the result as parameters. + * FA call the interface to destroy itself and set the result as parameters. * @param request Indicates the request param. * @returns A Promise object is returned, which contains the result whether to callback successfully. * @since 5 * @deprecated since 8 + * @useinstead ohos.ability.featureAbility.FeatureAbility#terminateSlefWithResult */ static finishWithResult(param: FinishWithResultParams): Promise; /** - * Get device information list. * @param flag Default 0, get the information list of all devices in the network. * @returns A Promise object is returned, which contains the result whether the device information list is obtained successfully. @@ -353,7 +356,7 @@ export declare class FeatureAbility { static continueAbility(): Promise; /** - * Subscribes to events of an AA. + * Subscribe to events of an AA. * @param param Indicates the request param. * @param func Indicates the event reporting callback. * @returns A Promise object is returned, which contains the result data returned by the AA. The result is a JSON string. @@ -363,7 +366,7 @@ export declare class FeatureAbility { static subscribeAbilityEvent(param: SubscribeAbilityEventParam, func: Function): Promise; /** - * Unsubscribes from events of an AA. + * Unsubscribe from events of an AA. * @param param Indicates the request param. * @returns A Promise object is returned, which contains the result data returned by the AA. The result is a JSON string. * @since 5 @@ -390,7 +393,7 @@ export declare class FeatureAbility { static subscribeMsg(options: SubscribeMessageOptions): void; /** - * Cancels the listening for messages sent from other devices. + * Cancel the listening for messages sent from other devices. * @syscap SystemCapability.ArkUI.ArkUI.Lite * @since 5 * @deprecated since 8 diff --git a/api/common/full/viewmodel.d.ts b/api/common/full/viewmodel.d.ts index 06b578c7fd23c3d18b30769cf2e4ccc94282f23d..991dd2553db69737fd3707d088e6e2d234192efb 100644 --- a/api/common/full/viewmodel.d.ts +++ b/api/common/full/viewmodel.d.ts @@ -20,7 +20,7 @@ import image from "../../@ohos.multimedia.image"; import { CanvasPattern } from './canvaspattern'; /** - * Defines the foucs param. + * Defines the focus param. * @syscap SystemCapability.ArkUI.ArkUI.Full * @since 3 */ @@ -555,7 +555,7 @@ export interface observer { observe(callback: string): void; /** - * Turn off the listenerr. + * Turn off the listener. * @since 6 */ unobserve(): void; @@ -2546,7 +2546,7 @@ export interface ViewModel { $t(path: string, params?: object | Array): string; /** - * Converses between singular and plural forms based on the system language, for example, this.$tc('strings.plurals'). + * Converse between singular and plural forms based on the system language, for example, this.$tc('strings.plurals'). * NOTE * The resource content is distinguished by the following JSON keys: zero, one, two, few, many, and other. * @param path Resource file path. @@ -2698,7 +2698,7 @@ export declare class Locate { language: string; /** - * country or regin, such ass 'CN'. + * country or region, such ass 'CN'. * @since 4 */ countryOrRegion: string; @@ -2796,7 +2796,7 @@ export interface Options> { /** * Listens for page active. - * Called when the page is activing. + * Called when the page is active. * @since 5 */ onActive?(): void; diff --git a/api/common/lite/featureability.d.ts b/api/common/lite/featureability.d.ts index 3b1d820d99ef1e343be31791e5cc10ac740350e5..36ee944bf29358f1546131880155bcdbdc7234b0 100644 --- a/api/common/lite/featureability.d.ts +++ b/api/common/lite/featureability.d.ts @@ -26,7 +26,7 @@ export interface SubscribeMessageResponse { deviceId: string; /** - * Name of the bundle where the peer ability locates. The name is case sensitive. + * Name of the bundle where the peer ability has been located. The name is case sensitive. * @since 5 */ bundleName: string; @@ -57,7 +57,7 @@ export interface SendMessageOptions { deviceId: string; /** - * Name of the destination bundle where the ability locates. The name is case sensitive. + * Name of the destination bundle where the ability has been located. The name is case sensitive. * @since 5 */ bundleName: string; @@ -118,6 +118,7 @@ export interface SubscribeMessageOptions { * @since 5 * @systemapi * @deprecated since 8 + * @useinstead ohos.ability.featureAbility.FeatureAbility */ export declare class FeatureAbility { /** @@ -139,7 +140,7 @@ export declare class FeatureAbility { static subscribeMsg(options: SubscribeMessageOptions): void; /** - * Cancels the listening for messages sent from other devices. + * Cancel the listening for messages sent from other devices. * @syscap SystemCapability.ArkUI.ArkUI.Lite * @since 5 * @deprecated since 8 diff --git a/api/common/lite/viewmodel.d.ts b/api/common/lite/viewmodel.d.ts index bd234589864d362a5202097c4f3e5518cc755caa..abb1309d472e341185ff02046fa7e65e31467b88 100644 --- a/api/common/lite/viewmodel.d.ts +++ b/api/common/lite/viewmodel.d.ts @@ -109,10 +109,30 @@ export interface Options> { onDestroy?(): void; } +/** + * Used for ide. + * @systemapi + * @hide + * @since 4 + */ type DefaultData = object; + +/** + * Used for ide. + * @systemapi + * @hide + * @since 4 + */ type CombinedOptions = object & Options & ThisType; + +/** + * @syscap SystemCapability.ArkUI.ArkUI.Lite + * @systemapi + * @hide + * @since 4 + */ export declare function extendViewModel( options: CombinedOptions ): ViewModel & Data; diff --git a/api/commonEvent/commonEventSubscriber.d.ts b/api/commonEvent/commonEventSubscriber.d.ts index c9e1beb8d710bd6dd866f2d14e4f61d718c9a453..e575ec8e92c7020ab225d16d74a684702c034eba 100644 --- a/api/commonEvent/commonEventSubscriber.d.ts +++ b/api/commonEvent/commonEventSubscriber.d.ts @@ -152,7 +152,7 @@ export interface CommonEventSubscriber { isStickyCommonEvent(): Promise; /** - * Aborts the current ordered common event. + * Abort the current ordered common event. * * @since 7 * @param callback Indicate the callback function to receive the common event. @@ -161,7 +161,7 @@ export interface CommonEventSubscriber { abortCommonEvent(callback: AsyncCallback): void; /** - * Aborts the current ordered common event. + * Abort the current ordered common event. * * @since 7 * @return - diff --git a/api/data/rdb/resultSet.d.ts b/api/data/rdb/resultSet.d.ts old mode 100755 new mode 100644 index bfc91c34fbe45aa500ae836b78546663ec3d4f3a..6a9c462376b2bfe86f1b0df6e68e9192b63e8a30 --- a/api/data/rdb/resultSet.d.ts +++ b/api/data/rdb/resultSet.d.ts @@ -18,83 +18,96 @@ import { AsyncCallback } from '../../basic' /** * Provides methods for accessing a database result set generated by querying the database. * - * @since 7 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @import import data_rdb from '@ohos.data.rdb'; + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.ResultSetV9 */ -export interface ResultSet { + interface ResultSet { + /** * Obtains the names of all columns in a result set. - * - * @note The column names are returned as a string array, in which the strings are in the same order + * The column names are returned as a string array, in which the strings are in the same order * as the columns in the result set. - * @since 7 + * * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.ResultSetV9.columnNames */ columnNames: Array; /** * Obtains the number of columns in the result set. - * - * @note The returned number is equal to the length of the string array returned by the + * The returned number is equal to the length of the string array returned by the * columnCount method. - * @since 7 + * * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.ResultSetV9.columnCount */ columnCount: number; /** * Obtains the number of rows in the result set. * - * @note N/A - * @since 7 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.ResultSetV9.rowCount */ rowCount: number; /** * Obtains the current index of the result set. + * The result set index starts from 0. * - * @note The result set index starts from 0. - * @since 7 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.ResultSetV9.rowIndex */ rowIndex: number; /** * Checks whether the result set is positioned at the first row. * - * @note N/A - * @since 7 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.ResultSetV9.isAtFirstRow */ isAtFirstRow: boolean; /** * Checks whether the result set is positioned at the last row. * - * @note N/A - * @since 7 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.ResultSetV9.isAtLastRow */ isAtLastRow: boolean; /** * Checks whether the result set is positioned after the last row. * - * @note N/A - * @since 7 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.ResultSetV9.isEnded */ isEnded: boolean; /** - * Returns whether the cursor is pointing to the position before the first + * returns whether the cursor is pointing to the position before the first * row. * - * @note N/A - * @since 7 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.ResultSetV9.isStarted */ isStarted: boolean; @@ -103,31 +116,304 @@ export interface ResultSet { * * If the result set is closed by calling the close method, true will be returned. * - * @note N/A - * @since 7 * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.ResultSetV9.isClosed */ isClosed: boolean; /** * Obtains the column index based on the specified column name. + * The column name is passed as an input parameter. * - * @note The column name is passed as an input parameter. - * @since 7 + * @param {string} columnName - Indicates the name of the specified column in the result set. + * @returns {number} return the index of the specified column. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param columnName Indicates the name of the specified column in the result set. - * @return Returns the index of the specified column. + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.ResultSetV9.getColumnIndex */ getColumnIndex(columnName: string): number; /** * Obtains the column name based on the specified column index. + * The column index is passed as an input parameter. * - * @note The column index is passed as an input parameter. + * @param {number} columnIndex - Indicates the index of the specified column in the result set. + * @returns {string} returns the name of the specified column. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.ResultSetV9.getColumnName + */ + getColumnName(columnIndex: number): string; + + /** + * Go to the specified row of the result set forwards or backwards by an offset relative to its current position. + * A positive offset indicates moving backwards, and a negative offset indicates moving forwards. + * + * @param {number} offset - Indicates the offset relative to the current position. + * @returns {string} returns true if the result set is moved successfully and does not go beyond the range; + * returns false otherwise. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param columnIndex Indicates the index of the specified column in the result set. - * @return Returns the name of the specified column. + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.ResultSetV9.goTo + */ + goTo(offset: number): boolean; + + /** + * Go to the specified row of the result set. + * + * @param {number} rowIndex - Indicates the index of the specified row, which starts from 0. + * @returns {boolean} returns true if the result set is moved successfully; returns false otherwise. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.ResultSetV9.goToRow + */ + goToRow(position: number): boolean; + + /** + * Go to the first row of the result set. + * + * @returns {boolean} returns true if the result set is moved successfully; + * returns false otherwise, for example, if the result set is empty. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.ResultSetV9.goToFirstRow + */ + goToFirstRow(): boolean; + + /** + * Go to the last row of the result set. + * + * @returns {boolean} returns true if the result set is moved successfully; + * returns false otherwise, for example, if the result set is empty. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.ResultSetV9.goToLastRow + */ + goToLastRow(): boolean; + + /** + * Go to the next row of the result set. + * + * @returns {boolean} returns true if the result set is moved successfully; + * returns false otherwise, for example, if the result set is already in the last row. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.ResultSetV9.goToNextRow + */ + goToNextRow(): boolean; + + /** + * Go to the previous row of the result set. + * + * @returns {boolean} returns true if the result set is moved successfully; + * returns false otherwise, for example, if the result set is already in the first row. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.ResultSetV9.goToPreviousRow + */ + goToPreviousRow(): boolean; + + /** + * Obtains the value of the specified column in the current row as a byte array. + * The implementation class determines whether to throw an exception if the value of the specified column + * in the current row is null or the specified column is not of the Blob type. + * + * @param {number} columnIndex - Indicates the specified column index, which starts from 0. + * @returns {Uint8Array} returns the value of the specified column as a byte array. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.ResultSetV9.getBlob + */ + getBlob(columnIndex: number): Uint8Array; + + /** + * Obtains the value of the specified column in the current row as string. + * The implementation class determines whether to throw an exception if the value of the specified column + * in the current row is null or the specified column is not of the string type. + * + * @param {number} columnIndex - Indicates the specified column index, which starts from 0. + * @returns {string} returns the value of the specified column as a string. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.ResultSetV9.getString + */ + getString(columnIndex: number): string; + + /** + * Obtains the value of the specified column in the current row as long. + * The implementation class determines whether to throw an exception if the value of the specified column + * in the current row is null, the specified column is not of the integer type. + * + * @param {number} columnIndex - Indicates the specified column index, which starts from 0. + * @returns {number} returns the value of the specified column as a long. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.ResultSetV9.getLong + */ + getLong(columnIndex: number): number; + + /** + * Obtains the value of the specified column in the current row as double. + * The implementation class determines whether to throw an exception if the value of the specified column + * in the current row is null, the specified column is not of the double type. + * + * @param {number} columnIndex - Indicates the specified column index, which starts from 0. + * @returns {number} returns the value of the specified column as a double. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.ResultSetV9.getDouble + */ + getDouble(columnIndex: number): number; + + /** + * Checks whether the value of the specified column in the current row is null. + * + * @param {number} columnIndex - Indicates the specified column index, which starts from 0. + * @returns {boolean} returns true if the value of the specified column in the current row is null; + * returns false otherwise. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.ResultSetV9.isColumnNull + */ + isColumnNull(columnIndex: number): boolean; + + /** + * Closes the result set. + * Calling this method on the result set will release all of its resources and makes it ineffective. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 7 + * @deprecated since 9 + * @useinstead ohos.data.rdb.ResultSetV9.close + */ + close(): void; +} + +/** + * Provides methods for accessing a database result set generated by querying the database. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + interface ResultSetV9 { + + /** + * Obtains the names of all columns in a result set. + * The column names are returned as a string array, in which the strings are in the same order + * as the columns in the result set. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + columnNames: Array; + + /** + * Obtains the number of columns in the result set. + * The returned number is equal to the length of the string array returned by the + * columnCount method. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + */ + columnCount: number; + + /** + * Obtains the number of rows in the result set. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + rowCount: number; + + /** + * Obtains the current index of the result set. + * The result set index starts from 0. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + rowIndex: number; + + /** + * Checks whether the result set is positioned at the first row. + * + * @since 9 + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + */ + isAtFirstRow: boolean; + + /** + * Checks whether the result set is positioned at the last row. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + isAtLastRow: boolean; + + /** + * Checks whether the result set is positioned after the last row. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + isEnded: boolean; + + /** + * Returns whether the cursor is pointing to the position before the first row. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + isStarted: boolean; + + /** + * Checks whether the current result set is closed. + * + * If the result set is closed by calling the close method, true will be returned. + * + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + isClosed: boolean; + + /** + * Obtains the column index based on the specified column name. + * The column name is passed as an input parameter. + * + * @param {string} columnName - Indicates the name of the specified column in the result set. + * @returns {number} return the index of the specified column. + * @throws {BusinessError} 14800013 - The column value is null or the column type is incompatible. + * @throws {BusinessError} 401 - the parameter check failed. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 + */ + getColumnIndex(columnName: string): number; + + /** + * Obtains the column name based on the specified column index. + * The column index is passed as an input parameter. + * + * @param {number} columnIndex - Indicates the index of the specified column in the result set. + * @returns {string} returns the name of the specified column. + * @throws {BusinessError} 14800013 - The column value is null or the column type is incompatible. + * @throws {BusinessError} 401 - Parameter error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 9 */ getColumnName(columnIndex: number): string; @@ -135,137 +421,148 @@ export interface ResultSet { * Go to the specified row of the result set forwards or backwards by an offset relative to its current position. * A positive offset indicates moving backwards, and a negative offset indicates moving forwards. * - * @note N/A - * @since 7 + * @param {number} offset - Indicates the offset relative to the current position. + * @returns {string} returns true if the result set is moved successfully and does not go beyond the range; + * returns false otherwise. + * @throws {BusinessError} 14800012 - The result set is empty or the specified location is invalid. + * @throws {BusinessError} 401 - Parameter error. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param offset Indicates the offset relative to the current position. - * @return Returns true if the result set is moved successfully and does not go beyond the range; - * returns false otherwise. + * @since 9 */ goTo(offset: number): boolean; /** * Go to the specified row of the result set. * - * @note N/A - * @since 7 + * @param {number} rowIndex - Indicates the index of the specified row, which starts from 0. + * @returns {boolean} returns true if the result set is moved successfully; returns false otherwise. + * @throws {BusinessError} 14800012 - The result set is empty or the specified location is invalid. + * @throws {BusinessError} 401 - Parameter error. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param rowIndex Indicates the index of the specified row, which starts from 0. - * @return Returns true if the result set is moved successfully; returns false otherwise. + * @since 9 */ goToRow(position: number): boolean; /** * Go to the first row of the result set. * - * @note N/A - * @since 7 + * @returns {boolean} returns true if the result set is moved successfully; + * returns false otherwise, for example, if the result set is empty. + * @throws {BusinessError} 14800012 - The result set is empty or the specified location is invalid. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @return Returns true if the result set is moved successfully; - * returns false otherwise, for example, if the result set is empty. + * @since 9 */ goToFirstRow(): boolean; /** * Go to the last row of the result set. * - * @note N/A - * @since 7 + * @returns {boolean} returns true if the result set is moved successfully; + * returns false otherwise, for example, if the result set is empty. + * @throws {BusinessError} 14800012 - The result set is empty or the specified location is invalid. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @return Returns true if the result set is moved successfully; - * returns false otherwise, for example, if the result set is empty. + * @since 9 */ goToLastRow(): boolean; /** * Go to the next row of the result set. * - * @note N/A - * @since 7 + * @returns {boolean} returns true if the result set is moved successfully; + * returns false otherwise, for example, if the result set is already in the last row. + * @throws {BusinessError} 14800012 - The result set is empty or the specified location is invalid. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @return Returns true if the result set is moved successfully; - * returns false otherwise, for example, if the result set is already in the last row. + * @since 9 */ goToNextRow(): boolean; /** * Go to the previous row of the result set. * - * @note N/A - * @since 7 + * @returns {boolean} returns true if the result set is moved successfully; + * returns false otherwise, for example, if the result set is already in the first row. + * @throws {BusinessError} 14800012 - The result set is empty or the specified location is invalid. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @return Returns true if the result set is moved successfully; - * returns false otherwise, for example, if the result set is already in the first row. + * @since 9 */ goToPreviousRow(): boolean; /** * Obtains the value of the specified column in the current row as a byte array. - * - * @note The implementation class determines whether to throw an exception if the value of the specified column + * The implementation class determines whether to throw an exception if the value of the specified column * in the current row is null or the specified column is not of the Blob type. - * @since 7 + * + * @param {number} columnIndex - Indicates the specified column index, which starts from 0. + * @returns {Uint8Array} returns the value of the specified column as a byte array. + * @throws {BusinessError} 14800013 - The column value is null or the column type is incompatible. + * @throws {BusinessError} 401- Parameter error. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param columnIndex Indicates the specified column index, which starts from 0. - * @return Returns the value of the specified column as a byte array. + * @since 9 */ getBlob(columnIndex: number): Uint8Array; /** * Obtains the value of the specified column in the current row as string. - * - * @note The implementation class determines whether to throw an exception if the value of the specified column + * The implementation class determines whether to throw an exception if the value of the specified column * in the current row is null or the specified column is not of the string type. - * @since 7 + * + * @param {number} columnIndex - Indicates the specified column index, which starts from 0. + * @returns {string} returns the value of the specified column as a string. + * @throws {BusinessError} 14800013 - The column value is null or the column type is incompatible. + * @throws {BusinessError} 401 - Parameter error. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param columnIndex Indicates the specified column index, which starts from 0. - * @return Returns the value of the specified column as a string. + * @since 9 */ getString(columnIndex: number): string; /** * Obtains the value of the specified column in the current row as long. - * - * @note The implementation class determines whether to throw an exception if the value of the specified column + * The implementation class determines whether to throw an exception if the value of the specified column * in the current row is null, the specified column is not of the integer type. - * @since 7 + * + * @param {number} columnIndex - Indicates the specified column index, which starts from 0. + * @returns {number} returns the value of the specified column as a long. + * @throws {BusinessError} 14800013 - The column value is null or the column type is incompatible. + * @throws {BusinessError} 401 - Parameter error. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param columnIndex Indicates the specified column index, which starts from 0. - * @return Returns the value of the specified column as a long. + * @since 9 */ getLong(columnIndex: number): number; /** * Obtains the value of the specified column in the current row as double. - * - * @note The implementation class determines whether to throw an exception if the value of the specified column + * The implementation class determines whether to throw an exception if the value of the specified column * in the current row is null, the specified column is not of the double type. - * @since 7 + * + * @param {number} columnIndex - Indicates the specified column index, which starts from 0. + * @returns {number} returns the value of the specified column as a double. + * @throws {BusinessError} 14800013 - The column value is null or the column type is incompatible. + * @throws {BusinessError} 401 - Parameter error. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param columnIndex Indicates the specified column index, which starts from 0. - * @return Returns the value of the specified column as a double. + * @since 9 */ getDouble(columnIndex: number): number; /** * Checks whether the value of the specified column in the current row is null. * - * @note N/A - * @since 7 + * @param {number} columnIndex - Indicates the specified column index, which starts from 0. + * @returns {boolean} returns true if the value of the specified column in the current row is null; + * returns false otherwise. + * @throws {BusinessError} 14800013 - The column value is null or the column type is incompatible. + * @throws {BusinessError} 401 - Parameter error. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @param columnIndex Indicates the specified column index, which starts from 0. - * @return Returns true if the value of the specified column in the current row is null; - * returns false otherwise. + * @since 9 */ isColumnNull(columnIndex: number): boolean; /** * Closes the result set. + * Calling this method on the result set will release all of its resources and makes it ineffective. * - * @note Calling this method on the result set will release all of its resources and makes it ineffective. - * @since 7 + * @throws {BusinessError} 14800012 - The result set is empty or the specified location is invalid. * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * @return Returns true if the result set is closed; returns false otherwise. + * @since 9 */ close(): void; } \ No newline at end of file diff --git a/api/device-define/car.json b/api/device-define/car.json index 4d0c0427b7f0e84ab35178238a579e11f9a6a1b0..d9f3255d0243357b39122f88be6d30020c4caacc 100644 --- a/api/device-define/car.json +++ b/api/device-define/car.json @@ -107,6 +107,7 @@ "SystemCapability.FileManagement.File.DistributedFile", "SystemCapability.FileManagement.AppFileService", "SystemCapability.FileManagement.UserFileService", + "SystemCapability.FileManagement.UserFileManager.Core", "SystemCapability.USB.USBManager", "SystemCapability.Startup.SystemInfo", "SystemCapability.DistributedDataManager.RelationalStore.Core", diff --git a/api/device-define/default.json b/api/device-define/default.json index bd9d537417bf17d0dcce97bc33f2bdbdea111a2c..0502d6583f1b3301055ef3602e2e28d19e326dc4 100644 --- a/api/device-define/default.json +++ b/api/device-define/default.json @@ -134,6 +134,7 @@ "SystemCapability.FileManagement.File.DistributedFile", "SystemCapability.FileManagement.AppFileService", "SystemCapability.FileManagement.UserFileService", + "SystemCapability.FileManagement.UserFileManager.Core", "SystemCapability.USB.USBManager", "SystemCapability.Sensors.Sensor", "SystemCapability.Sensors.MiscDevice", @@ -175,6 +176,7 @@ "SystemCapability.BundleManager.BundleFramework.AppControl", "SystemCapability.Ability.AbilityRuntime.QuickFix", "SystemCapability.Graphic.Graphic2D.ColorManager.Core", - "SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply" + "SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply", + "SystemCapability.Msdp.DeviceStatus.Stationary" ] } diff --git a/api/device-define/tablet.json b/api/device-define/tablet.json index 495e9fa6bbae0ce9e6c1dcc6b61ed62f94359f0a..891340559b24cf165cf724d04ec46f34710b41d2 100644 --- a/api/device-define/tablet.json +++ b/api/device-define/tablet.json @@ -133,6 +133,7 @@ "SystemCapability.FileManagement.File.DistributedFile", "SystemCapability.FileManagement.AppFileService", "SystemCapability.FileManagement.UserFileService", + "SystemCapability.FileManagement.UserFileManager.Core", "SystemCapability.USB.USBManager", "SystemCapability.Sensors.Sensor", "SystemCapability.Sensors.MiscDevice", @@ -174,6 +175,7 @@ "SystemCapability.BundleManager.BundleFramework.AppControl", "SystemCapability.Ability.AbilityRuntime.QuickFix", "SystemCapability.Graphic.Graphic2D.ColorManager.Core", - "SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply" + "SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply", + "SystemCapability.Msdp.DeviceStatus.Stationary" ] } \ No newline at end of file diff --git a/api/device-define/tv.json b/api/device-define/tv.json index 4a200b0979333f096e689375f2bdfc9cbec0518c..509d24e0c5a60ea98e4ff022f80c74fa3796a61d 100644 --- a/api/device-define/tv.json +++ b/api/device-define/tv.json @@ -113,6 +113,7 @@ "SystemCapability.FileManagement.File.DistributedFile", "SystemCapability.FileManagement.AppFileService", "SystemCapability.FileManagement.UserFileService", + "SystemCapability.FileManagement.UserFileManager.Core", "SystemCapability.USB.USBManager", "SystemCapability.Startup.SystemInfo", "SystemCapability.DistributedDataManager.RelationalStore.Core", diff --git a/api/device-define/wearable.json b/api/device-define/wearable.json index 7844c45225a7ed3e568c29a26113717d818041a5..8a5d9485498cf2e0335934cb9cfc49a97de05ef6 100644 --- a/api/device-define/wearable.json +++ b/api/device-define/wearable.json @@ -113,6 +113,7 @@ "SystemCapability.FileManagement.File.FileIO", "SystemCapability.FileManagement.File.Environment", "SystemCapability.FileManagement.UserFileService", + "SystemCapability.FileManagement.UserFileManager.Core", "SystemCapability.Sensors.Sensor", "SystemCapability.Sensors.MiscDevice", "SystemCapability.Startup.SystemInfo", diff --git a/api/notification/notificationSubscriber.d.ts b/api/notification/notificationSubscriber.d.ts index f2356ec81f6d0943c7de7755327fd739703ea8c6..383eed775ce061d17eb2d913758273bfa75c1113 100644 --- a/api/notification/notificationSubscriber.d.ts +++ b/api/notification/notificationSubscriber.d.ts @@ -1,83 +1,83 @@ -/* - * 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 { NotificationRequest } from './notificationRequest'; -import { NotificationSortingMap } from './notificationSortingMap'; -import notification from '../@ohos.notification'; - -/** - * Provides methods that will be called back when the subscriber receives a new notification or - * a notification is canceled. - * - * @name NotificationSubscriber - * @syscap SystemCapability.Notification.Notification - * @permission N/A - * @systemapi Hide this for inner system use. - * @since 7 - */ -export interface NotificationSubscriber { - onConsume?:(data: SubscribeCallbackData) => void; - onCancel?:(data: SubscribeCallbackData) => void; - onUpdate?:(data: NotificationSortingMap) => void; - onConnect?:() => void; - onDisconnect?:() => void; - onDestroy?:() => void; - - /** - * Callback when the Do Not Disturb setting changed. - * @syscap SystemCapability.Notification.Notification - * @since 8 - */ - onDoNotDisturbDateChange?:(mode: notification.DoNotDisturbDate) => void; - - /** - * Callback when the notificaition permission is changed. - * @syscap SystemCapability.Notification.Notification - * @since 8 - */ - onEnabledNotificationChanged?:(callbackData: EnabledNotificationCallbackData) => void; -} - -/** - * Provides methods that will be called back when the subscriber receives a new notification or - * a notification is canceled. - * - * @name SubscribeCallbackData - * @syscap SystemCapability.Notification.Notification - * @permission N/A - * @systemapi Hide this for inner system use. - * @since 7 - */ -export interface SubscribeCallbackData { - readonly request: NotificationRequest; - readonly sortingMap?: NotificationSortingMap; - readonly reason?: number; - readonly sound?: string; - readonly vibrationValues?: Array; -} - -/** - * Describes the properties of the application that the permission to send notifications has changed. - * - * @name EnabledNotificationCallbackData - * @syscap SystemCapability.Notification.Notification - * @systemapi Hide this for inner system use. - * @since 8 - */ -export interface EnabledNotificationCallbackData { - readonly bundle: string; - readonly uid: number; - readonly enable: boolean; -} +/* + * 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 { NotificationRequest } from './notificationRequest'; +import { NotificationSortingMap } from './notificationSortingMap'; +import notification from '../@ohos.notification'; + +/** + * Provides methods that will be called back when the subscriber receives a new notification or + * a notification is canceled. + * + * @name NotificationSubscriber + * @syscap SystemCapability.Notification.Notification + * @permission N/A + * @systemapi Hide this for inner system use. + * @since 7 + */ +export interface NotificationSubscriber { + onConsume?:(data: SubscribeCallbackData) => void; + onCancel?:(data: SubscribeCallbackData) => void; + onUpdate?:(data: NotificationSortingMap) => void; + onConnect?:() => void; + onDisconnect?:() => void; + onDestroy?:() => void; + + /** + * Callback when the Do Not Disturb setting changed. + * @syscap SystemCapability.Notification.Notification + * @since 8 + */ + onDoNotDisturbDateChange?:(mode: notification.DoNotDisturbDate) => void; + + /** + * Callback when the notification permission is changed. + * @syscap SystemCapability.Notification.Notification + * @since 8 + */ + onEnabledNotificationChanged?:(callbackData: EnabledNotificationCallbackData) => void; +} + +/** + * Provides methods that will be called back when the subscriber receives a new notification or + * a notification is canceled. + * + * @name SubscribeCallbackData + * @syscap SystemCapability.Notification.Notification + * @permission N/A + * @systemapi Hide this for inner system use. + * @since 7 + */ +export interface SubscribeCallbackData { + readonly request: NotificationRequest; + readonly sortingMap?: NotificationSortingMap; + readonly reason?: number; + readonly sound?: string; + readonly vibrationValues?: Array; +} + +/** + * Describes the properties of the application that the permission to send notifications has changed. + * + * @name EnabledNotificationCallbackData + * @syscap SystemCapability.Notification.Notification + * @systemapi Hide this for inner system use. + * @since 8 + */ +export interface EnabledNotificationCallbackData { + readonly bundle: string; + readonly uid: number; + readonly enable: boolean; +} diff --git a/api/tag/nfctech.d.ts b/api/tag/nfctech.d.ts index 72c7aa22cc59ff62ae6234d41cd17a18cb81a934..7fa6ba118aed306fcd06620cb47b1a9398c9ce2d 100644 --- a/api/tag/nfctech.d.ts +++ b/api/tag/nfctech.d.ts @@ -148,26 +148,32 @@ export interface NfcVTag extends TagSession { */ export interface IsoDepTag extends TagSession { /** - * Get Historical bytes of the tag. - * @return the Historical bytes. + * Gets IsoDep Historical bytes of the tag, which is based on NfcA RF technology. + * It could be null if not based on NfcA. + * + * @return { number[] } Returns the Historical bytes, the length could be 0. * @since 9 - * @permission ohos.permission.NFC_TAG */ getHistoricalBytes(): number[]; /** - * Get HiLayerResponse bytes of the tag. - * @return HiLayerResponse bytes + * Gets IsoDep HiLayer Response bytes of the tag, which is based on NfcB RF technology. + * It could be null if not based on NfcB. + * + * @return { number[] } Returns HiLayer Response bytes, the length could be 0. * @since 9 - * @permission ohos.permission.NFC_TAG */ getHiLayerResponse(): number[]; /** - * Check if externded apdu length supported or not. - * @return return true if externded apdu length supported, otherwise false. - * @since 9 + * Checks if extended apdu length supported or not. + * + * @return { boolean } Returns true if extended apdu length supported, otherwise false. * @permission ohos.permission.NFC_TAG + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @since 9 */ isExtendedApduSupported(): Promise; isExtendedApduSupported(callback: AsyncCallback): void; @@ -175,61 +181,12 @@ export interface IsoDepTag extends TagSession { export interface NdefMessage { /** - * Get all records of a ndef message. - * @return record list of a ndef message + * Obtains all records of an NDEF message. + * + * @return { tag.NdefRecord[] } Records the list of NDEF records. * @since 9 - * @permission ohos.permission.NFC_TAG */ getNdefRecords(): tag.NdefRecord[]; - - /** - * Create a ndef record with uri data. - * @param uri uri data for new a ndef record - * @return the instance of NdefRecord - * @since 9 - * @permission ohos.permission.NFC_TAG - */ - makeUriRecord(uri: string): tag.NdefRecord; - - /** - * Create a ndef record with text data. - * @param text text data for new a ndef record - * @param locale language code for the ndef record. if locale is null, use default locale - * @return the instance of NdefRecord - * @since 9 - * @permission ohos.permission.NFC_TAG - */ - makeTextRecord(text: string, locale: string): tag.NdefRecord; - - /** - * Create a ndef record with mime data. - * @param mimeType type of mime data for new a ndef record - * @param mimeData mime data for new a ndef record - * @return the instance of NdefRecord - * @since 9 - * @permission ohos.permission.NFC_TAG - */ - makeMimeRecord(mimeType: string, mimeData: number[]): tag.NdefRecord; - - /** - * Create a ndef record with external data. - * @param domainName domain name of issuing organization for the external data - * @param serviceName domain specific type of data for the external data - * @param externalData data payload of a ndef record - * @return the instance of NdefRecord - * @since 9 - * @permission ohos.permission.NFC_TAG - */ - makeExternalRecord(domainName: string, serviceName: string, externalData: number[]): tag.NdefRecord; - - /** - * Parse a ndef message into raw bytes. - * @param ndefMessage a ndef message to parse - * @return raw bytes of a ndef message - * @since 9 - * @permission ohos.permission.NFC_TAG - */ - messageToBytes(ndefMessage: NdefMessage): number[]; } /** @@ -240,90 +197,85 @@ export interface NdefMessage { */ export interface NdefTag extends TagSession { /** - * Create a ndef message with raw bytes. - * @param data raw bytes to parse ndef message - * @return the instance of NdefMessage - * @since 9 - * @permission ohos.permission.NFC_TAG - */ - createNdefMessage(data: number[]): NdefMessage; - - /** - * Create a ndef message with record list. - * @param ndefRecords record list to parse ndef message - * @return the instance of NdefMessage - * @since 9 - * @permission ohos.permission.NFC_TAG - */ - createNdefMessage(ndefRecords: tag.NdefRecord[]): NdefMessage; - - /** - * Get the type of the Ndef tag. - * @return type of Ndef tag. + * Gets the type of NDEF tag. + * + * @return { tag.NfcForumType } The type of NDEF tag. * @since 9 - * @permission ohos.permission.NFC_TAG */ getNdefTagType(): tag.NfcForumType; /** - * Get the ndef message that was read from ndef tag when tag discovery. - * @return ndef message. + * Gets the NDEF message that was read from NDEF tag when tag discovery. + * + * @return { NdefMessage } The instance of NdefMessage. * @since 9 - * @permission ohos.permission.NFC_TAG */ getNdefMessage(): NdefMessage; /** - * Check if ndef tag is writable. - * @return return true if the tag is writable, otherwise return false. + * Checks if NDEF tag is writable. + * + * @return { boolean } Returns true if the tag is writable, otherwise returns false. * @since 9 - * @permission ohos.permission.NFC_TAG */ - isNdefWritable(): Promise; - isNdefWritable(callback: AsyncCallback): void; + isNdefWritable(): boolean; /** - * Read ndef message on this tag. - * @return ndef message in tag. - * @since 9 + * Reads NDEF message on this tag. + * + * @return { NdefMessage } The NDEF message in tag. * @permission ohos.permission.NFC_TAG + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @since 9 */ readNdef(): Promise; readNdef(callback: AsyncCallback): void; /** - * Write ndef message into this tag. - * @param msg ndef message to write - * @return Error code of write. if return 0, means successful. - * @since 9 + * Writes NDEF message into this tag. + * + * @param { NdefMessage } msg - The NDEF message to be written. * @permission ohos.permission.NFC_TAG + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @since 9 */ - writeNdef(msg: NdefMessage): Promise; - writeNdef(msg: NdefMessage, callback: AsyncCallback): void; + writeNdef(msg: NdefMessage): Promise; + writeNdef(msg: NdefMessage, callback: AsyncCallback): void; /** - * Check ndef tag can be set read-only - * @return return true if the tag can be set readonly, otherwise return false. - * @since 9 + * Checks NDEF tag can be set read-only. + * + * @return { boolean } Returns true if the tag can be set readonly, otherwise returns false. * @permission ohos.permission.NFC_TAG + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @since 9 */ canSetReadOnly(): boolean; /** - * Set ndef tag read-only - * @return if return 0 means successful, otherwise the error code. - * @since 9 + * Sets the NDEF tag read-only. + * * @permission ohos.permission.NFC_TAG + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @since 9 */ - setReadOnly(): Promise; - setReadOnly(callback: AsyncCallback): void; + setReadOnly(): Promise; + setReadOnly(callback: AsyncCallback): void; /** - * Convert the Nfc forum type into byte array defined in Nfc forum. - * @param type Nfc forum type of ndef tag - * @return Nfc forum type byte array + * Converts the NFC forum type into string defined in NFC forum. + * + * @param { tag.NfcForumType } type - NFC forum type of NDEF tag. + * @return { string } The NFC forum string type. + * @throws { BusinessError } 401 - The parameter check failed. * @since 9 - * @permission ohos.permission.NFC_TAG */ getNdefTagTypeString(type: tag.NfcForumType): string; } @@ -336,136 +288,161 @@ export interface NdefTag extends TagSession { */ export interface MifareClassicTag extends TagSession { /** - * Authenticate a sector with the key.Only successful authentication sector can be operated. - * @param sectorIndex Index of sector to authenticate - * @param key key(6-bytes) to authenticate - * @param isKeyA KeyA flag. true means KeyA, otherwise KeyB - * @return Result of authenticattion. if return ture, means successful. - * @since 9 + * Authenticates a sector with the key.Only successful authentication sector can be operated. + * + * @param { number } sectorIndex - Index of sector to authenticate. + * @param { number[] } key - The key(6-bytes) to authenticate. + * @param { boolean } isKeyA - KeyA flag. true means KeyA, otherwise KeyB. * @permission ohos.permission.NFC_TAG + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @since 9 */ - authenticateSector(sectorIndex: number, key: number[], isKeyA: boolean): Promise; - authenticateSector(sectorIndex: number, key: number[], isKeyA: boolean, callback: AsyncCallback): void; + authenticateSector(sectorIndex: number, key: number[], isKeyA: boolean): Promise; + authenticateSector(sectorIndex: number, key: number[], isKeyA: boolean, callback: AsyncCallback): void; /** - * Read a block, one block size is 16 bytes. - * @param blockIndex index of block to read - * @return the block data - * @since 9 + * Reads a block, one block size is 16 bytes. + * + * @param { number } blockIndex - The index of block to read. + * @return { number[] } Returns the block data. * @permission ohos.permission.NFC_TAG + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @since 9 */ readSingleBlock(blockIndex: number): Promise; readSingleBlock(blockIndex: number, callback: AsyncCallback): void; /** - * Write a block, one block size is 16 bytes. - * @param blockIndex index of block to write - * @param data block data to write - * @return Error code of write. if return 0, means successful. + * Writes a block, one block size is 16 bytes. + * + * @param { number } blockIndex - The index of block to write. + * @param { number } data - The block data to write. + * @permission ohos.permission.NFC_TAG + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. * @since 9 - * @permission ohos.pemission.NFC_TAG */ - writeSingleBlock(blockIndex: number, data: number[]): Promise; - writeSingleBlock(blockIndex: number, data: number[], callback: AsyncCallback): void; + writeSingleBlock(blockIndex: number, data: number[]): Promise; + writeSingleBlock(blockIndex: number, data: number[], callback: AsyncCallback): void; /** - * Increment a value block - * @param blockIndex index of block to increment - * @param value value to increment, none-negative - * @return Error code of increment. if return 0, means successful. - * @since 9 + * Increments the contents of a block, and stores the result in the internal transfer buffer. + * + * @param { number } blockIndex - The index of block to increment. + * @param { number } value - The value to increment, none-negative. * @permission ohos.permission.NFC_TAG + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @since 9 */ - incrementBlock(blockIndex: number, value: number): Promise; - incrementBlock(blockIndex: number, value: number, callback: AsyncCallback): void; + incrementBlock(blockIndex: number, value: number): Promise; + incrementBlock(blockIndex: number, value: number, callback: AsyncCallback): void; /** - * Decrement a value block - * @param blockIndex index of block to decrement - * @param value value to increment, none-negative - * @return Error code of decrement. if return 0, means successful. - * @since 9 + * Decrements the contents of a block, and stores the result in the internal transfer buffer. + * + * @param { number } blockIndex - The index of block to decrement. + * @param { number } value - The value to decrement, none-negative. * @permission ohos.permission.NFC_TAG + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @since 9 */ - decrementBlock(blockIndex: number, value: number): Promise; - decrementBlock(blockIndex: number, value: number, callback: AsyncCallback): void; + decrementBlock(blockIndex: number, value: number): Promise; + decrementBlock(blockIndex: number, value: number, callback: AsyncCallback): void; /** - * Copy from the value of register to the value block - * @param blockIndex index of value block to copy to - * @return if return 0, means successful. otherwise the error code - * @since 9 + * Writes the contents of the internal transfer buffer to a value block. + * + * @param { number } blockIndex - The index of value block to be written. * @permission ohos.permission.NFC_TAG + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @since 9 */ - transferToBlock(blockIndex: number): Promise; - transferToBlock(blockIndex: number, callback: AsyncCallback): void; + transferToBlock(blockIndex: number): Promise; + transferToBlock(blockIndex: number, callback: AsyncCallback): void; /** - * Copy from the value block to the register - * @param blockIndex index of value block to copy from - * @return if return 0, means successful. otherwise the error code - * @since 9 + * Moves the contents of a block into the internal transfer buffer. + * + * @param { number } blockIndex - The index of value block to be moved from. * @permission ohos.permission.NFC_TAG + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @since 9 */ - restoreFromBlock(blockIndex: number): Promise; - restoreFromBlock(blockIndex: number, callback: AsyncCallback): void; + restoreFromBlock(blockIndex: number): Promise; + restoreFromBlock(blockIndex: number, callback: AsyncCallback): void; /** - * Get the number of sectors in mifareclassic tag - * @return the number of sectors. + * Gets the number of sectors in MifareClassic tag. + * + * @return { number } Returns the number of sectors. * @since 9 - * @permission ohos.permission.NFC_TAG */ getSectorCount(): number; /** - * Get the number of blocks in the sector. - * @param sectorIndex index of sector - * @return the number of blocks. + * Gets the number of blocks in the sector. + * + * @param { number } sectorIndex - The index of sector. + * @return { number } Returns the number of blocks. + * @throws { BusinessError } 401 - The parameter check failed. * @since 9 - * @permission ohos.permission.NFC_TAG */ getBlockCountInSector(sectorIndex: number): number; /** - * Get the type of the MifareClassic tag. - * @return type of MifareClassic tag. + * Gets the type of the MifareClassic tag. + * + * @return { tag.MifareClassicType } Returns type of MifareClassic tag. * @since 9 - * @permission ohos.permission.NFC_TAG */ getType(): tag.MifareClassicType; /** - * Get size of the tag in bytes, see {@code MifareTagSize}. - * @return size of the tag + * Gets size of the tag in bytes. + * + * @return { number } Returns the size of the tag. * @since 9 - * @permission ohos.permission.NFC_TAG */ getTagSize(): number; /** - * check if if tag is emulated - * @return return true if tag is emulated, otherwise return false. + * Checks if the tag is emulated or not. + * + * @return { boolean } Returns true if tag is emulated, otherwise false. * @since 9 - * @permission ohos.permission.NFC_TAG */ isEmulatedTag(): boolean; /** - * Get the first block of the specific sector. - * @param sectorIndex index of sector - * @return index of first block in the sector + * Gets the first block of the specific sector. + * + * @param { number } sectorIndex - The index of sector. + * @return { number } Returns index of first block in the sector. + * @throws { BusinessError } 401 - The parameter check failed. * @since 9 - * @permission ohos.permission.NFC_TAG */ getBlockIndex(sectorIndex: number): number; /** - * Get the sector index, that the sector contains the specific block. - * @param blockIndex index of block - * @return the sector index + * Gets the sector index, that the sector contains the specific block. + * + * @param { number } blockIndex - The index of block. + * @return { number } Returns the sector index. + * @throws { BusinessError } 401 - The parameter check failed. * @since 9 - * @permission ohos.permission.NFC_TAG */ getSectorIndex(blockIndex: number): number; } @@ -478,31 +455,38 @@ export interface MifareClassicTag extends TagSession { */ export interface MifareUltralightTag extends TagSession { /** - * Read 4 pages, total is 16 bytes. page size is 4bytes. - * @param pageIndex index of page to read - * @return 4 pages data - * @since 9 + * Reads 4 pages, total is 16 bytes. Page size is 4 bytes. + * + * @param { number } pageIndex - The index of page to read. + * @return { number[] } Returns 4 pages data. * @permission ohos.permission.NFC_TAG + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @since 9 */ readMultiplePages(pageIndex: number): Promise; readMultiplePages(pageIndex: number, callback: AsyncCallback): void; /** - * Write a page, total 4 bytes. - * @param pageIndex index of page to write - * @param data page data to write - * @return Error code of write. if return 0, means successful. - * @since 9 + * Writes a page, total 4 bytes. + * + * @param { number } pageIndex - The index of page to write. + * @param { number[] } data - The page data to write. * @permission ohos.permission.NFC_TAG + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @since 9 */ - writeSinglePages(pageIndex: number, data: number[]): Promise; - writeSinglePages(pageIndex: number, data: number[], callback: AsyncCallback): void; + writeSinglePage(pageIndex: number, data: number[]): Promise; + writeSinglePage(pageIndex: number, data: number[], callback: AsyncCallback): void; /** - * Get the type of the MifareUltralight tag in bytes. - * @return type of MifareUltralight tag. + * Gets the type of the MifareUltralight tag. + * + * @return { tag.MifareUltralightType } Returns the type of MifareUltralight tag. * @since 9 - * @permission ohos.permission.NFC_TAG */ getType(): tag.MifareUltralightType; } @@ -515,22 +499,28 @@ export interface MifareUltralightTag extends TagSession { */ export interface NdefFormatableTag extends TagSession { /** - * Format a tag as NDEF tag, then write Ndef message into the Ndef Tag - * @param message Ndef message to write while format successful. it can be null, then only format the tag. - * @return if return 0, means successful. otherwise the error code - * @since 9 + * Formats a tag as NDEF tag, writes NDEF message into the NDEF Tag. + * + * @param { NdefMessage } message - NDEF message to write while format. It can be null, then only format the tag. * @permission ohos.permission.NFC_TAG + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @since 9 */ - format(message: NdefMessage): Promise; - format(message: NdefMessage, callback: AsyncCallback): void; + format(message: NdefMessage): Promise; + format(message: NdefMessage, callback: AsyncCallback): void; /** - * Format a tag as NDEF tag, then write Ndef message into the Ndef Tag, then set the tag readonly - * @param message Ndef message to write while format successful. it can be null, then only format the tag. - * @return if return 0, means successful. otherwise the error code - * @since 9 + * Formats a tag as NDEF tag, writes NDEF message into the NDEF Tag, then sets the tag readonly. + * + * @param { NdefMessage } message - NDEF message to write while format. It can be null, then only format the tag. * @permission ohos.permission.NFC_TAG + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - The parameter check failed. + * @throws { BusinessError } 3100201 - Tag running state is abnormal in service. + * @since 9 */ - formatReadOnly(message: NdefMessage): Promise; - formatReadOnly(message: NdefMessage, callback: AsyncCallback): void; + formatReadOnly(message: NdefMessage): Promise; + formatReadOnly(message: NdefMessage, callback: AsyncCallback): void; } \ No newline at end of file diff --git a/build-tools/.gitignore b/build-tools/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..788432e1970568d4104eed1ed8026e0a962cdb98 --- /dev/null +++ b/build-tools/.gitignore @@ -0,0 +1,5 @@ +**/node_modules/** +**/package-lock.json +**/.editorconfig +**/.prettierrc +api/ diff --git a/build-tools/api_check_plugin/code_style_rule.json b/build-tools/api_check_plugin/code_style_rule.json index c0e992d06a7e7f825ab503b368993eb755ec8757..a638432928d66a4f36471c56ac2d07a042b212a0 100644 --- a/build-tools/api_check_plugin/code_style_rule.json +++ b/build-tools/api_check_plugin/code_style_rule.json @@ -439,7 +439,8 @@ "File.Environment", "File.DistributedFile", "AppFileService", - "UserFileService" + "UserFileService", + "UserFileManager" ], "USB":[ "USBManager" diff --git a/build-tools/api_check_plugin/entry.js b/build-tools/api_check_plugin/entry.js index 849416c805b4ec84730b5bd581f4f3902542a718..95bf7557e3ea0775c2866a480173d50371e7c3a1 100644 --- a/build-tools/api_check_plugin/entry.js +++ b/build-tools/api_check_plugin/entry.js @@ -14,23 +14,26 @@ */ const path = require("path"); +const fs = require("fs"); const { writeResultFile } = require('./src/utils'); function checkEntry(url) { - let result = "API CHECK FAILED!"; + let result = ""; + const sourceDirname = __dirname; __dirname = "interface/sdk-js/build-tools/api_check_plugin"; + const mdFilesPath = path.resolve(sourceDirname, '../../../../', "all_files.txt"); + const content = fs.readFileSync(mdFilesPath, "utf-8"); try { const execSync = require("child_process").execSync; execSync("cd interface/sdk-js/build-tools/api_check_plugin && npm install"); const { scanEntry } = require(path.resolve(__dirname, "./src/api_check_plugin")); - result = scanEntry(url); - const content = fs.readFileSync(path.resolve(__dirname, "./Result.txt"), "utf-8"); - result += `mdFilePath = ${url}, content = ${content}` + result += scanEntry(mdFilesPath); + result += `,,,mdFilePath = ${mdFilesPath}, content = ${content}`; const { removeDir } = require(path.resolve(__dirname, "./src/utils")); removeDir(path.resolve(__dirname, "node_modules")); } catch (error) { // catch error - result = `CATCHERROR : ${error}`; + result += `CATCHERROR : ${error}, mdFilePath = ${mdFilesPath}, content = ${content}`; } writeResultFile(result, path.resolve(__dirname, "./Result.txt"), {}); } diff --git a/build-tools/api_check_plugin/plugin/scan_entry.py b/build-tools/api_check_plugin/plugin/scan_entry.py deleted file mode 100644 index bf1530c1f5eda4784ca3a93692dad220e496f141..0000000000000000000000000000000000000000 --- a/build-tools/api_check_plugin/plugin/scan_entry.py +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# 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 os -import shutil -import execjs - -def run_scan(path): - result = [] - rootDir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(_file_)))) - entryDir = os.path.join(rootDir, "interface/sdk-js/build-tools/api_check_plugin/entry.js").replace("\\","/") - resultDir = os.path.join(rootDir, "interface/sdk-js/build-tools/api_check_plugin/Result.txt").replace("\\","/") - cmdDir = "node" + entryDir + " " + os.path.join(rootDir,path) - subprocess.check_output(cmdDir, shell=True) - file_object = open(resultDir,"r") - try: - result = file_object.read() - finally: - file_object.close() - - os.remove(os.path.abspath(resultDir)) - return True,result - -def js_from_file(file_name): - with open(file_name, "r", encoding="UTF-8") as file: - result = file.read() - return result - -if __name__ == "__main__": - run_scan("ci-tools/ci-build/mdFiles.txt") diff --git a/build-tools/api_check_plugin/src/api_check_plugin.js b/build-tools/api_check_plugin/src/api_check_plugin.js index 43420ddf3770ca1f6b9fdee19d477ce568a0d968..35328140ea5cd8a4684592bd2a87c64fc44957ee 100644 --- a/build-tools/api_check_plugin/src/api_check_plugin.js +++ b/build-tools/api_check_plugin/src/api_check_plugin.js @@ -34,7 +34,7 @@ function checkAPICodeStyle(url) { function getMdFiles(url) { const content = fs.readFileSync(url, "utf-8"); - const mdFiles = content.split("\r\n"); + const mdFiles = content.split(/[(\r\n)\r\n]+/); return mdFiles; } diff --git a/build-tools/collect_application_api/README_EN.md b/build-tools/collect_application_api/README_EN.md deleted file mode 100644 index da16a6f70e10f05a4ffb921cf84fb6076c77cd28..0000000000000000000000000000000000000000 --- a/build-tools/collect_application_api/README_EN.md +++ /dev/null @@ -1,16 +0,0 @@ -COLLECT_APPLICATION_API - -Usage -1.Install - Install the npm dependencies(You must have node&npm installed): - $npm install - -2.Quick Start - In the src directory - $node format - -3.Directory Structure - ./sdk--- directory path of API files - ./application--- directory path of application - ./deps--- directory path of source code - ./src--- directory path of result \ No newline at end of file diff --git a/build-tools/collect_application_api/README_zh.md b/build-tools/collect_application_api/README_zh.md new file mode 100644 index 0000000000000000000000000000000000000000..ec7e2df2a41813371fb8c59060f370f7d81c6404 --- /dev/null +++ b/build-tools/collect_application_api/README_zh.md @@ -0,0 +1,36 @@ +# 应用API解析工具 + +## 简介 + +该工具可用于解析应用中使用的API,并汇总成表格,提供给应用开发者 + +## 目录 + +``` +├─sdk #存放API文件的目录(sdk中,ets目录下的api文件夹和build-tools文件夹) +├─application #存放被解析的应用源码 +├─deps #存放typescript源码 +└─src #存放源码以及生成的表格 +``` + +## 使用方法 + +### 目录配置 + +新建sdk文件夹,放置api文件; + +新建application文件夹,放置被解析的应用源码; + +新建deps文件夹,放置[typescript源码](https://gitee.com/openharmony/third_party_typescript/tree/master/build_package)。 + +### 安装 + +需要安装npm依赖环境:$npm install。 + +### 使用工具 + +进入src目录下:$node format。 + +## 相关文件夹 + +[collect_application_api](https://gitee.com/openharmony/interface_sdk-js/tree/master/build-tools/collect_application_api) \ No newline at end of file diff --git a/build-tools/delete_systemapi_plugin.js b/build-tools/delete_systemapi_plugin.js index db69d1a5f1dd102aa38ad6ff667c6cca3a76ebc4..ac7a6d30ea208bd09503243753cec8b43ba50eff 100644 --- a/build-tools/delete_systemapi_plugin.js +++ b/build-tools/delete_systemapi_plugin.js @@ -129,6 +129,9 @@ function formatImportDeclaration(url) { const clauseNode = statement.importClause; if (!clauseNode.namedBindings && clauseNode.name && ts.isIdentifier(clauseNode.name)) { clauseSet.add(clauseNode.name.escapedText.toString()); + } else if (clauseNode.namedBindings && clauseNode.namedBindings.name && + ts.isIdentifier(clauseNode.namedBindings.name)) { + clauseSet.add(clauseNode.namedBindings.name.escapedText.toString()); } else if (clauseNode.namedBindings && clauseNode.namedBindings.elements) { clauseNode.namedBindings.elements.forEach(ele => { if (ele.name && ts.isIdentifier(ele.name)) { @@ -277,7 +280,9 @@ function deleteSystemApi(url) { exports.deleteSystemApi = deleteSystemApi; function isSystemapi(node) { - const notesStr = node.getFullText().replace(node.getText(), "").replace(/[\s]/g, ""); + const notesContent = node.getFullText().replace(node.getText(), "").replace(/[\s]/g, ""); + const notesArr = notesContent.split(/\/\*\*/); + const notesStr = notesArr[notesArr.length - 1]; if (notesStr.length !== 0) { if (ts.isFunctionDeclaration(node) || ts.isMethodSignature(node) || ts.isMethodDeclaration(node)) { lastNodeName = node.name && node.name.escapedText ? node.name.escapedText.toString() : ""; diff --git a/build-tools/permissions_converter/.vscode/settings.json b/build-tools/permissions_converter/.vscode/settings.json new file mode 100644 index 0000000000000000000000000000000000000000..51dc9242112d062632635868b503ec3dcfa674c5 --- /dev/null +++ b/build-tools/permissions_converter/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "editor.suggest.snippetsPreventQuickSuggestions": false +} diff --git a/build-tools/permissions_converter/convert.js b/build-tools/permissions_converter/convert.js new file mode 100644 index 0000000000000000000000000000000000000000..3c54fb7e7d3a0e8d5db5a154a1ad66c8ce8913dc --- /dev/null +++ b/build-tools/permissions_converter/convert.js @@ -0,0 +1,111 @@ +/* + * 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. + */ + +const fs = require('fs'); + +const copyRight = `/* + * 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. + */\n\n`; +const typeHead = 'export type Permissions =\n'; +const typeTail = ';'; +const tab = ' '; +const tabs = tab.repeat(2); +const tabzz = tab.repeat(3); +const commentHead = `${tabs}/**\n`; +const commentBody = `${tabzz}* `; +const commentTail = `${tabzz}*/\n`; +const sinceTag = '@since '; +const deprecatedTag = '@deprecated '; +const orOperator = `${tabs}|${tab}`; + +const getPermissions = downloadPath => { + try { + const content = fs.readFileSync(downloadPath, { encoding: 'utf8' }); + const configMap = JSON.parse(decodeURIComponent(content)); + if (configMap.module.definePermissions) { + return configMap.module.definePermissions; + } + } catch (error) { + console.error('Convert json file to object failed'); + } + return undefined; +}; + +const convertJsonToDTS = (permissions, outputFilePath) => { + if (fs.existsSync(outputFilePath)) { + fs.unlinkSync(outputFilePath); + } + fs.appendFileSync(outputFilePath, copyRight, 'utf8'); + fs.appendFileSync(outputFilePath, typeHead, 'utf8'); + permissions.forEach((permission, index) => { + if (permission.since || permission.deprecated) { + fs.appendFileSync(outputFilePath, commentHead, 'utf8'); + if (permission.since) { + const since = `${commentBody}${sinceTag}${permission.since}\n`; + fs.appendFileSync(outputFilePath, since, 'utf8'); + } + if (permission.deprecated) { + const deprecated = `${commentBody}${deprecatedTag}${permission.deprecated}\n`; + fs.appendFileSync(outputFilePath, deprecated, 'utf8'); + } + fs.appendFileSync(outputFilePath, commentTail, 'utf8'); + } + const permissionName = `${index === 0 ? tabs : orOperator}'${permission.name}'${ + index === permissions.length - 1 ? '' : '\n' + }`; + fs.appendFileSync(outputFilePath, permissionName, 'utf8'); + }); + fs.appendFileSync(outputFilePath, typeTail, 'utf8'); + console.log('Convert config.json definePermissions to permissions.d.ts successfully'); +}; + +/** + * Read config.json file and convert it to permission.d.ts + * + * @param { + * filePath: name of downloaded config.json file + * outputFileName: name of converted d.ts file name + * } options + */ +const convert = options => { + const permissions = getPermissions(options.filePath); + if (permissions) { + convertJsonToDTS(permissions, options.outputFilePath); + } else { + console.error('Config file does not have definePermissions property'); + } +}; + +const arguments = process.argv; +const options = { + filePath: arguments[2], + outputFilePath: arguments[3], +}; +try { + convert(options); +} catch (error) { + console.error(`ERROR FOR CONVERTING PERMISSION: ${error}`); +} diff --git a/build-tools/permissions_converter/package.json b/build-tools/permissions_converter/package.json new file mode 100644 index 0000000000000000000000000000000000000000..a0dec26bd57461d1ace84f44986273b599cae801 --- /dev/null +++ b/build-tools/permissions_converter/package.json @@ -0,0 +1,6 @@ +{ + "name": "permissions", + "version": "1.0.0", + "description": "", + "main": "./convert.js" +}