Merge branch 'master' of gitee.com:openharmony/interface_sdk-js into master

Signed-off-by: 刘彬俊 <liubinjun@huawei.com>
This commit is contained in:
刘彬俊 2022-11-14 11:34:08 +00:00 committed by liu-binjun
commit bbe8c5b5af
314 changed files with 47854 additions and 9773 deletions

View File

@ -68,6 +68,7 @@ template("ohos_declaration_template") {
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"

View File

@ -1,8 +1,31 @@
# API声明文件公共仓<a name="ZH-CN_TOPIC_0000001151209521"></a>
# API声明文件公共仓
- [简介](#section11660541593)
## 简介
## 简介<a name="section11660541593"></a>
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)

View File

@ -25,7 +25,7 @@ interface AbilityComponentInterface {
* @since 9
* @systemapi
*/
(want: Want): AbilityComponentAttribute;
(value: {want: import('../api/@ohos.application.Want').default}): AbilityComponentAttribute;
}
/**

View File

@ -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
@ -700,23 +732,27 @@ declare enum RepeatMode {
/**
* enum Blur style
* @since 9
* @systemapi
*/
declare enum BlurStyle {
/**
* Defines the fuzzy scale.
* @since 9
* @systemapi
*/
Thin,
/**
* Defines the fuzzy scale.
* @since 9
* @systemapi
*/
Regular,
/**
* Defines the fuzzy scale.
* @since 9
* @systemapi
*/
Thick,
}
@ -743,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;
}
/**
@ -1130,6 +1189,12 @@ declare interface PopupOptions {
* @since 9
*/
arrowOffset?: Length;
/**
* Whether to display in the sub window.
* @since 9
*/
showInSubWindow?: boolean;
}
/**
@ -1184,6 +1249,12 @@ declare interface CustomPopupOptions {
* @since 9
*/
arrowOffset?: Length;
/**
* Whether to display in the sub window.
* @since 9
*/
showInSubWindow?: boolean;
}
/**
@ -1292,6 +1363,7 @@ declare class CommonMethod<T> {
* Background blur style.
* blurStyle:Blur style type.
* @since 9
* @systemapi
*/
backgroundBlurStyle(value: BlurStyle): T;
@ -1696,6 +1768,8 @@ declare class CommonMethod<T> {
/**
* 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 };
@ -1998,6 +2072,73 @@ declare class CommonShapeMethod<T> extends CommonMethod<T> {
strokeDashArray(value: Array<any>): T;
}
/**
* Sub component border info.
* @since 9
*/
declare interface LayoutBorderInfo {
borderWidth: EdgeWidths,
margin: Margin,
padding: Padding,
}
/**
* Sub component layout info.
* @since 9
*/
declare interface LayoutInfo {
position: Position,
constraint: ConstraintSizeOptions,
}
/**
* Sub component info passed from framework when layout and measure happens.
* @since 9
*/
declare interface LayoutChild {
/**
* Sub component name.
* @since 9
*/
name: string,
/**
* Sub component id.
* @since 9
*/
id: string,
/**
* Sub component constraint.
* @since 9
*/
constraint: ConstraintSizeOptions,
/**
* Sub component border info.
* @since 9
*/
borderInfo: LayoutBorderInfo,
/**
* Sub component position.
* @since 9
*/
position: Position,
/**
* Call this measure method in onMeasure callback to supply sub component size.
* @since 9
*/
measure(childConstraint: ConstraintSizeOptions),
/**
* Call this layout method in onLayout callback to assign layout info to sub component.
* @since 9
*/
layout(childLayoutInfo: LayoutInfo)
}
/**
* Custom Component
* @since 7
@ -2026,6 +2167,18 @@ declare class CustomComponent extends CommonAttribute {
*/
aboutToDisappear?(): void;
/**
* Custom component override this method to layout each of its sub components.
* @since 9
*/
onLayout?(children: Array<LayoutChild>, constraint: ConstraintSizeOptions): void;
/**
* Custom component override this method to measure each of its sub components.
* @since 9
*/
onMeasure?(children: Array<LayoutChild>, constraint: ConstraintSizeOptions): void;
/**
* onPageShow Method
* @since 7
@ -2043,6 +2196,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;
}
/**

View File

@ -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

View File

@ -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,
@ -1475,7 +1478,7 @@ declare enum CopyOptions {
* Defines the hit test mode.
* @since 9
*/
declare enum HitTestMode {
declare enum HitTestMode {
/**
* Both self and children nodes respond to the hit test for touch events,
* but block hit test of the other nodes which is masked by this node.
@ -1503,4 +1506,22 @@ declare enum CopyOptions {
* @since 9
*/
None,
}
/**
* Title height.
* @since 9
*/
declare enum TitleHeight {
/**
* Title height when only main title is avaliable.
* @since 9
*/
MainOnly,
/**
* Title height when main title and subtitle are both avaliable.
* @since 9
*/
MainWithSub,
}

View File

@ -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<FlowItemAttribute> {}
declare const FlowItem: FlowItemInterface
declare const FlowItemInstance: FlowItemAttribute;

View File

@ -63,9 +63,29 @@ declare enum FormDimension {
interface FormComponentInterface {
/**
* Set a new value.
* @param { number } id - id indicates the formId
* @param { string } name - name indicates the form name
* @param { string } bundle - bundle indicates the form provider's bundle name
* @param { string } ability - ability indicates the form provider's ability name
* @param { string } module - module indicates the form provider's ability name
* @param { FormDimension } [options] - dimension indicates the form size
* @param { boolean } [options] - temporary indicates that if the form is temporary
* @since 7
* @systemapi
*/
/**
* Set a new value.
* @param { number } id - id indicates the formId
* @param { string } name - name indicates the form name
* @param { string } bundle - bundle indicates the form provider's bundle name
* @param { string } ability - ability indicates the form provider's ability name
* @param { string } module - module indicates the form provider's ability name
* @param { FormDimension } [options] - dimension indicates the form size
* @param { boolean } [options] - temporary indicates that if the form is temporary
* @param { Want } [options] - want indicates the want that host send to form provider
* @since 9
* @systemapi
*/
(value: {
id: number;
name: string;
@ -74,6 +94,7 @@ interface FormComponentInterface {
module: string;
dimension?: FormDimension;
temporary?: boolean;
want?: import('../api/@ohos.application.Want').default;
}): FormComponentAttribute;
}

View File

@ -89,7 +89,7 @@ interface GridColInterface {
* Defines the constructor of GridContainer.
* @since 9
*/
(optiion?: GridColOptions): GridColAttribute;
(option?: GridColOptions): GridColAttribute;
}
declare class GridColAttribute extends CommonMethod<GridColAttribute> {

View File

@ -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 {}

View File

@ -54,6 +54,8 @@
/// <reference path="./list_item_group.d.ts" />
/// <reference path="./loading_progress.d.ts" />
/// <reference path="./marquee.d.ts" />
/// <reference path="./nav_destination.d.ts" />
/// <reference path="./nav_router.d.ts" />
/// <reference path="./navigation.d.ts" />
/// <reference path="./navigator.d.ts" />
/// <reference path="./page_transition.d.ts" />
@ -99,10 +101,11 @@
/// <reference path="./video.d.ts" />
/// <reference path="./web.d.ts" />
/// <reference path="./xcomponent.d.ts" />
/// <reference path="./inspector.d.ts" />
/// <reference path="./sidebar.d.ts" />
/// <reference path="./ability_component.d.ts" />
/// <reference path="./remote_window.d.ts" />
/// <reference path="./common_ts_ets_api.d.ts" />
/// <reference path="./grid_row.d.ts" />
/// <reference path="./grid_col.d.ts" />
/// <reference path="./water_flow.d.ts" />
/// <reference path="./flow_item.d.ts" />

View File

@ -17,6 +17,8 @@
/**
* Declare item ceiling attribute.
* @since 7
* @deprecated since 9
* @useinstead list/StickyStyle
*/
declare enum Sticky {
/**
@ -128,6 +130,8 @@ declare class ListItemAttribute extends CommonMethod<ListItemAttribute> {
/**
* Called when setting whether item is ceiling effect.
* @since 7
* @deprecated since 9
* @useinstead list/List#sticky
*/
sticky(value: Sticky): ListItemAttribute;

View File

@ -0,0 +1,84 @@
/*
* 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 navigation destination common title.
* @since 9
*/
declare interface NavDestinationCommonTitle {
/**
* Sets the main title.
* @since 9
*/
main: string;
/**
* Sets the sub title.
* @since 9
*/
sub: string;
}
/**
* Defines the navigation destination custom title.
* @since 9
*/
declare interface NavDestinationCustomTitle {
/**
* Sets the custom title builder.
* @since 9
*/
builder: CustomBuilder;
/**
* Sets the custom title height.
* @since 9
*/
height: TitleHeight | Length;
}
/**
* The construct function of NavDestination.
* @since 9
*/
declare interface NavDestinationInterface {
/**
* Constructor.
* @since 9
*/
(): NavDestinationAttribute;
}
/**
* The attribute function of NavDestination
* @since 9
*/
declare class NavDestinationAttribute extends CommonMethod<NavDestinationAttribute> {
/**
* Navigation title bar
* @since 9
*/
title(value: string | CustomBuilder | NavDestinationCommonTitle | NavDestinationCustomTitle): NavDestinationAttribute;
/**
* Hide navigation title bar
* @since 9
*/
hideTitleBar(value: boolean): NavDestinationAttribute;
}
declare const NavDestination: NavDestinationInterface;
declare const NavDestinationInstance: NavDestinationAttribute;

View File

@ -0,0 +1,42 @@
/*
* 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 construct function of NavRouter.
* @since 9
*/
declare interface NavRouterInterface {
/**
* Constructor.
* @since 9
*/
(): NavRouterAttribute;
}
/**
* The attribute function of NavRouter
* @since 9
*/
declare class NavRouterAttribute extends CommonMethod<NavRouterAttribute> {
/**
* Trigger callback when NavigationView state change.
* @since 9
*/
onStateChange(callback: (isActivated: boolean) => void): NavRouterAttribute;
}
declare const NavRouter: NavRouterInterface;
declare const NavRouterInstance: NavRouterAttribute;

View File

@ -13,6 +13,82 @@
* limitations under the License.
*/
/**
* Defines the navigation common title.
* @since 9
*/
declare interface NavigationCommonTitle {
/**
* Sets the main title.
* @since 9
*/
main: string;
/**
* Sets the sub title.
* @since 9
*/
sub: string;
}
/**
* Defines the navigation custom title.
* @since 9
*/
declare interface NavigationCustomTitle {
/**
* Sets the custom title builder.
* @since 9
*/
builder: CustomBuilder;
/**
* Sets the custom title height.
* @since 9
*/
height: TitleHeight | Length;
}
/**
* Nativation mode
* @since 9
*/
declare enum NavigationMode {
/**
* The navigation bar and the content area are displayed in stack.
* @since 9
*/
Stack,
/**
* The navigation bar and the content area are displayed side by side.
* @since 9
*/
Split,
/**
* If the window width is greater than 520vp, the navigation component is displayed in split mode.
* Otherwise it's displayed in stack mode.
* @since 9
*/
Auto,
}
/**
* Navigation bar position
* @since 9
*/
declare enum NavBarPosition {
/**
* The navigation bar is on the Start of the container
* @since 9
*/
Start,
/**
* The navigation bar is on the End of the container
* @since 9
*/
End,
}
/**
* Naivagtion title mode.
* @since 8
@ -72,20 +148,52 @@ interface NavigationInterface {
* @since 8
*/
declare class NavigationAttribute extends CommonMethod<NavigationAttribute> {
/**
* Sets the width of navigation bar.
* @since 9
*/
navBarWidth(value: Length): NavigationAttribute;
/**
* Sets the position of navigation bar.
* @since 9
*/
navBarPosition(value: NavBarPosition): NavigationAttribute;
/**
* Sets the mode of navigation.
* @since 9
*/
mode(value: NavigationMode): NavigationAttribute;
/**
* Sets the back button icon.
* @since 9
*/
backButtonIcon(value: string | PixelMap | Resource): NavigationAttribute;
/**
* Hide the navigation bar.
* @since 9
*/
hideNavBar(value: boolean): NavigationAttribute;
/**
* Navigation title
* @since 8
*/
title(value: string | CustomBuilder): NavigationAttribute;
title(value: string | CustomBuilder | NavigationCommonTitle | NavigationCustomTitle): NavigationAttribute;
/**
* Navigation subtitle
* @since 8
* @deprecated since 9
* @useinstead title
*/
subTitle(value: string): NavigationAttribute;
/**
* Hide navigation bar
* Hide navigation title bar
* @since 8
*/
hideTitleBar(value: boolean): NavigationAttribute;
@ -125,6 +233,12 @@ declare class NavigationAttribute extends CommonMethod<NavigationAttribute> {
* @since 8
*/
onTitleModeChange(callback: (titleMode: NavigationTitleMode) => void): NavigationAttribute;
/**
* Trigger callback when the visibility of navigation bar change.
* @since 9
*/
onNavBarStateChange(callback: (isVisible: boolean) => void): NavigationAttribute;
}
declare const Navigation: NavigationInterface;

View File

@ -81,4 +81,13 @@ declare class RectAttribute extends CommonShapeMethod<RectAttribute> {
}
declare const Rect: RectInterface;
/**
* @deprecated since 9
*/
declare const RectInStance: RectAttribute;
/**
* @since 9
*/
declare const RectInstance: RectAttribute;

View File

@ -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

View File

@ -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<WaterFlowAttribute> {
/**
* 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;

View File

@ -13,6 +13,8 @@
* limitations under the License.
*/
declare type WebviewController = import('../api/@ohos.web.webview').default.WebviewController;
/**
* Enum type supplied to {@link getMessageLevel} for receiving the console log level of JavaScript.
* @since 8
@ -157,6 +159,24 @@ declare enum CacheMode {
Only,
}
/**
* Define the handler to exit the full screen mode, related to the {@link onFullScreenEnter} event.
* @since 9
*/
declare class FullScreenExitHandler {
/**
* Constructor.
* @since 9
*/
constructor();
/**
* Exit the full screen mode.
* @since 9
*/
exitFullScreen(): void;
}
/**
* Define html5 web message port.
* @since 9
@ -570,6 +590,24 @@ declare class PermissionRequest {
grant(resources: Array<string>): void;
}
/**
* Defines the onWindowNew callback, related to {@link onWindowNew} method.
* @since 9
*/
declare class ControllerHandler {
/**
* Constructor.
* @since 9
*/
constructor();
/**
* Set WebController object.
* @since 9
*/
setWebController(controller: WebController): void;
}
/**
* Defines the context menu param, related to {@link WebContextMenuParam} method.
* @since 9
@ -671,9 +709,17 @@ declare class ConsoleMessage {
* @param messageLevel The console log level.
*
* @since 8
* @deprecated since 9
* @useinstead ohos.web.ConsoleMessage#constructor
*/
constructor(message: string, sourceId: string, lineNumber: number, messageLevel: MessageLevel);
/**
* Constructor.
* @since 9
*/
constructor();
/**
* Gets the message of a console message.
* @return Return the message of a console message.
@ -1003,6 +1049,7 @@ declare class WebCookie {
* Sets the cookie.
* @since 8
* @deprecated since 9
* @useinstead ohos.web.webview.webview.WebCookieManager#setCookie
*/
setCookie();
@ -1016,6 +1063,7 @@ declare class WebCookie {
* Saves the cookies.
* @since 8
* @deprecated since 9
* @useinstead ohos.web.webview.webview.WebCookieManager#saveCookieAsync
*/
saveCookie();
@ -1068,23 +1116,30 @@ declare class WebCookie {
/**
* Defines the Web controller.
* @since 8
* @deprecated since 9
* @useinstead ohos.web.webview.webview.WebviewController
*/
declare class WebController {
/**
* Constructor.
* @since 8
* @deprecated since 9
*/
constructor();
/**
* Let the Web inactive.
* @since 8
* @deprecated since 9
* @useinstead ohos.web.webview.webview.WebviewController#onInactive
*/
onInactive(): void;
/**
* Let the Web active.
* @since 8
* @deprecated since 9
* @useinstead ohos.web.webview.webview.WebviewController#onActive
*/
onActive(): void;
@ -1093,6 +1148,8 @@ declare class WebCookie {
* @param factor The zoom factor.
*
* @since 8
* @deprecated since 9
* @useinstead ohos.web.webview.webview.WebviewController#zoom
*/
zoom(factor: number): void;
@ -1111,6 +1168,8 @@ declare class WebCookie {
/**
* Clears the history in the Web.
* @since 8
* @deprecated since 9
* @useinstead ohos.web.webview.webview.WebviewController#clearHistory
*/
clearHistory(): void;
@ -1119,6 +1178,8 @@ declare class WebCookie {
* @param options The options with a piece of code and a callback.
*
* @since 8
* @deprecated since 9
* @useinstead ohos.web.webview.webview.WebviewController#runJavaScript
*/
runJavaScript(options: { script: string, callback?: (result: string) => void });
@ -1142,6 +1203,8 @@ declare class WebCookie {
* @param options The options with the data or URL and other information.
*
* @since 8
* @deprecated since 9
* @useinstead ohos.web.webview.webview.WebviewController#loadData
*/
loadData(options: { data: string, mimeType: string, encoding: string, baseUrl?: string, historyUrl?: string });
@ -1150,18 +1213,24 @@ declare class WebCookie {
* @param options The options with the URL and other information.
*
* @since 8
* @deprecated since 9
* @useinstead ohos.web.webview.webview.WebviewController#loadUrl
*/
loadUrl(options: { url: string | Resource, headers?: Array<Header> });
/**
* refreshes the current URL.
* @since 8
* @deprecated since 9
* @useinstead ohos.web.webview.webview.WebviewController#refresh
*/
refresh();
/**
* Stops the current load.
* @since 8
* @deprecated since 9
* @useinstead ohos.web.webview.webview.WebviewController#stop
*/
stop();
@ -1170,6 +1239,8 @@ declare class WebCookie {
* @param options The option with the JavaScript object and method list.
*
* @since 8
* @deprecated since 9
* @useinstead ohos.web.webview.webview.WebviewController#registerJavaScriptProxy
*/
registerJavaScriptProxy(options: { object: object, name: string, methodList: Array<string> });
@ -1178,12 +1249,16 @@ declare class WebCookie {
* @param name The name of a registered JavaScript object to be deleted.
*
* @since 8
* @deprecated since 9
* @useinstead ohos.web.webview.webview.WebviewController#deleteJavaScriptRegister
*/
deleteJavaScriptRegister(name: string);
/**
* Gets the type of HitTest.
* @since 8
* @deprecated since 9
* @useinstead ohos.web.webview.webview.WebviewController#getHitTest
*/
getHitTest(): HitTestType;
@ -1220,18 +1295,24 @@ declare class WebCookie {
/**
* Gets the request focus.
* @since 8
* @deprecated since 9
* @useinstead ohos.web.webview.webview.WebviewController#requestFocus
*/
requestFocus();
/**
* Checks whether the web page can go back.
* @since 8
* @deprecated since 9
* @useinstead ohos.web.webview.webview.WebviewController#accessBackward
*/
accessBackward(): boolean;
/**
* Checks whether the web page can go forward.
* @since 8
* @deprecated since 9
* @useinstead ohos.web.webview.webview.WebviewController#accessForward
*/
accessForward(): boolean;
@ -1240,18 +1321,24 @@ declare class WebCookie {
* @param step The number of steps.
*
* @since 8
* @deprecated since 9
* @useinstead ohos.web.webview.webview.WebviewController#accessStep
*/
accessStep(step: number): boolean;
/**
* Goes back in the history of the web page.
* @since 8
* @deprecated since 9
* @useinstead ohos.web.webview.webview.WebviewController#backward
*/
backward();
/**
* Goes forward in the history of the web page.
* @since 8
* @deprecated since 9
* @useinstead ohos.web.webview.webview.WebviewController#forward
*/
forward();
@ -1299,6 +1386,13 @@ declare class WebCookie {
* @since 9
*/
clearClientAuthenticationCache(): void;
/**
* Gets the url of current Web page.
* @return the url of current Web page.
* @since 9
*/
getUrl(): string;
}
/**
@ -1313,9 +1407,15 @@ declare interface WebOptions {
src: string | Resource;
/**
* Sets the controller of the Web.
* @type { (WebController) }
* @since 8
*/
controller: WebController;
/**
* Sets the controller of the Web.
* @type { (WebController | WebviewController) }
* @since 9
*/
controller: WebController | WebviewController;
}
/**
@ -1351,15 +1451,6 @@ declare class WebAttribute extends CommonMethod<WebAttribute> {
*/
fileAccess(fileAccess: boolean): WebAttribute;
/**
* Sets whether javaScript running in the context of a file URL can access content from other file URLs.
* @param fileFromUrlAccess {@code true} means enable a file URL can access other file URLs;
* {@code false} otherwise.
*
* @since 9
*/
fileFromUrlAccess(fileFromUrlAccess: boolean): WebAttribute;
/**
* Sets whether to allow image resources to be loaded from the network.
* @param onlineImageAccess {@code true} means the Web can allow image resources to be loaded from the network;
@ -1413,10 +1504,18 @@ declare class WebAttribute extends CommonMethod<WebAttribute> {
* Injects the JavaScript object into window and invoke the function in window.
* @param javaScriptProxy The JavaScript object to be injected.
*
* @type {controller : WebController}
* @since 8
*/
/**
* Injects the JavaScript object into window and invoke the function in window.
* @param javaScriptProxy The JavaScript object to be injected.
*
* @type {controller : WebController | WebviewController}
* @since 9
*/
javaScriptProxy(javaScriptProxy: { object: object, name: string, methodList: Array<string>,
controller: WebController }): WebAttribute;
controller: WebController | WebviewController }): WebAttribute;
/**
* Sets whether the Web should save the password.
@ -1697,6 +1796,22 @@ declare class WebAttribute extends CommonMethod<WebAttribute> {
*/
onResourceLoad(callback: (event: {url: string}) => void): WebAttribute;
/**
* Triggered when the web component exit the full screen mode.
* @param callback The triggered function when the web component exit the full screen mode.
*
* @since 9
*/
onFullScreenExit(callback: () => void): WebAttribute;
/**
* Triggered when the web component enter the full screen mode.
* @param callback The triggered function when the web component enter the full screen mode.
*
* @since 9
*/
onFullScreenEnter(callback: (event: { handler: FullScreenExitHandler}) => void): WebAttribute;
/**
* Triggered when the scale of WebView changed.
* @param callback The triggered when the scale of WebView changed.
@ -1781,6 +1896,31 @@ declare class WebAttribute extends CommonMethod<WebAttribute> {
*/
onClientAuthenticationRequest(callback: (event: {handler : ClientAuthenticationHandler, host : string, port : number,
keyTypes : Array<string>, issuers : Array<string>}) => void): WebAttribute;
/**
* Triggered when web page requires the user to create a window.
* @param callback The triggered callback when web page requires the user to create a window.
*
* @since 9
*/
onWindowNew(callback: (event: {isAlert: boolean, isUserTrigger: boolean, targetUrl: string,
handler: ControllerHandler}) => void): WebAttribute;
/**
* Triggered when web page requires the user to close a window.
* @param callback The triggered callback when web page requires the user to close a window.
*
* @since 9
*/
onWindowExit(callback: () => void): WebAttribute;
/**
* Set whether multiple windows are supported.
* @param multiWindow True if it needs to be triggered manually by the user else false.
*
* @since 9
*/
multiWindowAccess(multiWindow: boolean): WebAttribute;
}
declare const Web: WebInterface;

View File

@ -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;
}
/**

View File

@ -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.

View File

@ -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
}

View File

@ -19,6 +19,8 @@
* @since 6
* @syscap SystemCapability.Ability.AbilityBase
* @permission N/A
* @deprecated since 9
* @useinstead ohos.app.ability.wantConstant
*/
declare namespace wantConstant {
/**
@ -213,9 +215,18 @@ declare namespace wantConstant {
* Indicates the action of providing oauth service.
*
* @since 8
* @deprecated since 9
* @useinstead wantConstant.Action#ACTION_APP_ACCOUNT_AUTH
*/
ACTION_APP_ACCOUNT_OAUTH = "ohos.account.appAccount.action.oauth",
/**
* Indicates the action of providing auth service.
*
* @since 9
*/
ACTION_APP_ACCOUNT_AUTH = "account.appAccount.action.auth",
/**
* Indicates the action of an application downloaded from the application market.
*

View File

@ -14,6 +14,7 @@
*/
import { AsyncCallback, Callback } from './basic';
import { Permissions } from './permissions';
/**
* @syscap SystemCapability.Security.AccessToken
@ -37,52 +38,99 @@ import { AsyncCallback, Callback } from './basic';
* @param permissionName The permission name to be verified.
* @return Returns permission verify result.
* @since 8
* @deprecated since 9
* @useinstead ohos.abilityAccessCtrl.AtManager#checkAccessToken
*/
verifyAccessToken(tokenID: number, permissionName: string): Promise<GrantStatus>;
/**
* 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<GrantStatus>;
/**
* Checks whether a specified application has been granted the given permission synchronously.
* @param tokenID The tokenId of specified application.
* @param permissionName The permission name to be verified.
* @return Returns permission verify result
* @throws { BusinessError } 401 - The parameter check failed.
* @throws { BusinessError } 12100001 - The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256.
* @return Returns permission verify result.
* @since 9
*/
verifyAccessTokenSync(tokenID: number, permissionName: string): GrantStatus;
verifyAccessTokenSync(tokenID: number, permissionName: Permissions): GrantStatus;
/**
* 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.
* @throws { BusinessError } 401 - The parameter check failed.
* @throws { BusinessError } 12100001 - The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256.
* @return Returns permission verify result.
* @since 9
*/
checkAccessToken(tokenID: number, permissionName: Permissions): Promise<GrantStatus>;
/**
* Grants a specified user_grant permission to the given application.
* @param tokenID The tokenId of specified application.
* @param permissionName The permission name to be granted.
* @param permissionFlag Flag of permission state.
* @returns { void | Promise<void> } No callback return Promise otherwise return void.
* @throws { BusinessError } 401 - The parameter check failed.
* @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.GRANT_SENSITIVE_PERMISSIONS".
* @throws { BusinessError } 12100001 - The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256, or the flag value is invalid.
* @throws { BusinessError } 12100002 - The specified tokenID does not exist.
* @throws { BusinessError } 12100003 - The specified permission does not exist.
* @throws { BusinessError } 12100006 - The application specified by the tokenID is not allowed to be granted with the specified permission. Either the application is a sandbox or the tokenID is from a remote device.
* @throws { BusinessError } 12100007 - Service is abnormal.
* @permission ohos.permission.GRANT_SENSITIVE_PERMISSIONS.
* @systemapi
* @since 8
*/
grantUserGrantedPermission(tokenID: number, permissionName: string, permissionFlag: number): Promise<number>;
grantUserGrantedPermission(tokenID: number, permissionName: string, permissionFlag: number, callback: AsyncCallback<number>): void;
grantUserGrantedPermission(tokenID: number, permissionName: Permissions, permissionFlag: number): Promise<void>;
grantUserGrantedPermission(tokenID: number, permissionName: Permissions, permissionFlag: number, callback: AsyncCallback<void>): void;
/**
* Revokes a specified user_grant permission to the given application.
* @param tokenID The tokenId of specified application.
* @param permissionName The permission name to be revoked.
* @param permissionFlag Flag of permission state.
* @returns { void | Promise<void> } No callback return Promise otherwise return void.
* @throws { BusinessError } 401 - The parameter check failed.
* @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.REVOKE_SENSITIVE_PERMISSIONS".
* @throws { BusinessError } 12100001 - The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256, or the flag value is invalid.
* @throws { BusinessError } 12100002 - The specified tokenID does not exist.
* @throws { BusinessError } 12100003 - The specified permission does not exist.
* @throws { BusinessError } 12100006 - The application specified by the tokenID is not allowed to be revoked with the specified permission. Either the application is a sandbox or the tokenID is from a remote device.
* @throws { BusinessError } 12100007 - Service is abnormal.
* @permission ohos.permission.REVOKE_SENSITIVE_PERMISSIONS.
* @systemapi
* @since 8
*/
revokeUserGrantedPermission(tokenID: number, permissionName: string, permissionFlag: number): Promise<number>;
revokeUserGrantedPermission(tokenID: number, permissionName: string, permissionFlag: number, callback: AsyncCallback<number>): void;
revokeUserGrantedPermission(tokenID: number, permissionName: Permissions, permissionFlag: number): Promise<void>;
revokeUserGrantedPermission(tokenID: number, permissionName: Permissions, permissionFlag: number, callback: AsyncCallback<void>): void;
/**
* Queries specified permission flag of the given application.
* @param tokenID The tokenId of specified application.
* @param permissionName The permission name to be granted.
* @return Return permission flag.
* @throws { BusinessError } 401 - The parameter check failed.
* @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission specified below.
* @throws { BusinessError } 12100001 - The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256.
* @throws { BusinessError } 12100002 - The specified tokenID does not exist.
* @throws { BusinessError } 12100003 - The specified permission does not exist.
* @throws { BusinessError } 12100006 - The operation is not allowd. Either the application is a sandbox or the tokenID is from a remote device.
* @throws { BusinessError } 12100007 - Service is abnormal.
* @permission ohos.permission.GET_SENSITIVE_PERMISSIONS or ohos.permission.GRANT_SENSITIVE_PERMISSIONS or ohos.permission.REVOKE_SENSITIVE_PERMISSIONS.
* @systemapi
* @since 8
*/
getPermissionFlags(tokenID: number, permissionName: string): Promise<number>;
getPermissionFlags(tokenID: number, permissionName: Permissions): Promise<number>;
/**
* Queries permission management version.
@ -108,23 +156,36 @@ import { AsyncCallback, Callback } from './basic';
* <li>{@code non-empty} - Indicates that the application can only be notified if the specified permission state of the specified applications changes.
* </li>
* </ul>
* @permission ohos.permission.GET_SENSITIVE_PERMISSIONS.
* @param callback Callback used to listen for the permission state changed event.
* @throws { BusinessError } 401 - The parameter check failed.
* @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.GET_SENSITIVE_PERMISSIONS".
* @throws { BusinessError } 12100001 - The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256.
* @throws { BusinessError } 12100004 - The interface is called repeatedly with the same input.
* @throws { BusinessError } 12100005 - The registration time has exceeded the limitation.
* @throws { BusinessError } 12100007 - Service is abnormal.
* @throws { BusinessError } 12100008 - Out of memory.
* @permission ohos.permission.GET_SENSITIVE_PERMISSIONS.
* @systemapi
* @since 9
*/
on(type: 'permissionStateChange', tokenIDList: Array<number>, permissionNameList: Array<string>, callback: Callback<PermissionStateChangeInfo>): void;
on(type: 'permissionStateChange', tokenIDList: Array<number>, permissionNameList: Array<Permissions>, callback: Callback<PermissionStateChangeInfo>): void;
/**
* Unregisters a permission state callback so that the specified applications cannot be notified upon specified permissions state changes anymore.
* @param tokenIDList A list of tokenids that specifies the applications being listened on. it should correspond to the value registered by function of "on", whose type is "permissionStateChange".
* @param permissionNameList A list of permissions that specifies the permissions being listened on. it should correspond to the value registered by function of "on", whose type is "permissionStateChange".
* @param callback Callback used to listen for the permission state changed event.
* @throws { BusinessError } 401 - The parameter check failed.
* @throws { BusinessError } 201 - Permission denied. Interface caller does not have permission "ohos.permission.GET_SENSITIVE_PERMISSIONS".
* @throws { BusinessError } 12100001 - The parameter is invalid. The tokenID in list is all invalid, or the permissionName in list is all invalid.
* @throws { BusinessError } 12100004 - The interface is not used with "on".
* @throws { BusinessError } 12100007 - Service is abnormal.
* @throws { BusinessError } 12100008 - Out of memory.
* @permission ohos.permission.GET_SENSITIVE_PERMISSIONS.
* @systemapi
* @since 9
*/
off(type: 'permissionStateChange', tokenIDList: Array<number>, permissionNameList: Array<string>, callback?: Callback<PermissionStateChangeInfo>): void;
off(type: 'permissionStateChange', tokenIDList: Array<number>, permissionNameList: Array<Permissions>, callback?: Callback<PermissionStateChangeInfo>): void;
}
/**
@ -178,7 +239,7 @@ import { AsyncCallback, Callback } from './basic';
/**
* Indicates the permission whose state has been changed.
*/
permissionName: string;
permissionName: Permissions;
}
}

View File

@ -0,0 +1,35 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"),
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { GesturePoint } from "./@ohos.accessibility.GesturePoint";
/**
* Indicates the path of the gesture.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
export declare class GesturePath {
constructor(durationTime: number);
/**
* Indicates the position of the points that make up the gesture.
* @type {Array<GesturePoint>}
*/
points: Array<GesturePoint>;
/**
* Indicates the duration of the gesture.
* @type {number}
*/
durationTime: number;
}

View File

@ -0,0 +1,33 @@
/*
* 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 point of the gesture.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @since 9
*/
export declare class GesturePoint {
constructor(positionX: number, positionY: number);
/**
* Indicates the X coordinate of point.
* @type {number}
*/
positionX: number;
/**
* Indicates the Y coordinate of point.
* @type {number}
*/
positionY: number;
}

View File

@ -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<accessibility.Capability>): Promise<void>;
function enableAbility(name: string, capability: Array<accessibility.Capability>, callback: AsyncCallback<void>): 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<void>;
function disableAbility(name: string, callback: AsyncCallback<void>): 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>): void;
function on(type: 'enabledAccessibilityExtensionListChange', callback: Callback<void>): 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>): void;
function off(type: 'enabledAccessibilityExtensionListChange', callback?: Callback<void>): 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<void>;
set(value: T, callback: AsyncCallback<void>): 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<T>): 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<T>): void;

View File

@ -24,13 +24,19 @@ import { Callback } from './basic';
* @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.
@ -98,7 +104,7 @@ declare namespace accessibility {
* @param callback Asynchronous callback interface.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @return Returns {@code true} if the accessibility is enabled; returns {@code false} otherwise.
*/
*/
function isOpenAccessibility(callback: AsyncCallback<boolean>): void;
function isOpenAccessibility(): Promise<boolean>;
@ -108,7 +114,7 @@ declare namespace accessibility {
* @param callback Asynchronous callback interface.
* @syscap SystemCapability.BarrierFree.Accessibility.Vision
* @return Returns {@code true} if the touch browser is enabled; returns {@code false} otherwise.
*/
*/
function isOpenTouchGuide(callback: AsyncCallback<boolean>): void;
function isOpenTouchGuide(): Promise<boolean>;
@ -119,24 +125,26 @@ declare namespace accessibility {
* @param stateType The state of the accessibility ability. {@code AbilityState} eg.installed
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @return Returns the list of abilityInfos.
*/
* @deprecated since 9
* @useinstead ohos.accessibility#getAccessibilityExtensionList
*/
function getAbilityLists(abilityType: AbilityType, stateType: AbilityState,
callback: AsyncCallback<Array<AccessibilityAbilityInfo>>): void;
function getAbilityLists(abilityType: AbilityType,
stateType: AbilityState): Promise<Array<AccessibilityAbilityInfo>>;
/**
* 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<Array<AccessibilityAbilityInfo>>): void;
function getAbilityLists(abilityType: 'all',
stateType: AbilityState): Promise<Array<AccessibilityAbilityInfo>>;
* @throws { BusinessError } 401 - Input parameter error.
*/
function getAccessibilityExtensionList(abilityType: AbilityType, stateType: AbilityState): Promise<Array<AccessibilityAbilityInfo>>;
function getAccessibilityExtensionList(abilityType: AbilityType, stateType: AbilityState, callback: AsyncCallback<Array<AccessibilityAbilityInfo>>): void;
/**
* Send accessibility Event.
@ -145,46 +153,64 @@ declare namespace accessibility {
* @param callback Asynchronous callback interface.
* @syscap SystemCapability.BarrierFree.Accessibility.Core
* @return Returns {@code true} if success ; returns {@code false} otherwise.
* @deprecated since 9
* @useinstead ohos.accessibility#sendAccessibilityEvent
*/
function sendEvent(event: EventInfo, callback: AsyncCallback<void>): void;
function sendEvent(event: EventInfo): Promise<void>;
/**
* 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
* @return Returns {@code true} if success ; returns {@code false} otherwise.
* @throws { BusinessError } 401 - Input parameter error.
*/
function sendAccessibilityEvent(event: EventInfo, callback: AsyncCallback<void>): void;
function sendAccessibilityEvent(event: EventInfo): Promise<void>;
/**
* 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.
* @throws { BusinessError } 401 - Input parameter error.
*/
function on(type: 'accessibilityStateChange', callback: Callback<boolean>): 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.
* @throws { BusinessError } 401 - Input parameter error.
*/
function on(type: 'touchGuideStateChange', callback: Callback<boolean>): 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.
* @return Returns {@code true} if the Unregister is success ; returns {@code false} otherwise.
* @throws { BusinessError } 401 - Input parameter error.
*/
function off(type: 'accessibilityStateChange', callback?: Callback<boolean>): 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.
* @return Returns {@code true} if the Unregister is success ; returns {@code false} otherwise.
* @throws { BusinessError } 401 - Input parameter error.
*/
function off(type: 'touchGuideStateChange', callback?: Callback<boolean>): void;
@ -212,19 +238,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<boolean>): void;
/**
* Register the observer of the style.
* @throws { BusinessError } 401 - Input parameter error.
*/
on(type: 'styleChange', callback: Callback<CaptionsStyle>): 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<boolean>): void;
/**
* Deregister the observer of the style.
* Unregister the observer of the style.
* @throws { BusinessError } 401 - Input parameter error.
*/
off(type: 'styleChange', callback?: Callback<CaptionsStyle>): void;
}

File diff suppressed because it is too large Load Diff

View File

@ -17,75 +17,122 @@ import {AsyncCallback} from './basic'
/**
* This module provides the capability to manage distributed accounts.
*
* @since 7
* @syscap SystemCapability.Account.OsAccount
* @since 7
*/
declare namespace distributedAccount {
/**
* Get the ability of the distributed account.
* @since 7
* @syscap SystemCapability.Account.OsAccount
* @permission N/A
* @return Ability to manage operations of distributed account.
* @syscap SystemCapability.Account.OsAccount
* @returns Ability to manage operations of distributed account.
* @since 7
*/
function getDistributedAccountAbility(): DistributedAccountAbility;
/**
* Defines distributed account functions and interfaces.
*
* @name DistributedAccountAbility
* @since 7
* @syscap SystemCapability.Account.OsAccount
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @syscap SystemCapability.Account.OsAccount
* @since 7
*/
interface DistributedAccountAbility {
/**
* Queries the distributed information of the current OS account.
*
* @since 7
* @return The distributed information of the current OS account.
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.DISTRIBUTED_DATASYNC
* @returns The distributed information of the current OS account.
* @since 7
* @deprecated since 9
* @useinstead distributedAccount.DistributedAccountAbility#getOsAccountDistributedInfo
*/
queryOsAccountDistributedInfo(callback: AsyncCallback<DistributedInfo>): void;
queryOsAccountDistributedInfo(): Promise<DistributedInfo>;
/**
* 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.
* @returns The distributed information of the current OS account.
* @throws {BusinessError} 201 - permission denied.
* @throws {BusinessError} 401 - the parameter check failed.
* @throws {BusinessError} 12300001 - system service exception.
* @since 9
*/
getOsAccountDistributedInfo(callback: AsyncCallback<DistributedInfo>): void;
getOsAccountDistributedInfo(): Promise<DistributedInfo>;
/**
* Updates the distributed information of the OS account.
*
* @since 7
* @param accountInfo Indicates the information of the OS account used for a distributed system.
* @return void
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS.
* @param accountInfo Indicates the information of the OS account used for a distributed system.
* @returns void
* @since 7
* @deprecated since 9
* @useinstead distributedAccount.DistributedAccountAbility#setOsAccountDistributedInfo
*/
updateOsAccountDistributedInfo(accountInfo: DistributedInfo, callback: AsyncCallback<void>): void;
updateOsAccountDistributedInfo(accountInfo: DistributedInfo): Promise<void>;
/**
* Sets the distributed information of the OS account.
* @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>): void;
setOsAccountDistributedInfo(accountInfo: DistributedInfo): Promise<void>;
}
/**
* Provides the distributed information of the OS account.
*
* @name DistributedInfo
* @since 7
* @syscap SystemCapability.Account.OsAccount
* @permission N/A
* @syscap SystemCapability.Account.OsAccount
* @since 7
*/
interface DistributedInfo {
/**
* The name in the distributed information of the OS account.
*
* @since 7
*/
name: string;
/**
* The ID in the distributed information of the OS account.
*
* @since 7
*/
id: string;
/**
* The event string in the distributed information of the OS account.
*/
*
* @since 7
*/
event: string;
/**
* The nickname in the distributed information of the OS account.
*
* @since 9
*/
nickname?: string;
/**
* The avatar in the distributed information of the OS account.
*
* @since 9
*/
avatar?: string;
/**
* The scalable data in the distributed information of the OS account.
*/

File diff suppressed because it is too large Load Diff

View File

@ -15,6 +15,7 @@
/**
* Defines the animator options.
* @interface
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 6
*/
@ -22,6 +23,7 @@ export interface AnimatorOptions {
/**
* Duration of the animation, in milliseconds.
* The default value is 0.
* @type {number}
* @since 6
*/
duration: number;
@ -44,6 +46,7 @@ export interface AnimatorOptions {
* cubic-bezier(x1, y1, x2, y2) You can customize an animation speed curve in the cubic-bezier() function. The x and y values of each input parameter must be between 0 and 1.
* Step curve. The number must be set and only an integer is supported, step-position is optional. It can be set to start or end. The default value is end.
* The default value is ease.
* @type {string}
* @since 6
*/
easing: string;
@ -51,6 +54,7 @@ export interface AnimatorOptions {
/**
* Delay for the animation start. The default value indicates no delay.
* The default value is 0.
* @type {number}
* @since 6
*/
delay: number;
@ -59,6 +63,7 @@ export interface AnimatorOptions {
* Whether to resume to the initial state after the animation is executed.
* none: The initial state is restored after the animation is executed.
* forwards: The state at the end of the animation (defined in the last key frame) is retained after the animation is executed.
* @type {string}
* @since 6
*/
fill: "none" | "forwards" | "backwards" | "both";
@ -66,6 +71,7 @@ export interface AnimatorOptions {
/**
* The animation playback mode.
* The default value is "normal".
* @type {string}
* @since 6
*/
direction: "normal" | "reverse" | "alternate" | "alternate-reverse";
@ -73,6 +79,7 @@ export interface AnimatorOptions {
/**
* Number of times the animation will be played. number indicates a fixed number of playback operations, and -1 an unlimited number of playback operations.
* The default value is 1.
* @type {number}
* @since 6
*/
iterations: number;
@ -80,6 +87,7 @@ export interface AnimatorOptions {
/**
* Starting point of animator interpolation.
* The default value is 0.
* @type {number}
* @since 6
*/
begin: number;
@ -87,6 +95,7 @@ export interface AnimatorOptions {
/**
* Ending point of Dynamic Interpolation
* The default value is 1.
* @type {number}
* @since 6
*/
end: number;
@ -94,59 +103,81 @@ export interface AnimatorOptions {
/**
* Defines the Animator result interface.
* @interface
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 6
*/
export interface AnimatorResult {
/**
* Update the options for current animator.
* @param options Options.
* @param { AnimatorOptions } options - Options.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 6
* @deprecated since 9
* @useinstead ohos.animator.reset
*/
update(options: AnimatorOptions): void;
/**
* Reset the options for current animator.
* @param { AnimatorOptions } options - Options.
* @throws { BusinessError } 401 - if the type of the parameter 1 is not object.
* @throws { BusinessError } 100001 - if no page is found for pageId or fail to get object property list.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 9
*/
reset(options: AnimatorOptions): void;
/**
* Starts the animation.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 6
*/
play(): void;
/**
* Ends the animation.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 6
*/
finish(): void;
/**
* Pauses the animation.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 6
*/
pause(): void;
/**
* Cancels the animation.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 6
*/
cancel(): void;
/**
* Plays the animation in reverse direction.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 6
*/
reverse(): void;
/**
* Trigger when vsync callback.
* @param progress The current progress of animtion
* @param { number } progress - The current progress of animtion
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 6
*/
onframe: (progress: number) => void;
/**
* The animation is finished.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 6
*/
onfinish: () => void;
/**
* The animation is canceled.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 6
*/
oncancel: () => void;
/**
* The animation is repeated.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 6
*/
onrepeat: () => void;
@ -160,9 +191,20 @@ export interface AnimatorResult {
*/
export default class Animator {
/**
* Create an animator object for custum animation.
* @param options Options.
* Create an animator object for custom animation.
* @param { AnimatorOptions } options - Options.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 6
* @deprecated since 9
* @useinstead ohos.animator.create
*/
static createAnimator(options: AnimatorOptions): AnimatorResult;
/**
* Create an animator object for custom animation.
* @param { AnimatorOptions } options - Options.
* @throws { BusinessError } 401 - if parameter error.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 9
*/
static create(options: AnimatorOptions): AnimatorResult;
}

56
api/@ohos.app.ability.Ability.d.ts vendored Normal file
View File

@ -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;
}

View File

@ -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;

View File

@ -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 actived.
* @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 inactived.
* @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;
}

75
api/@ohos.app.ability.AbilityStage.d.ts vendored Normal file
View File

@ -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 startd ability.
* @return { string } The user returns an ability string ID. If the ability of this ID has been started before,
* do not create a new instance and pull it back to the top of the stack.
* Otherwise, create a new instance and start it.
* @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;
}

View File

@ -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;
}

View File

@ -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

View File

@ -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;
}

View File

@ -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 {
}

View File

@ -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<string> } params - Indicates the params from command.
* @return { Array<string> } The dump info array.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @systemapi
* @stagemodelonly
* @since 9
*/
onDump(params: Array<string>): Array<string>;
}

View File

@ -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;
}

292
api/@ohos.app.ability.UIAbility.d.ts vendored Executable file
View File

@ -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<void> } 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<void>;
/**
* 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<rpc.MessageParcel> } 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<rpc.MessageParcel>;
/**
* 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<string> } params - Indicates the params from command.
* @returns { Array<string> } Return the dump info array.
* @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
* @stagemodelonly
* @since 9
*/
onDump(params: Array<string>): Array<string>;
}

91
api/@ohos.app.ability.Want.d.ts vendored Normal file
View File

@ -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<string>;
/**
* The description of an module name in an want.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
moduleName?: string;
}

View File

@ -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;

View File

@ -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<void> } 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>): void;
/**
* Updates the configuration by modifying the configuration.
* @permission ohos.permission.UPDATE_CONFIGURATION
* @param { Configuration } config - Indicates the new configuration.
* @returns { Promise<void> } 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<void>;
/**
* Get information about running abilities
* @permission ohos.permission.GET_RUNNING_INFO
* @returns { Promise<Array<AbilityRunningInfo>> } 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<Array<AbilityRunningInfo>>;
/**
* Get information about the running ability
* @permission ohos.permission.GET_RUNNING_INFO
* @param { AsyncCallback<Array<AbilityRunningInfo>> } 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<Array<AbilityRunningInfo>>): 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<Array<ExtensionRunningInfo>> } 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<Array<ExtensionRunningInfo>>;
/**
* 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<Array<ExtensionRunningInfo>> } 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<Array<ExtensionRunningInfo>>): void;
/**
* Get the top ability information of the display.
* @returns { Promise<ElementName> } 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<ElementName>;
/**
* Get the top ability information of the display.
* @param { AsyncCallback<ElementName> } 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<ElementName>): 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;

325
api/@ohos.app.ability.appManager.d.ts vendored Normal file
View File

@ -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<string> } 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<string>): 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<void> } 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>): 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<void> } 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<void>;
/**
* getForegroundApplications.
* @permission ohos.permission.GET_RUNNING_INFO
* @param { AsyncCallback<Array<AppStateData>> } 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<Array<AppStateData>>): void;
/**
* getForegroundApplications.
* @permission ohos.permission.GET_RUNNING_INFO
* @returns { Promise<Array<AppStateData>> } 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<Array<AppStateData>>;
/**
* 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<void> } 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<void>;
/**
* 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<void> } 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>): void;
/**
* Is user running in stability test.
* @param { AsyncCallback<boolean> } 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<boolean>): void;
/**
* Is user running in stability test.
* @returns { Promise<boolean> } 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<boolean>;
/**
* Kill processes by bundle name
* @permission ohos.permission.CLEAN_BACKGROUND_PROCESSES
* @param { string } bundleName - bundle name.
* @returns { Promise<void> } 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<void>;
/**
* Kill processes by bundle name
* @permission ohos.permission.CLEAN_BACKGROUND_PROCESSES
* @param { string } bundleName - bundle name.
* @param { AsyncCallback<void> } 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<void>);
/**
* Clear up application data by bundle name
* @permission ohos.permission.CLEAN_APPLICATION_DATA
* @param { string } bundleName - bundle name.
* @returns { Promise<void> } 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<void>;
/**
* Clear up application data by bundle name
* @permission ohos.permission.CLEAN_APPLICATION_DATA
* @param { string } bundleName - bundle name.
* @param { AsyncCallback<void> } 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<void>);
/**
* Is it a ram-constrained device
* @returns { Promise<boolean> } 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<boolean>;
/**
* Is it a ram-constrained device
* @param { AsyncCallback<boolean> } 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<boolean>): void;
/**
* Get the memory size of the application
* @returns { Promise<number> } 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<number>;
/**
* Get the memory size of the application
* @param { AsyncCallback<number> } 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<number>): void;
/**
* Get information about running processes
* @permission ohos.permission.GET_RUNNING_INFO
* @returns { Promise<Array<ProcessRunningInformation>> } 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<Array<ProcessRunningInformation>>;
/**
* Get information about running processes
* @permission ohos.permission.GET_RUNNING_INFO
* @param { AsyncCallback<Array<ProcessRunningInformation>> } 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<Array<ProcessRunningInformation>>): 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;

121
api/@ohos.app.ability.appRecovery.d.ts vendored Normal file
View File

@ -0,0 +1,121 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"),
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* This module provides the capability to app receovery.
* @import appReceovery from '@ohos.app.ability.appRecovery'
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @since 9
*/
declare namespace appReceovery {
/**
* 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 appReceovery;

152
api/@ohos.app.ability.common.d.ts vendored Executable file
View File

@ -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;

View File

@ -0,0 +1,47 @@
/*
* 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 context of an application. It allows access to application-specific resources.
*
* @since 9
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @StageModelOnly
*/
declare namespace contextConstant {
/**
* File area mode
*
* @since 9
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @StageModelOnly
*/
export enum AreaMode {
/**
* System level device encryption area
* @syscap SystemCapability.Ability.AbilityRuntime.Core
*/
EL1 = 0,
/**
* User credential encryption area
* @syscap SystemCapability.Ability.AbilityRuntime.Core
*/
EL2 = 1
}
}
export default contextConstant;

67
api/@ohos.app.ability.errorManager.d.ts vendored Normal file
View File

@ -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<void> } 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>): void;
/**
* Unregister error observer.
* @param { string } type - error.
* @param { number } observerId - Indicates the number code of the observer.
* @returns { Promise<void> } 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<void>;
/**
* 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;

View File

@ -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;
/**
* Unrgister the missionListener to ams.
* @param { string } type - mission.
* @param { number } listenerId - Indicates the listener id to be unregistered.
* @param { AsyncCallback<void> } 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>): void;
/**
* Unrgister the missionListener to ams.
* @param { string } type - mission.
* @param { number } listenerId - Indicates the listener id to be unregistered.
* @returns { Promise<void> } 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<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.
* @param { AsyncCallback<MissionInfo> } 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<MissionInfo>): 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<MissionInfo> } 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<MissionInfo>;
/**
* 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<Array<MissionInfo>> } 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<Array<MissionInfo>>): 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<Array<MissionInfo>> } 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<Array<MissionInfo>>;
/**
* 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<MissionSnapshot> } 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<MissionSnapshot>): 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<MissionSnapshot> } 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<MissionSnapshot>;
/**
* 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<MissionSnapshot> } 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<MissionSnapshot>): 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<MissionSnapshot> } 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<MissionSnapshot>;
/**
* Lock the mission.
* @param { number } missionId - Indicates mission id to be locked.
* @param { AsyncCallback<void> } 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>): void;
/**
* Lock the mission.
* @param { number } missionId - Indicates mission id to be locked.
* @returns { Promise<void> } 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<void>;
/**
* Unlock the mission.
* @param { number } missionId - Indicates mission id to be unlocked.
* @param { AsyncCallback<void> } 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>): void;
/**
* Unlock the mission.
* @param { number } missionId - Indicates mission id to be unlocked.
* @returns { Promise<void> } 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<void>;
/**
* Clear the given mission in the ability manager service.
* @param { number } missionId - Indicates mission id to be cleared.
* @param { AsyncCallback<void> } 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>): void;
/**
* Clear the given mission in the ability manager service.
* @param { number } missionId - Indicates mission id to be cleared.
* @returns { Promise<void> } 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<void>;
/**
* Clear all missions in the ability manager service.
* @param { AsyncCallback<void> } 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>): void;
/**
* Clear all missions in the ability manager service.
* @returns { Promise<void> } 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<void>;
/**
* Schedule the given mission to foreground.
* @param { number } missionId - Indicates mission id to be moved to foreground.
* @param { AsyncCallback<void> } 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>): 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<void> } 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>): 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<void> } 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<void>;
/**
* 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;

View File

@ -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<HapModuleQuickFixInfo> }
* @syscap SystemCapability.Ability.AbilityRuntime.QuickFix
* @systemapi Hide this for inner system use.
* @systemapi
* @since 9
*/
readonly hapModuleQuickFixInfo: Array<HapModuleQuickFixInfo>;
}
/**
* 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<string> } hapModuleQuickFixFiles - Quick fix files need to apply, this value should include file
* path and file name.
* @param { AsyncCallback<void> } 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<string>, callback: AsyncCallback<void>): void;
/**
* Apply quick fix files.
* @permission ohos.permission.INSTALL_BUNDLE
* @param { Array<string> } hapModuleQuickFixFiles - Quick fix files need to apply, this value should include file
* path and file name.
* @returns { Promise<void> } 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<string>): Promise<void>;
/**
* Get application quick fix info by bundle name.
*
* @since 9
* @syscap SystemCapability.Ability.AbilityRuntime.QuickFix
* @param bundleName Bundle name wish to query.
* @systemapi Hide this for inner system use.
* @return Returns the {@link ApplicationQuickFixInfo}.
* @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
* @param { string } bundleName - Bundle name wish to query.
* @param { AsyncCallback<ApplicationQuickFixInfo> } 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
* @systemapi
* @since 9
*/
function getApplicationQuickFixInfo(bundleName: string, callback: AsyncCallback<ApplicationQuickFixInfo>): void;
function getApplicationQuickFixInfo(bundleName: string): Promise<ApplicationQuickFixInfo>;
function getApplicationQuickFixInfo(bundleName: string, callback: AsyncCallback<ApplicationQuickFixInfo>): 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<ApplicationQuickFixInfo> } 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): Promise<ApplicationQuickFixInfo>;
}
export default quickFixManager;

350
api/@ohos.app.ability.wantAgent.d.ts vendored Normal file
View File

@ -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<string> } 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<string>): void;
/**
* Obtains the bundle name of a WantAgent.
* @param { WantAgent } agent - Indicates the WantAgent.
* @returns { Promise<string> } 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<string>;
/**
* Obtains the UID of a WantAgent.
* @param { WantAgent } agent - Indicates the WantAgent.
* @param { AsyncCallback<number> } callback - The callback is used to return the UID.
* @returns { Promise<number> } 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<number>): void;
function getUid(agent: WantAgent): Promise<number>;
/**
* Obtains the {@link Want} of an {@link WantAgent}.
* @param { WantAgent } agent - Indicates the WantAgent.
* @param { AsyncCallback<Want> } 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<Want>): void;
/**
* Obtains the {@link Want} of an {@link WantAgent}.
* @param { WantAgent } agent - Indicates the WantAgent.
* @returns { Promise<Want> } 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<Want>;
/**
* Cancels a WantAgent. Only the application that creates the WantAgent can cancel it.
* @param { WantAgent } agent - Indicates the WantAgent.
* @param { AsyncCallback<void> } 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>): void;
/**
* Cancels a WantAgent. Only the application that creates the WantAgent can cancel it.
* @param { WantAgent } agent - Indicates the WantAgent.
* @returns { Promise<void> } 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<void>;
/**
* Triggers a WantAgent.
* @param { WantAgent } agent - Indicates the WantAgent.
* @param { TriggerInfo } triggerInfo - Indicates the information required for triggering a WantAgent.
* @param { Callback<CompleteData> } 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<CompleteData>): void;
/**
* Triggers a WantAgent.
* @param { WantAgent } agent - Indicates the WantAgent.
* @param { TriggerInfo } triggerInfo - Indicates the information required for triggering a WantAgent.
* @param { AsyncCallback<CompleteData> } 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<CompleteData>): void;
/**
* Checks whether two WantAgent objects are equal.
* @param { WantAgent } agent - Indicates the WantAgent.
* @param { WantAgent } otherAgent - Indicates the other WantAgent.
* @param { AsyncCallback<boolean> } 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<boolean>): void;
/**
* Checks whether two WantAgent objects are equal.
* @param { WantAgent } agent - Indicates the WantAgent.
* @param { WantAgent } otherAgent - Indicates the other WantAgent.
* @returns { Promise<boolean> } 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<boolean>;
/**
* Obtains a WantAgent object.
* @param { WantAgentInfo } info - Information about the WantAgent object to obtain.
* @param { AsyncCallback<WantAgent> } 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<WantAgent>): void;
/**
* Obtains a WantAgent object.
* @param { WantAgentInfo } info - Information about the WantAgent object to obtain.
* @returns { Promise<WantAgent> } 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<WantAgent>;
/**
* Obtains the {@link OperationType} of a {@link WantAgent}.
* @param { WantAgent } agent - Indicates the WantAgent.
* @param { AsyncCallback<number> } 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<number>): void;
/**
* Obtains the {@link OperationType} of a {@link WantAgent}.
* @param { WantAgent } agent - Indicates the WantAgent.
* @returns { Promise<number> } 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<number>;
/**
* 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;

439
api/@ohos.app.ability.wantConstant.d.ts vendored Normal file
View File

@ -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.
*
* <p>You must specify the application bundle name in the {@code package} attribute of the {@code Intent}
* containing this action.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
ACTION_APPLICATION_DETAILS_SETTINGS = "ohos.settings.application.details",
/**
* Indicates the action of starting a Page ability for setting an alarm clock.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
ACTION_SET_ALARM = "ohos.want.action.setAlarm",
/**
* Indicates the action of starting a Page ability that displays all alarm
* clocks.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
ACTION_SHOW_ALARMS = "ohos.want.action.showAlarms",
/**
* Indicates the action of starting a Page ability for snoozing an alarm clock.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
ACTION_SNOOZE_ALARM = "ohos.want.action.snoozeAlarm",
/**
* Indicates the action of starting a Page ability for deleting an alarm clock.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
ACTION_DISMISS_ALARM = "ohos.want.action.dismissAlarm",
/**
* Indicates the action of starting a Page ability for dismissing a timer.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
ACTION_DISMISS_TIMER = "ohos.want.action.dismissTimer",
/**
* Indicates the action of starting a Page ability for sending a sms.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
ACTION_SEND_SMS = "ohos.want.action.sendSms",
/**
* Indicates the action of starting a Page ability for opening contacts or pictures.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
ACTION_CHOOSE = "ohos.want.action.choose",
/**
* Indicates the action of starting a Page ability for take a picture.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
ACTION_IMAGE_CAPTURE = "ohos.want.action.imageCapture",
/**
* Indicates the action of starting a Page ability for Take a video.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
ACTION_VIDEO_CAPTURE = "ohos.want.action.videoCapture",
/**
* Indicates the action of showing the application selection dialog box.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
ACTION_SELECT = "ohos.want.action.select",
/**
* Indicates the action of sending a single data record.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
ACTION_SEND_DATA = "ohos.want.action.sendData",
/**
* Indicates the action of sending multiple data records.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
ACTION_SEND_MULTIPLE_DATA = "ohos.want.action.sendMultipleData",
/**
* Indicates the action of requesting the media scanner to scan files and adding the files to the media library.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
ACTION_SCAN_MEDIA_FILE = "ohos.want.action.scanMediaFile",
/**
* Indicates the action of viewing data.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
ACTION_VIEW_DATA = "ohos.want.action.viewData",
/**
* Indicates the action of editing data.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
ACTION_EDIT_DATA = "ohos.want.action.editData",
/**
* Indicates the choices you will show with {@link #ACTION_PICKER}.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
INTENT_PARAMS_INTENT = "ability.want.params.INTENT",
/**
* Indicates the CharSequence dialog title when used with a {@link #ACTION_PICKER}.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
INTENT_PARAMS_TITLE = "ability.want.params.TITLE",
/**
* Indicates the action of select file.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
ACTION_FILE_SELECT = "ohos.action.fileSelect",
/**
* Indicates the URI holding a stream of data associated with the Intent when used with a {@link #ACTION_SEND_DATA}.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
PARAMS_STREAM = "ability.params.stream",
/**
* Indicates the action of providing auth service.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
ACTION_APP_ACCOUNT_AUTH = "account.appAccount.action.auth",
/**
* Indicates the action of an application downloaded from the application market.
* @syscap SystemCapability.Ability.AbilityBase
* @systemapi
* @since 9
*/
ACTION_MARKET_DOWNLOAD = "ohos.want.action.marketDownload",
/**
* Indicates the action of an application crowdtested from the application market.
* @syscap SystemCapability.Ability.AbilityBase
* @systemapi
* @since 9
*/
ACTION_MARKET_CROWDTEST = "ohos.want.action.marketCrowdTest",
/**
* Indicates the param of sandbox flag.
* @syscap SystemCapability.Ability.AbilityBase
* @systemapi
* @since 9
*/
DLP_PARAMS_SANDBOX = "ohos.dlp.params.sandbox",
/**
* Indicates the param of dlp bundle name.
* @syscap SystemCapability.Ability.AbilityBase
* @systemapi
* @since 9
*/
DLP_PARAMS_BUNDLE_NAME = "ohos.dlp.params.bundleName",
/**
* Indicates the param of dlp module name.
* @syscap SystemCapability.Ability.AbilityBase
* @systemapi
* @since 9
*/
DLP_PARAMS_MODULE_NAME = "ohos.dlp.params.moduleName",
/**
* Indicates the param of dlp ability name.
* @syscap SystemCapability.Ability.AbilityBase
* @systemapi
* @since 9
*/
DLP_PARAMS_ABILITY_NAME = "ohos.dlp.params.abilityName",
/**
* Indicates the param of dlp bundle index.
* @syscap SystemCapability.Ability.AbilityBase
* @systemapi
* @since 9
*/
DLP_PARAMS_INDEX = "ohos.dlp.params.index"
}
/**
* the constant for Entity of the want
* @enum { string }
* @name Entity
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
export enum Entity {
/**
* Indicates the default entity, which is used if the entity is not specified.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
ENTITY_DEFAULT = "entity.system.default",
/**
* Indicates the home screen entity.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
ENTITY_HOME = "entity.system.home",
/**
* Indicates the voice interaction entity.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
ENTITY_VOICE = "entity.system.voice",
/**
* Indicates the browser category.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
ENTITY_BROWSABLE = "entity.system.browsable",
/**
* Indicates the video category.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
ENTITY_VIDEO = "entity.system.video"
}
export enum Flags {
/**
* Indicates the grant to perform read operations on the URI.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
FLAG_AUTH_READ_URI_PERMISSION = 0x00000001,
/**
* Indicates the grant to perform write operations on the URI.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
FLAG_AUTH_WRITE_URI_PERMISSION = 0x00000002,
/**
* Returns the result to the source ability.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
FLAG_ABILITY_FORWARD_RESULT = 0x00000004,
/**
* Determines whether an ability on the local device can be migrated to a remote device.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
FLAG_ABILITY_CONTINUATION = 0x00000008,
/**
* Specifies whether a component does not belong to OHOS.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
FLAG_NOT_OHOS_COMPONENT = 0x00000010,
/**
* Specifies whether an ability is started.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
FLAG_ABILITY_FORM_ENABLED = 0x00000020,
/**
* Indicates the grant for possible persisting on the URI.
* @syscap SystemCapability.Ability.AbilityBase
* @systemapi
* @since 9
*/
FLAG_AUTH_PERSISTABLE_URI_PERMISSION = 0x00000040,
/**
* Returns the result to the source ability slice.
* @syscap SystemCapability.Ability.AbilityBase
* @systemapi
* @since 9
*/
FLAG_AUTH_PREFIX_URI_PERMISSION = 0x00000080,
/**
* Supports multi-device startup in the distributed scheduling system.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
FLAG_ABILITYSLICE_MULTI_DEVICE = 0x00000100,
/**
* Indicates that an ability using the Service template is started regardless of whether the host application has
* been started.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
FLAG_START_FOREGROUND_ABILITY = 0x00000200,
/**
* Indicates the continuation is reversible.
* @syscap SystemCapability.Ability.AbilityBase
* @systemapi
* @since 9
*/
FLAG_ABILITY_CONTINUATION_REVERSIBLE = 0x00000400,
/**
* Install the specified ability if it's not installed.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
FLAG_INSTALL_ON_DEMAND = 0x00000800,
/**
* Install the specifiedi ability with background mode if it's not installed.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
FLAG_INSTALL_WITH_BACKGROUND_MODE = 0x80000000,
/**
* Indicates the operation of clearing other missions. This flag can be set for the {@code Intent} passed to
* {@link ohos.app.Context#startAbility} and must be used together with {@link FLAG_ABILITY_NEW_MISSION}.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
FLAG_ABILITY_CLEAR_MISSION = 0x00008000,
/**
* Indicates the operation of creating a task on the historical mission stack.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
FLAG_ABILITY_NEW_MISSION = 0x10000000,
/**
* Indicates that the existing instance of the ability to start will be reused if it is already at the top of
* the mission stack. Otherwise, a new ability instance will be created.
* @syscap SystemCapability.Ability.AbilityBase
* @since 9
*/
FLAG_ABILITY_MISSION_TOP = 0x20000000
}
}
export default wantConstant;

View File

@ -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.
* <p>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.</p>
* @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 };
}

45
api/@ohos.app.form.formBindingData.d.ts vendored Normal file
View File

@ -0,0 +1,45 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { BusinessError } from './basic';
/**
* Interface of formBindingData.
* @namespace formBindingData
* @syscap SystemCapability.Ability.Form
* @since 9
*/
declare namespace formBindingData {
/**
* Create an FormBindingData instance.
* @param { Object | string } obj - Indicates the FormBindingData instance data.
* @returns { FormBindingData } Returns the FormBindingData.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @since 9
*/
function createFormBindingData(obj?: Object | string): FormBindingData;
/**
* Defines the createFormBindingData result interface.
* @typedef FormBindingData
* @syscap SystemCapability.Ability.Form
* @since 9
*/
interface FormBindingData {
data: Object
}
}
export default formBindingData;

539
api/@ohos.app.form.formHost.d.ts vendored Normal file
View File

@ -0,0 +1,539 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { AsyncCallback } from "./basic";
import { Callback } from "./basic";
import Want from './@ohos.app.ability.Want';
import formInfo from './@ohos.app.form.formInfo';
/**
* Interface of formHost.
* @namespace formHost
* @syscap SystemCapability.Ability.Form
* @systemapi
* @since 9
*/
declare namespace formHost {
/**
* Deletes an obtained form by its ID.
* <p>After this method is called, the form won't be available for use by the application and the Form Manager
* Service no longer keeps the cache information about the form.</p>
* @permission ohos.permission.REQUIRE_FORM
* @param { string } formId - Indicates the form ID.
* @param { AsyncCallback<void> } callback - The callback of deleteForm.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @systemapi
* @since 9
*/
function deleteForm(formId: string, callback: AsyncCallback<void>): void;
/**
* Deletes an obtained form by its ID.
* <p>After this method is called, the form won't be available for use by the application and the Form Manager
* Service no longer keeps the cache information about the form.</p>
* @permission ohos.permission.REQUIRE_FORM
* @param { string } formId - Indicates the form ID.
* @returns { Promise<void> } 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 deleteForm(formId: string): Promise<void>;
/**
* Releases an obtained form by its ID.
* <p>After this method is called, the form won't be available for use by the application, but the Form Manager
* Service still keeps the cache information about the form, so that the application can quickly obtain it based on
* the {@code formId}.</p>
* @permission ohos.permission.REQUIRE_FORM
* @param { string } formId - Indicates the form ID
* @param { AsyncCallback<void> } callback - The callback of releaseForm.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @systemapi
* @since 9
*/
function releaseForm(formId: string, callback: AsyncCallback<void>): void;
/**
* Releases an obtained form by its ID.
* <p>After this method is called, the form won't be available for use by the application, but the Form Manager
* Service still keeps the cache information about the form, so that the application can quickly obtain it based on
* the {@code formId}.</p>
* @permission ohos.permission.REQUIRE_FORM
* @param { string } formId - Indicates the form ID
* @param { boolean } isReleaseCache - Indicates whether release cache or not.
* @param { AsyncCallback<void> } callback - The callback of releaseForm.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @systemapi
* @since 9
*/
function releaseForm(formId: string, isReleaseCache: boolean, callback: AsyncCallback<void>): void;
/**
* Releases an obtained form by its ID.
* <p>After this method is called, the form won't be available for use by the application, but the Form Manager
* Service still keeps the cache information about the form, so that the application can quickly obtain it based on
* the {@code formId}.</p>
* @permission ohos.permission.REQUIRE_FORM
* @param { string } formId - Indicates the form ID
* @param { boolean } isReleaseCache - Indicates whether release cache or not.
* @returns { Promise<void> } 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 releaseForm(formId: string, isReleaseCache?: boolean): Promise<void>;
/**
* Requests for form update.
* <p>This method must be called when the application has detected that a system setting item (such as the language,
* resolution, or screen orientation) being listened for has changed. Upon receiving the update request, the form
* provider automatically updates the form data (if there is any update) through the form framework, with the update
* process being unperceivable by the application.</p>
* @permission ohos.permission.REQUIRE_FORM
* @param { string } formId - Indicates the ID of the form to update.
* @param { AsyncCallback<void> } callback - The callback of requestForm.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @systemapi
* @since 9
*/
function requestForm(formId: string, callback: AsyncCallback<void>): void;
/**
* Requests for form update.
* <p>This method must be called when the application has detected that a system setting item (such as the language,
* resolution, or screen orientation) being listened for has changed. Upon receiving the update request, the form
* provider automatically updates the form data (if there is any update) through the form framework, with the update
* process being unperceivable by the application.</p>
* @permission ohos.permission.REQUIRE_FORM
* @param { string } formId - Indicates the ID of the form to update.
* @returns { Promise<void> } 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 requestForm(formId: string): Promise<void>;
/**
* 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<void> } callback - The callback of castToNormalForm.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @systemapi
* @since 9
*/
function castToNormalForm(formId: string, callback: AsyncCallback<void>): void;
/**
* 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.
* @returns { Promise<void> } 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 castToNormalForm(formId: string): Promise<void>;
/**
* Sends a notification to the form framework to make the specified forms visible.
* <p>After this method is successfully called, onVisibilityChange will be called to notify the form provider of
* the form visibility change event.</p>
* @permission ohos.permission.REQUIRE_FORM
* @param { Array<string> } formIds - Indicates the IDs of the forms to be made visible.
* @param { AsyncCallback<void> } callback - The callback of notifyVisibleForms.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @systemapi
* @since 9
*/
function notifyVisibleForms(formIds: Array<string>, callback: AsyncCallback<void>): void;
/**
* Sends a notification to the form framework to make the specified forms visible.
* <p>After this method is successfully called, onVisibilityChange will be called to notify the form provider of
* the form visibility change event.</p>
* @permission ohos.permission.REQUIRE_FORM
* @param { Array<string> } formIds - Indicates the IDs of the forms to be made visible.
* @returns { Promise<void> } 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 notifyVisibleForms(formIds: Array<string>): Promise<void>;
/**
* Sends a notification to the form framework to make the specified forms invisible.
* <p>After this method is successfully called, onVisibilityChange will be called to notify the form provider of
* the form visibility change event.</p>
* @permission ohos.permission.REQUIRE_FORM
* @param { Array<string> } formIds - Indicates the IDs of the forms to be made invisible.
* @param { AsyncCallback<void> } callback - The callback of notifyInvisibleForms.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @systemapi
* @since 9
*/
function notifyInvisibleForms(formIds: Array<string>, callback: AsyncCallback<void>): void;
/**
* Sends a notification to the form framework to make the specified forms invisible.
* <p>After this method is successfully called, onVisibilityChange will be called to notify the form provider of
* the form visibility change event.</p>
* @permission ohos.permission.REQUIRE_FORM
* @param { Array<string> } formIds - Indicates the IDs of the forms to be made invisible.
* @returns { Promise<void> } 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 notifyInvisibleForms(formIds: Array<string>): Promise<void>;
/**
* Notify the form framework to make the specified forms updatable.
* <p>You can use this method to set form refresh state to true, the form can receive new
* update from service.</p>
* @permission ohos.permission.REQUIRE_FORM
* @param { Array<string> } formIds - Indicates the IDs of the forms to be made invisible.
* @param { AsyncCallback<void> } callback - The callback of enableFormsUpdate.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @systemapi
* @since 9
*/
function enableFormsUpdate(formIds: Array<string>, callback: AsyncCallback<void>): void;
/**
* Notify the form framework to make the specified forms updatable.
* <p>You can use this method to set form refresh state to true, the form can receive new
* update from service.</p>
* @permission ohos.permission.REQUIRE_FORM
* @param { Array<string> } formIds - Indicates the IDs of the forms to be made invisible.
* @returns { Promise<void> } 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 enableFormsUpdate(formIds: Array<string>): Promise<void>;
/**
* Notify the form framework to make the specified forms non-updatable.
* <p>You can use this method to set form refresh state to false, the form do not receive
* new update from service.</p>
* @permission ohos.permission.REQUIRE_FORM
* @param { Array<string> } formIds - Indicates the IDs of the forms to be made invisible.
* @param { AsyncCallback<void> } callback - The callback of disableFormsUpdate.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @systemapi
* @since 9
*/
function disableFormsUpdate(formIds: Array<string>, callback: AsyncCallback<void>): void;
/**
* Notify the form framework to make the specified forms non updatable.
* <p>You can use this method to set form refresh state to false, the form do not receive
* new update from service.</p>
* @permission ohos.permission.REQUIRE_FORM
* @param { Array<string> } formIds - Indicates the IDs of the forms to be made invisible.
* @returns { Promise<void> } 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 disableFormsUpdate(formIds: Array<string>): Promise<void>;
/**
* Checks whether the system is ready.
* <p>You can use this method to obtain the system is ready.</p>
* @param { AsyncCallback<void> } callback - The callback of isSystemReady.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @systemapi
* @since 9
*/
function isSystemReady(callback: AsyncCallback<void>): void;
/**
* Checks whether the system is ready.
* <p>You can use this method to obtain the system is ready.</p>
* @returns { Promise<void> } 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 isSystemReady(): Promise<void>;
/**
* Obtains the FormInfo objects provided by all applications on the device.
* @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
* @param { AsyncCallback<Array<formInfo.FormInfo>> } callback - The callback is used to return the FormInfo.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @systemapi
* @since 9
*/
function getAllFormsInfo(callback: AsyncCallback<Array<formInfo.FormInfo>>): void;
/**
* Obtains the FormInfo objects provided by all applications on the device.
* @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
* @returns { Promise<Array<formInfo.FormInfo>> } Returns the FormInfo.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @systemapi
* @since 9
*/
function getAllFormsInfo(): Promise<Array<formInfo.FormInfo>>;
/**
* Obtains the FormInfo objects provided by a specified application on the device.
* @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
* @param { string } bundleName - Indicates the bundle name of the application.
* @param { AsyncCallback<Array<formInfo.FormInfo>> } callback - The callback is used to return the FormInfo.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @systemapi
* @since 9
*/
function getFormsInfo(bundleName: string, callback: AsyncCallback<Array<formInfo.FormInfo>>): void;
/**
* Obtains the FormInfo objects provided by a specified application on the device.
* @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<Array<formInfo.FormInfo>> } callback - The callback is used to return the FormInfo.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @systemapi
* @since 9
*/
function getFormsInfo(bundleName: string, moduleName: string, callback: AsyncCallback<Array<formInfo.FormInfo>>): void;
/**
* Obtains the FormInfo objects provided by a specified application on the device.
* @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<Array<formInfo.FormInfo>> } Returns the FormInfo.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @systemapi
* @since 9
*/
function getFormsInfo(bundleName: string, moduleName?: string): Promise<Array<formInfo.FormInfo>>;
/**
* Deletes invalid forms of the application in the Form Manager Service based on the list of.
* <p>You can use this method to delete invalid forms of the application.</p>
* @permission ohos.permission.REQUIRE_FORM
* @param { Array<string> } formIds - Indicates the specified form id.
* @param { AsyncCallback<number> } callback - The callback is used to return the number of invalid forms deleted
* by the Form Manager Service.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @systemapi
* @since 9
*/
function deleteInvalidForms(formIds: Array<string>, callback: AsyncCallback<number>): void;
/**
* Deletes invalid forms of the application in the Form Manager Service based on the list of.
* <p>You can use this method to delete invalid forms of the application.</p>
* @permission ohos.permission.REQUIRE_FORM
* @param { Array<string> } formIds - Indicates the specified form id.
* @returns { Promise<number> } Returns the number of invalid forms deleted by the Form Manager Service.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @systemapi
* @since 9
*/
function deleteInvalidForms(formIds: Array<string>): Promise<number>;
/**
* Obtains the Form state.
* <p>You can use this method to obtains the form state.</p>
* @permission ohos.permission.REQUIRE_FORM and ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
* @param { Want } want - Indicates want of the form.
* @param { AsyncCallback<formInfo.FormStateInfo> } callback - The callback is used to return the form state.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @systemapi
* @since 9
*/
function acquireFormState(want: Want, callback: AsyncCallback<formInfo.FormStateInfo>): void;
/**
* Obtains the Form state.
* <p>You can use this method to obtains the form state.</p>
* @permission ohos.permission.REQUIRE_FORM and ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
* @param { Want } want - Indicates want of the form.
* @returns { Promise<formInfo.FormStateInfo> } Returns the form state.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @systemapi
* @since 9
*/
function acquireFormState(want: Want): Promise<formInfo.FormStateInfo>;
/**
* Listens to the event of uninstall form.
* <p>You can use this method to listen to the event of uninstall form.</p>
* @param { string } type - Indicates event type.
* @param { Callback<string> } callback - The callback of formUninstall.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @systemapi
* @since 9
*/
function on(type: "formUninstall", callback: Callback<string>): void;
/**
* Cancels listening to the event of uninstall form.
* <p>You can use this method to cancel listening to the event of uninstall form.</p>
* @param { string } type - Indicates event type.
* @param { Callback<string> } callback - The callback of formUninstall.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @systemapi
* @since 9
*/
function off(type: "formUninstall", callback?: Callback<string>): void;
/**
* Notify form is Visible
* <p>You can use this method to notify form visible state.</p>
* @permission ohos.permission.REQUIRE_FORM
* @param { Array<string> } formIds - Indicates the specified form id.
* @param { boolean } isVisible - Indicates whether visible.
* @param { AsyncCallback<void> } callback - The callback of notifyFormsVisible.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @systemapi
* @since 9
*/
function notifyFormsVisible(formIds: Array<string>, isVisible: boolean, callback: AsyncCallback<void>): void;
/**
* Notify form is Visible
* <p>You can use this method to notify form visible state.</p>
* @permission ohos.permission.REQUIRE_FORM
* @param { Array<string> } formIds - Indicates the specified form id.
* @param { boolean } isVisible - Indicates whether visible.
* @returns { Promise<void> } 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 notifyFormsVisible(formIds: Array<string>, isVisible: boolean): Promise<void>;
/**
* Notify form enable update state.
* <p>You can use this method to notify form enable update state.</p>
* @permission ohos.permission.REQUIRE_FORM
* @param { Array<string> } formIds - Indicates the specified form id.
* @param { boolean } isEnableUpdate - Indicates whether enable update.
* @param { AsyncCallback<void> } callback - The callback of notifyFormsEnableUpdate.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @systemapi
* @since 9
*/
function notifyFormsEnableUpdate(formIds: Array<string>, isEnableUpdate: boolean, callback: AsyncCallback<void>): void;
/**
* Notify form enable update state.
* <p>You can use this method to notify form enable update state.</p>
* @permission ohos.permission.REQUIRE_FORM
* @param { Array<string> } formIds - Indicates the specified form id.
* @param { boolean } isEnableUpdate - Indicates whether enable update.
* @returns { Promise<void> } 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 notifyFormsEnableUpdate(formIds: Array<string>, isEnableUpdate: boolean): Promise<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.
* @param { AsyncCallback<void> } callback - The callback of shareForm.
* @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>): 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<void> } 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<void>;
/**
* Notify form that privacy whether to be protected.
* @permission ohos.permission.REQUIRE_FORM.
* @param { Array<string> } formIds - Indicates the specified form id.
* @param { boolean } isProtected - Indicates whether to be protected.
* @param { AsyncCallback<void> } 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<string>, isProtected: boolean, callback: AsyncCallback<void>): void;
/**
* Notify form that privacy whether to be protected.
* @permission ohos.permission.REQUIRE_FORM.
* @param { Array<string> } formIds - Indicates the specified form id.
* @param { boolean } isProtected - Indicates whether to be protected.
* @returns { Promise<void> } 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<string>, isProtected: boolean): Promise<void>;
}
export default formHost;

486
api/@ohos.app.form.formInfo.d.ts vendored Normal file
View File

@ -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<number>;
/**
* 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;

161
api/@ohos.app.form.formProvider.d.ts vendored Normal file
View File

@ -0,0 +1,161 @@
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { AsyncCallback } from "./basic";
import formBindingData from "./@ohos.app.form.formBindingData";
import formInfo from "./@ohos.app.form.formInfo";
import Want from "./@ohos.app.ability.Want";
/**
* Interface of formProvider.
* @namespace formProvider
* @syscap SystemCapability.Ability.Form
* @since 9
*/
declare namespace formProvider {
/**
* Set next update time for a specified form.
* @param { string } formId - Indicates the form ID.
* @param { number } minute - Indicates duration minute before next update.
* @param { AsyncCallback<void> } callback - The callback of setFormNextRefreshTime.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @since 9
*/
function setFormNextRefreshTime(formId: string, minute: number, callback: AsyncCallback<void>): void;
/**
* Set next update time for a specified form.
* @param { string } formId - Indicates the form ID.
* @param { number } minute - Indicates duration minute before next update.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @since 9
*/
function setFormNextRefreshTime(formId: string, minute: number): Promise<void>;
/**
* Update a specified form.
* Client to communication with FormManagerService.
* @param { string } formId - Indicates the form ID.
* @param { formBindingData.FormBindingData } formBindingData - Indicates the form data.
* @param { AsyncCallback<void> } callback - The callback of updateForm.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @since 9
*/
function updateForm(formId: string, formBindingData: formBindingData.FormBindingData, callback: AsyncCallback<void>): void;
/**
* Update a specified form.
* Client to communication with FormManagerService.
* @param { string } formId - Indicates the form ID.
* @param { formBindingData.FormBindingData } formBindingData - Indicates the form data.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @since 9
*/
function updateForm(formId: string, formBindingData: formBindingData.FormBindingData): Promise<void>;
/**
* Get info of all forms belonging to current bundle.
* Client to communication with FormManagerService.
* @param { formInfo.FormInfoFilter } filter - Indicates the requirements the forms that the formInfos belong to have to meet.
* @param { AsyncCallback<Array<formInfo.FormInfo>> } callback - The callback is used to return the formInfo.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @since 9
*/
function getFormsInfo(filter: formInfo.FormInfoFilter, callback: AsyncCallback<Array<formInfo.FormInfo>>): void;
/**
* Get infos of all forms belonging to current bundle.
* Client to communication with FormManagerService.
* @param { AsyncCallback<Array<formInfo.FormInfo>> } callback - The callback is used to return the formInfo.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @since 9
*/
function getFormsInfo(callback: AsyncCallback<Array<formInfo.FormInfo>>): void;
/**
* Get infos of all forms belonging to current bundle.
* Client to communication with FormManagerService.
* @param { formInfo.FormInfoFilter } filter - Indicates the requirements the forms that the formInfos belong to have to meet.
* @returns { Promise<Array<formInfo.FormInfo>> } Returns the formInfo.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @since 9
*/
function getFormsInfo(filter?: formInfo.FormInfoFilter): Promise<Array<formInfo.FormInfo>>;
/**
* Request to publish a form to the form host.
* @param { Want } want - The want of the form to publish.
* @param { formBindingData.FormBindingData } formBindingData - Indicates the form data.
* @param { AsyncCallback<string> } callback - The callback is used to return the form id.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @systemapi
* @since 9
*/
function requestPublishForm(want: Want, formBindingData: formBindingData.FormBindingData, callback: AsyncCallback<string>): void;
/**
* Request to publish a form to the form host.
* @param { Want } want - The want of the form to publish.
* @param { AsyncCallback<string> } callback - The callback is used to return the form id.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @systemapi
* @since 9
*/
function requestPublishForm(want: Want, callback: AsyncCallback<string>): void;
/**
* Request to publish a form to the form host.
* @param { Want } want - The want of the form to publish.
* @param { formBindingData.FormBindingData } formBindingData - Indicates the form data.
* @returns { Promise<string> } Returns the form id.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @systemapi
* @since 9
*/
function requestPublishForm(want: Want, formBindingData?: formBindingData.FormBindingData): Promise<string>;
/**
* Check if the request of publishing a form is supported by the host
* @param { AsyncCallback<boolean> } callback - The callback is used to return true if the request is supported.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @systemapi
* @since 9
*/
function isRequestPublishFormSupported(callback: AsyncCallback<boolean>): void;
/**
* Check if the request of publishing a form is supported by the host
* @returns { Promise<boolean> } Returns true if the request is supported.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @systemapi
* @since 9
*/
function isRequestPublishFormSupported(): Promise<boolean>;
}
export default formProvider;

22
api/@ohos.application.Ability.d.ts vendored Executable file → Normal file
View File

@ -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;
}

View File

@ -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

View File

@ -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 {
/**

View File

@ -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 {
/**

View File

@ -66,38 +66,6 @@ declare interface AccessibilityEvent {
timeStamp?: number;
}
/**
* Indicates the path of the gesture.
* @since 9
* @syscap SystemCapability.BarrierFree.Accessibility.Core
*/
declare interface GesturePath {
/**
* Indicates the position of the points that make up the gesture.
*/
points: Array<GesturePoint>;
/**
* Indicates the duration of the gesture.
*/
durationTime: number;
}
/**
* Indicates the point of the gesture.
* @since 9
* @syscap SystemCapability.BarrierFree.Accessibility.Core
*/
declare interface GesturePoint {
/**
* Indicates the X coordinate of point.
*/
positionX: number;
/**
* Indicates the Y coordinate of point.
*/
positionY: number;
}
/**
* Indicates the gusture type.
* @since 9

View File

@ -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 {
/**

View File

@ -19,6 +19,8 @@
* @since 8
* @syscap SystemCapability.Ability.AbilityBase
* @permission N/A
* @deprecated since 9
* @useinstead ohos.app.ability.ConfigurationConstant
*/
declare namespace ConfigurationConstant {
/**

View File

@ -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 {
/**

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"),
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityConstant from "./@ohos.application.AbilityConstant";
import { Configuration } from './@ohos.application.Configuration';
/**
* class of extension.
*
* @since 9
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @StageModelOnly
* @deprecated since 9
* @useinstead ohos.app.ability.ExtensionAbility
*/
export default class ExtensionAbility {
/**
* Called when the system configuration is updated.
*
* @since 9
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @param newConfig Indicates the updated configuration.
* @return -
* @StageModelOnly
*/
onConfigurationUpdated(newConfig: Configuration): void;
/**
* Called when the system has determined to trim the memory, for example, when the ability is running in the
* background and there is no enough memory for running as many background processes as possible.
*
* @since 9
* @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
* @param level Indicates the memory trim level, which shows the current memory usage status.
* @return -
* @StageModelOnly
*/
onMemoryLevel(level: AbilityConstant.MemoryLevel): void;
}

View File

@ -13,7 +13,7 @@
* limitations under the License.
*/
import formBindingData from './@ohos.application.formBindingData';
import formBindingData from './@ohos.app.form.formBindingData';
import formInfo from "./@ohos.application.formInfo";
import FormExtensionContext from "./application/FormExtensionContext";
import Want from './@ohos.application.Want';
@ -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 {
/**

View File

@ -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 {
/**

View File

@ -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 {
/**

View File

@ -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 {
/**

View File

@ -26,6 +26,8 @@ import { ShellCmdResult as _ShellCmdResult } from './application/shellCmdResult'
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @import import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
* @permission N/A
* @deprecated since 9
* @useinstead ohos.app.ability.abilityDelegatorRegistry
*/
declare namespace abilityDelegatorRegistry {
/**

View File

@ -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 {
/**

View File

@ -27,6 +27,8 @@ import { ProcessRunningInformation as _ProcessRunningInformation } from './appli
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @import import appManager from '@ohos.application.appManager'
* @permission N/A
* @deprecated since 9
* @useinstead ohos.app.ability.appManager
*/
declare namespace appManager {
/**

View File

@ -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.
*

View File

@ -23,6 +23,8 @@ import * as _ErrorObserver from './application/ErrorObserver';
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @import import errorManager from '@ohos.application.errorManager'
* @permission N/A
* @deprecated since 9
* @useinstead ohos.app.ability.errorManager
*/
declare namespace errorManager {
/**

View File

@ -19,6 +19,8 @@
* @name formBindingData
* @since 8
* @syscap SystemCapability.Ability.Form
* @deprecated since 9
* @useinstead ohos.app.form.formBindingData
*/
declare namespace formBindingData {
/**

View File

@ -25,6 +25,8 @@ import formInfo from './@ohos.application.formInfo'
* @since 8
* @syscap SystemCapability.Ability.Form
* @systemapi hide for inner use.
* @deprecated since 9
* @useinstead ohos.app.form.formHost
*/
declare namespace formHost {
/**
@ -281,5 +283,19 @@ declare namespace formHost {
*/
function shareForm(formId: string, deviceId: string, callback: AsyncCallback<void>): void;
function shareForm(formId: string, deviceId: string): Promise<void>;
/**
* notify form that privacy wether need to be protected.
*
* @since 9
* @syscap SystemCapability.Ability.Form
* @param formIds Indicates the specified form id.
* @param isProtected Indicates whether enable update.
* @systemapi hide for inner use.
* @return -
* @permission ohos.permission.REQUIRE_FORM.
*/
function notifyFormsPrivacyProtected(formIds: Array<string>, isProtected: boolean, callback: AsyncCallback<void>): void;
function notifyFormsPrivacyProtected(formIds: Array<string>, isProtected: boolean): Promise<void>;
}
export default formHost;

View File

@ -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;

View File

@ -24,6 +24,8 @@ import Want from './@ohos.application.Want';
* @name formProvider
* @since 8
* @syscap SystemCapability.Ability.Form
* @deprecated since 9
* @useinstead ohos.app.form.formProvider
*/
declare namespace formProvider {
/**

View File

@ -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 {
/**

View File

@ -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;
@ -58,6 +64,8 @@ declare namespace backgroundTaskManager {
* @syscap SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
* @param requestId Indicates the identifier of the delay request.
* @return The remaining delay time
* @deprecated since 9
* @useinstead ohos.resourceschedule.backgroundTaskManager.getRemainingDelayTime
*/
function getRemainingDelayTime(requestId: number, callback: AsyncCallback<number>): void;
function getRemainingDelayTime(requestId: number): Promise<number>;
@ -70,6 +78,8 @@ declare namespace backgroundTaskManager {
* @param reason Indicates the reason for delayed transition to the suspended state.
* @param callback The callback delay time expired.
* @return Info of delay request
* @deprecated since 9
* @useinstead ohos.resourceschedule.backgroundTaskManager.requestSuspendDelay
*/
function requestSuspendDelay(reason: string, callback: Callback<void>): 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>): void;
function startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: WantAgent): Promise<void>;
@ -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>): void;
function stopBackgroundRunning(context: Context): Promise<void>;
/**
* 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;

View File

@ -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

View File

@ -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.
* @return {Promise<Array<BatteryStatsInfo>>} Power consumption information list.
* @systemapi
* @since 8
*/
function getBatteryStats(): Promise<Array<BatteryStatsInfo>>;
/**
* 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<Array<BatteryStatsInfo>>): 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.
* @return {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.
* @return {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.
* @return {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.
* @return {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
*/

View File

@ -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;

138
api/@ohos.buffer.d.ts vendored
View File

@ -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
*
@ -32,6 +32,7 @@ declare namespace 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
* @throws {BusinessError} 401 - if the input parameters are invalid.
*/
function alloc(size: number, fill?: string | Buffer | number, encoding?: BufferEncoding): Buffer;
@ -41,6 +42,7 @@ declare namespace buffer {
* @syscap SystemCapability.Utils.Lang
* @param size The desired length of the new Buffer
* @return Return a new allocated Buffer
* @throws {BusinessError} 401 - if the input parameters are invalid.
*/
function allocUninitializedFromPool(size: number): Buffer;
@ -50,6 +52,7 @@ declare namespace buffer {
* @syscap SystemCapability.Utils.Lang
* @param size The desired length of the new Buffer
* @return Return a new allocated Buffer
* @throws {BusinessError} 401 - if the input parameters are invalid.
*/
function allocUninitialized(size: number): Buffer;
@ -62,6 +65,7 @@ declare namespace buffer {
* @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`
* @throws {BusinessError} 401 - if the input parameters are invalid.
*/
function byteLength(string: string | Buffer | TypedArray | DataView | ArrayBuffer | SharedArrayBuffer, encoding?: BufferEncoding): number;
@ -72,6 +76,8 @@ declare namespace buffer {
* @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
* @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;
@ -81,6 +87,7 @@ declare namespace buffer {
* @syscap SystemCapability.Utils.Lang
* @param array an array of bytes in the range 0 255
* @return Return a new allocated Buffer
* @throws {BusinessError} 401 - if the input parameters are invalid.
*/
function from(array: number[]): Buffer;
@ -92,6 +99,8 @@ declare namespace buffer {
* @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
* @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;
@ -101,6 +110,7 @@ declare namespace buffer {
* @syscap SystemCapability.Utils.Lang
* @param buffer An existing Buffer or Uint8Array from which to copy data
* @return Return a new allocated Buffer
* @throws {BusinessError} 401 - if the input parameters are invalid.
*/
function from(buffer: Buffer | Uint8Array): Buffer;
@ -113,6 +123,7 @@ declare namespace buffer {
* @param offsetOrEncoding A byte-offset or encoding
* @param length A length
* @return Return a new allocated Buffer
* @throws {BusinessError} 401 - if the input parameters are invalid.
*/
function from(object: Object, offsetOrEncoding: number | string, length: number): Buffer;
@ -124,6 +135,7 @@ declare namespace buffer {
* @param string A string to encode
* @param [encoding='utf8'] The encoding of string
* @return Return a new Buffer containing string
* @throws {BusinessError} 401 - if the input parameters are invalid.
*/
function from(string: String, encoding?: BufferEncoding): Buffer;
@ -154,6 +166,7 @@ declare namespace buffer {
* @return 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;
@ -165,6 +178,7 @@ declare namespace buffer {
* @param fromEnc The current encoding
* @param toEnc To target encoding
* @return 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;
@ -202,6 +219,8 @@ declare namespace buffer {
* @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
* @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;
@ -218,6 +237,9 @@ declare namespace buffer {
* @return 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;
@ -231,6 +253,9 @@ declare namespace buffer {
* @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
* @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;
@ -240,6 +265,7 @@ declare namespace buffer {
* @syscap SystemCapability.Utils.Lang
* @param otherBuffer A Buffer or Uint8Array with which to compare buf
* @return true or false
* @throws {BusinessError} 401 - if the input parameters are invalid.
*/
equals(otherBuffer: Uint8Array | Buffer): boolean;
@ -251,6 +277,7 @@ declare namespace buffer {
* @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
* @throws {BusinessError} 401 - if the input parameters are invalid.
*/
includes(value: string | number | Buffer | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): boolean;
@ -262,6 +289,7 @@ declare namespace buffer {
* @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
* @throws {BusinessError} 401 - if the input parameters are invalid.
*/
indexOf(value: string | number | Buffer | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
@ -294,6 +322,7 @@ declare namespace buffer {
* @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
* @throws {BusinessError} 401 - if the input parameters are invalid.
*/
lastIndexOf(value: string | number | Buffer | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
@ -303,6 +332,8 @@ declare namespace buffer {
* @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
* @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
* @return 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;
@ -321,6 +354,8 @@ declare namespace buffer {
* @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
* @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;
@ -330,6 +365,8 @@ declare namespace buffer {
* @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
* @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;
@ -339,6 +376,8 @@ declare namespace buffer {
* @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
* @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;
@ -348,6 +387,8 @@ declare namespace buffer {
* @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
* @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;
@ -357,6 +398,8 @@ declare namespace buffer {
* @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
* @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
* @return 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;
@ -375,6 +420,8 @@ declare namespace buffer {
* @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
* @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;
@ -384,6 +431,8 @@ declare namespace buffer {
* @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
* @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;
@ -393,6 +442,8 @@ declare namespace buffer {
* @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
* @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;
@ -402,6 +453,8 @@ declare namespace buffer {
* @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
* @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;
@ -411,6 +464,8 @@ declare namespace buffer {
* @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
* @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;
@ -422,6 +477,8 @@ declare namespace buffer {
* @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
* @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;
@ -433,6 +490,8 @@ declare namespace buffer {
* @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
* @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;
@ -442,6 +501,8 @@ declare namespace buffer {
* @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
* @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;
@ -451,6 +512,8 @@ declare namespace buffer {
* @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
* @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;
@ -460,6 +523,8 @@ declare namespace buffer {
* @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
* @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;
@ -469,6 +534,8 @@ declare namespace buffer {
* @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
* @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;
@ -478,6 +545,8 @@ declare namespace buffer {
* @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
* @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;
@ -489,6 +558,8 @@ declare namespace buffer {
* @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
* @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;
@ -500,6 +571,8 @@ declare namespace buffer {
* @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
* @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;
@ -518,6 +591,7 @@ declare namespace buffer {
* @since 9
* @syscap SystemCapability.Utils.Lang
* @return A reference to buf
* @throws {BusinessError} 10200009 - Buffer size must be a multiple of 16-bits
*/
swap16(): Buffer;
@ -526,6 +600,7 @@ declare namespace buffer {
* @since 9
* @syscap SystemCapability.Utils.Lang
* @return A reference to buf
* @throws {BusinessError} 10200009 - Buffer size must be a multiple of 32-bits
*/
swap32(): Buffer;
@ -534,6 +609,7 @@ declare namespace buffer {
* @since 9
* @syscap SystemCapability.Utils.Lang
* @return A reference to buf
* @throws {BusinessError} 10200009 - Buffer size must be a multiple of 64-bits
*/
swap64(): Buffer;
@ -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;
@ -564,6 +641,8 @@ declare namespace buffer {
* @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.
* @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;
@ -574,6 +653,8 @@ declare namespace buffer {
* @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
* @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;
@ -584,6 +665,8 @@ declare namespace buffer {
* @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
* @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;
@ -594,6 +677,8 @@ declare namespace buffer {
* @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
* @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
* @return 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;
@ -614,6 +701,8 @@ declare namespace buffer {
* @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
* @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;
@ -624,6 +713,8 @@ declare namespace buffer {
* @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
* @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;
@ -634,6 +725,8 @@ declare namespace buffer {
* @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
* @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;
@ -644,6 +737,8 @@ declare namespace buffer {
* @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
* @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
* @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
* @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;
@ -664,6 +761,8 @@ declare namespace buffer {
* @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
* @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;
@ -674,6 +773,8 @@ declare namespace buffer {
* @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
* @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;
@ -684,6 +785,8 @@ declare namespace buffer {
* @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
* @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;
@ -694,6 +797,8 @@ declare namespace buffer {
* @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
* @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;
@ -705,6 +810,8 @@ declare namespace buffer {
* @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
* @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;
@ -716,6 +823,8 @@ declare namespace buffer {
* @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
* @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;
@ -726,6 +835,8 @@ declare namespace buffer {
* @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
* @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;
@ -736,6 +847,8 @@ declare namespace buffer {
* @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
* @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;
@ -746,6 +859,8 @@ declare namespace buffer {
* @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
* @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;
@ -756,6 +871,8 @@ declare namespace buffer {
* @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
* @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;
@ -766,6 +883,8 @@ declare namespace buffer {
* @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
* @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;
@ -777,6 +896,8 @@ declare namespace buffer {
* @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
* @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;
@ -788,6 +909,8 @@ declare namespace buffer {
* @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
* @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);

120
api/@ohos.bundle.appControl.d.ts vendored Normal file
View File

@ -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.
*/
import { AsyncCallback } from './basic';
import Want from './@ohos.app.ability.Want';
/**
* Used for application interception control
* @namespace appControl
* @syscap SystemCapability.BundleManager.BundleFramework.AppControl
* @systemapi
* @since 9
*/
declare namespace appControl {
/**
* Set the disposed status of a specified bundle.
* @permission ohos.permission.MANAGE_DISPOSED_APP_STATUS
* @param { string } appId - Indicates the app ID of the application.
* @param { Want } disposedWant - Indicates the disposed want.
* @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 - Capability not supported.
* @throws { BusinessError } 17700005 - The specified appId was not found.
* @syscap SystemCapability.BundleManager.BundleFramework.AppControl
* @systemapi
* @since 9
*/
function setDisposedStatus(appId: string, disposedWant: Want, callback: AsyncCallback<void>): void;
/**
* Set the disposed status of a specified bundle.
* @permission ohos.permission.MANAGE_DISPOSED_APP_STATUS
* @param { string } appId - Indicates the app ID of the application.
* @param { Want } disposedWant - Indicates the disposed want.
* @returns { Promise<void> } 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 - Capability not supported.
* @throws { BusinessError } 17700005 - The specified appId was not found.
* @syscap SystemCapability.BundleManager.BundleFramework.AppControl
* @systemapi
* @since 9
*/
function setDisposedStatus(appId: string, disposedWant: Want): Promise<void>;
/**
* Obtains the disposed status of a specified bundle.
* @permission ohos.permission.MANAGE_DISPOSED_APP_STATUS
* @param { string } appId - Indicates the app ID of the application.
* @param { AsyncCallback<Want> } 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 - Capability not supported.
* @throws { BusinessError } 17700005 - The specified appId was not found.
* @syscap SystemCapability.BundleManager.BundleFramework.AppControl
* @systemapi
* @since 9
*/
function getDisposedStatus(appId: string, callback: AsyncCallback<Want>): void;
/**
* Obtains the disposed status of a specified bundle.
* @permission ohos.permission.MANAGE_DISPOSED_APP_STATUS
* @param { string } appId - Indicates the app ID of the application.
* @returns { Promise<Want> } Returns the disposed status of a specified bundle.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - The parameter check failed.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 17700005 - The specified appId was not found.
* @syscap SystemCapability.BundleManager.BundleFramework.AppControl
* @systemapi
* @since 9
*/
function getDisposedStatus(appId: string): Promise<Want>;
/**
* Delete the disposed status of a specified bundle.
* @permission ohos.permission.MANAGE_DISPOSED_APP_STATUS
* @param { string } appId - Indicates the app ID of the application.
* @param { AsyncCallback<void> } 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 - Capability not supported.
* @throws { BusinessError } 17700005 - The specified appId was not found.
* @syscap SystemCapability.BundleManager.BundleFramework.AppControl
* @systemapi
* @since 9
*/
function deleteDisposedStatus(appId: string, callback: AsyncCallback<void>): void;
/**
* Delete the disposed status of a specified bundle.
* @permission ohos.permission.MANAGE_DISPOSED_APP_STATUS
* @param { string } appId - Indicates the app ID of the application.
* @returns { Promise<void> } 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 - Capability not supported.
* @throws { BusinessError } 17700005 - The specified appId was not found.
* @syscap SystemCapability.BundleManager.BundleFramework.AppControl
* @systemapi
* @since 9
*/
function deleteDisposedStatus(appId: string): Promise<void>;
}
export default appControl;

1344
api/@ohos.bundle.bundleManager.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

85
api/@ohos.bundle.bundleMonitor.d.ts vendored Normal file
View File

@ -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<BundleChangedInfo> } 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<BundleChangedInfo>): 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<BundleChangedInfo> } 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<BundleChangedInfo>): void;
}
export default bundleMonitor

761
api/@ohos.bundle.d.ts vendored
View File

@ -13,23 +13,14 @@
* 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.
@ -37,6 +28,8 @@ import * as _BundleInstaller from './bundle/bundleInstaller';
* @since 7
* @syscap SystemCapability.BundleManager.BundleFramework
* @permission NA
* @deprecated since 9
* @useinstead ohos.bundle.bundleManager
*/
declare namespace bundle {
@ -46,6 +39,9 @@ declare namespace bundle {
* @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 +55,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,24 +71,6 @@ 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,
}
/**
@ -109,6 +79,7 @@ declare namespace bundle {
* @syscap SystemCapability.BundleManager.BundleFramework
* @import NA
* @permission NA
* @deprecated since 9
*/
export enum ColorMode {
AUTO_MODE = -1,
@ -122,6 +93,8 @@ declare namespace bundle {
* @syscap SystemCapability.BundleManager.BundleFramework
* @import NA
* @permission NA
* @deprecated since 9
* @useinstead ohos.bundle.bundleManager.PermissionGrantState
*/
export enum GrantStatus {
PERMISSION_DENIED = -1,
@ -134,6 +107,8 @@ declare namespace bundle {
* @syscap SystemCapability.BundleManager.BundleFramework
* @import NA
* @permission NA
* @deprecated since 9
* @useinstead ohos.bundle.bundleManager.AbilityType
*/
export enum AbilityType {
/**
@ -171,6 +146,7 @@ declare namespace bundle {
* @syscap SystemCapability.BundleManager.BundleFramework
* @import NA
* @permission NA
* @deprecated since 9
*/
export enum AbilitySubType {
UNSPECIFIED = 0,
@ -183,6 +159,8 @@ declare namespace bundle {
* @syscap SystemCapability.BundleManager.BundleFramework
* @import NA
* @permission NA
* @deprecated since 9
* @useinstead ohos.bundle.bundleManager.DisplayOrientation
*/
export enum DisplayOrientation {
/**
@ -212,69 +190,6 @@ 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,
}
/**
@ -283,6 +198,8 @@ declare namespace bundle {
* @syscap SystemCapability.BundleManager.BundleFramework
* @import NA
* @permission NA
* @deprecated since 9
* @useinstead ohos.bundle.bundleManager.LaunchType
*/
export enum LaunchMode {
/**
@ -300,112 +217,13 @@ 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 {
/**
@ -422,6 +240,7 @@ declare namespace bundle {
* @syscap SystemCapability.BundleManager.BundleFramework
* @import NA
* @permission NA
* @deprecated since 9
*/
export enum InstallErrorCode{
SUCCESS = 0,
@ -467,61 +286,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.
*
@ -532,6 +296,8 @@ declare namespace bundle {
* @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
* @deprecated since 9
* @useinstead ohos.bundle.bundleManager#getBundleInfo
*/
function getBundleInfo(bundleName: string, bundleFlags: number, options: BundleOptions, callback: AsyncCallback<BundleInfo>): void;
function getBundleInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback<BundleInfo>): void;
@ -545,6 +311,8 @@ declare namespace bundle {
* @return 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<BundleInstaller>): void;
function getBundleInstaller(): Promise<BundleInstaller>;
@ -558,6 +326,8 @@ declare namespace bundle {
* @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
* @deprecated since 9
* @useinstead ohos.bundle.bundleManager#queryAbilityInfo
*/
function getAbilityInfo(bundleName: string, abilityName: string, callback: AsyncCallback<AbilityInfo>): void;
function getAbilityInfo(bundleName: string, abilityName: string): Promise<AbilityInfo>;
@ -573,6 +343,8 @@ declare namespace bundle {
* @param userId Indicates the user ID or do not pass user ID.
* @return Returns the ApplicationInfo object.
* @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
* @deprecated since 9
* @useinstead ohos.bundle.bundleManager#getApplicationInfo
*/
function getApplicationInfo(bundleName: string, bundleFlags: number, userId: number, callback: AsyncCallback<ApplicationInfo>) : void;
function getApplicationInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback<ApplicationInfo>) : void;
@ -590,6 +362,8 @@ declare namespace bundle {
* @param userId Indicates the user ID.
* @return 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<Array<AbilityInfo>>): void;
function queryAbilityByWant(want: Want, bundleFlags: number, callback: AsyncCallback<Array<AbilityInfo>>): void;
@ -605,6 +379,8 @@ declare namespace bundle {
* @param userId Indicates the user id.
* @return 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<Array<BundleInfo>>) : void;
function getAllBundleInfo(bundleFlag: BundleFlag, callback: AsyncCallback<Array<BundleInfo>>) : void;
@ -620,6 +396,8 @@ declare namespace bundle {
* @param userId Indicates the user ID or do not pass user ID.
* @return Returns a list of ApplicationInfo objects.
* @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
* @deprecated since 9
* @useinstead ohos.bundle.bundleManager#getAllApplicationInfo
*/
function getAllApplicationInfo(bundleFlags: number, userId: number, callback: AsyncCallback<Array<ApplicationInfo>>) : void;
function getAllApplicationInfo(bundleFlags: number, callback: AsyncCallback<Array<ApplicationInfo>>) : void;
@ -632,6 +410,8 @@ declare namespace bundle {
* @syscap SystemCapability.BundleManager.BundleFramework
* @param uid Indicates the UID of an application.
* @return Returns the bundle name.
* @deprecated since 9
* @useinstead ohos.bundle.bundleManager#getNameForUid
*/
function getNameForUid(uid: number, callback: AsyncCallback<string>) : void
function getNameForUid(uid: number) : Promise<string>;
@ -646,6 +426,8 @@ declare namespace bundle {
* @param bundleFlags Indicates the flag used to specify information contained in the BundleInfo object to be
* returned.
* @return Returns the BundleInfo object.
* @deprecated since 9
* @useinstead ohos.bundle.bundleManager#getBundleArchiveInfo
*/
function getBundleArchiveInfo(hapFilePath: string, bundleFlags: number, callback: AsyncCallback<BundleInfo>) : void
function getBundleArchiveInfo(hapFilePath: string, bundleFlags: number) : Promise<BundleInfo>;
@ -662,6 +444,8 @@ declare namespace bundle {
* @return 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<Want>): void;
function getLaunchWantForBundle(bundleName: string): Promise<Want>;
@ -675,6 +459,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>): void;
function cleanBundleCacheFiles(bundleName: string): Promise<void>;
@ -689,6 +475,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>): void;
function setApplicationEnabled(bundleName: string, isEnable: boolean): Promise<void>;
@ -703,26 +491,12 @@ 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>): void;
function setAbilityEnabled(info: AbilityInfo, isEnable: boolean): Promise<void>;
/**
* 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<Array<ExtensionAbilityInfo>>): void;
function queryExtensionAbilityInfos(want: Want, extensionType: number, extensionFlags: number, callback: AsyncCallback<Array<ExtensionAbilityInfo>>): void;
function queryExtensionAbilityInfos(want: Want, extensionType: number, extensionFlags: number, userId?: number): Promise<Array<ExtensionAbilityInfo>>;
/**
* Get the permission details by permissionName.
*
@ -732,6 +506,8 @@ declare namespace bundle {
* @return 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<PermissionDef>): void;
function getPermissionDef(permissionName: string): Promise<PermissionDef>;
@ -745,6 +521,8 @@ declare namespace bundle {
* @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.
* @deprecated since 9
* @useinstead ohos.bundle.bundleManager#getAbilityLabel
*/
function getAbilityLabel(bundleName: string, abilityName: string, callback: AsyncCallback<string>): void;
function getAbilityLabel(bundleName: string, abilityName: string): Promise<string>;
@ -758,6 +536,8 @@ declare namespace bundle {
* @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
* @deprecated since 9
* @useinstead ohos.bundle.bundleManager#getAbilityIcon
*/
function getAbilityIcon(bundleName: string, abilityName: string, callback: AsyncCallback<image.PixelMap>): void;
function getAbilityIcon(bundleName: string, abilityName: string): Promise<image.PixelMap>;
@ -769,7 +549,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<boolean>): void;
function isAbilityEnabled(info: AbilityInfo): Promise<boolean>;
@ -780,434 +562,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<boolean>): void;
function isApplicationEnabled(bundleName: string): Promise<boolean>;
/**
* 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>):void;
function setModuleUpgradeFlag(bundleName: string, moduleName: string, upgradeFlag: UpgradeFlag): Promise<void>;
/**
* 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<boolean>): void;
function isModuleRemovable(bundleName: string, moduleName: string): Promise<boolean>;
/**
* 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<pack.BundlePackInfo>): void;
function getBundlePackInfo(bundleName: string, bundlePackFlag : pack.BundlePackFlag): Promise<pack.BundlePackInfo>;
/**
* 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<AbilityInfo>): void;
function getAbilityInfo(bundleName: string, moduleName: string, abilityName: string): Promise<AbilityInfo>;
/**
* 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<DispatchInfo>): void;
function getDispatcherVersion(): Promise<DispatchInfo>;
/**
* 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<string>): void;
function getAbilityLabel(bundleName: string, moduleName: string, abilityName: string): Promise<string>;
/**
* 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<image.PixelMap>): void;
function getAbilityIcon(bundleName: string, moduleName: string, abilityName: string): Promise<image.PixelMap>;
/**
* 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<Array<string>>): void;
function getProfileByAbility(moduleName: string, abilityName: string, metadataName?: string): Promise<Array<string>>;
/**
* 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<Array<string>>): void;
function getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName?: string): Promise<Array<string>>;
/**
* 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>): void;
function setDisposedStatus(bundleName: string, status: number): Promise<void>;
/**
* 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<number>): void;
function getDisposedStatus(bundleName: string): Promise<number>;
/**
* 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;

View File

@ -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.DefaultAppManager
* @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.DefaultAppManager
* @since 9
* @syscap SystemCapability.BundleManager.BundleFramework
* @permission N/A
*/
export enum ApplicationType {
/**
* default browser identifier.
*
* Default browser identifier.
* @syscap SystemCapability.BundleManager.BundleFramework.DefaultAppManager
* @since 9
*/
BROWSER = "BROWSER",
BROWSER = "Web Browser",
/**
* default image identifier.
*
* Default image identifier.
* @syscap SystemCapability.BundleManager.BundleFramework.DefaultAppManager
* @since 9
*/
IMAGE = "IMAGE",
IMAGE = "Image Gallery",
/**
* default audio identifier.
*
* Default audio identifier.
* @syscap SystemCapability.BundleManager.BundleFramework.DefaultAppManager
* @since 9
*/
AUDIO = "AUDIO",
AUDIO = "Audio Player",
/**
* default video identifier.
*
* Default video identifier.
* @syscap SystemCapability.BundleManager.BundleFramework.DefaultAppManager
* @since 9
*/
VIDEO = "VIDEO",
VIDEO = "Video Player",
/**
* default pdf identifier.
*
* Default PDF identifier.
* @syscap SystemCapability.BundleManager.BundleFramework.DefaultAppManager
* @since 9
*/
PDF = "PDF",
PDF = "PDF Viewer",
/**
* default word identifier.
*
* Default word identifier.
* @syscap SystemCapability.BundleManager.BundleFramework.DefaultAppManager
* @since 9
*/
WORD = "WORD",
WORD = "Word Viewer",
/**
* default excel identifier.
*
* Default excel identifier.
* @syscap SystemCapability.BundleManager.BundleFramework.DefaultAppManager
* @since 9
*/
EXCEL = "EXCEL",
EXCEL = "Excel Viewer",
/**
* default ppt identifier.
*
* Default PPT identifier.
* @syscap SystemCapability.BundleManager.BundleFramework.DefaultAppManager
* @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<boolean> } 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.DefaultAppManager
* @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<boolean>;
function isDefaultApplication(type: string, callback: AsyncCallback<boolean>) : 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<boolean> } 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.DefaultAppManager
* @since 9
*/
function isDefaultApplication(type: string) : Promise<boolean>;
/**
* 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.
* @param { AsyncCallback<BundleInfo> } 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.DefaultAppManager
* @systemapi
* @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.
* @permission ohos.permission.GET_DEFAULT_APPLICATION
* @systemapi hide this for inner system use.
*/
function getDefaultApplication(type: string, userId?: number) : Promise<BundleInfo>;
function getDefaultApplication(type: string, userId: number, callback: AsyncCallback<BundleInfo>) : void;
function getDefaultApplication(type: string, callback: AsyncCallback<BundleInfo>) : 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<BundleInfo> } 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.DefaultAppManager
* @systemapi
* @since 9
*/
function getDefaultApplication(type: string, userId?: number) : Promise<BundleInfo>;
/**
* 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.
* @param { AsyncCallback<void> } 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 and type does not match.
* @syscap SystemCapability.BundleManager.BundleFramework.DefaultAppManager
* @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.
* @permission ohos.permission.SET_DEFAULT_APPLICATION
* @systemapi hide this for inner system use.
*/
function setDefaultApplication(type: string, elementName: ElementName, userId?: number) : Promise<void>;
function setDefaultApplication(type: string, elementName: ElementName, userId: number, callback: AsyncCallback<void>) : void;
function setDefaultApplication(type: string, elementName: ElementName, callback: AsyncCallback<void>) : void;
/**
* reset default application based on type.
*
* @since 9
* @syscap SystemCapability.BundleManager.BundleFramework
* @param type application type or file type.
* @param userId indicates the id for the user.
* 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.
* @returns { Promise<void> } 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 and type does not match.
* @syscap SystemCapability.BundleManager.BundleFramework.DefaultAppManager
* @systemapi
* @since 9
*/
function setDefaultApplication(type: string, elementName: ElementName, userId?: number) : Promise<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.
* @param { AsyncCallback<void> } 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.DefaultAppManager
* @systemapi
* @since 9
*/
function resetDefaultApplication(type: string, userId?: number) : Promise<void>;
function resetDefaultApplication(type: string, userId: number, callback: AsyncCallback<void>) : void;
function resetDefaultApplication(type: string, callback: AsyncCallback<void>) : 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<void> } 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.DefaultAppManager
* @systemapi
* @since 9
*/
function resetDefaultApplication(type: string, userId?: number) : Promise<void>;
}
export default defaultAppManager;
export default defaultAppManager;

185
api/@ohos.bundle.distributedBundle.d.ts vendored Normal file
View File

@ -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<RemoteAbilityInfo> } 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<RemoteAbilityInfo>): 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<RemoteAbilityInfo> } 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<RemoteAbilityInfo>;
/**
* Obtains information about the abilities info of the remote device.
* @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
* @param { Array<ElementName> } elementNames - Indicates the elementNames, Maximum array length ten.
* @param { AsyncCallback<Array<RemoteAbilityInfo>> } 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<ElementName>, callback: AsyncCallback<Array<RemoteAbilityInfo>>): void;
/**
* Obtains information about the abilities info of the remote device.
* @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
* @param { Array<ElementName> } elementNames - Indicates the elementNames, Maximum array length ten.
* @returns { Promise<Array<RemoteAbilityInfo>> } 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<ElementName>): Promise<Array<RemoteAbilityInfo>>;
/**
* 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<RemoteAbilityInfo> } 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<RemoteAbilityInfo>): 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<Array<RemoteAbilityInfo>> } 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<RemoteAbilityInfo>;
/**
* Obtains information about the ability info of the remote device.
* @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
* @param { Array<ElementName> } 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<ElementName>, locale: string, callback: AsyncCallback<Array<RemoteAbilityInfo>>): void;
/**
* Obtains information about the abilities info of the remote device.
* @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
* @param { Array<ElementName> } elementNames - Indicates the elementNames, Maximum array length ten.
* @param { string } locale - Indicates the locale info
* @returns { Promise<Array<RemoteAbilityInfo>> } 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<ElementName>, locale: string): Promise<Array<RemoteAbilityInfo>>;
/**
* Contains basic remote ability information.
* @syscap SystemCapability.BundleManager.DistributedBundleFramework
* @systemapi
* @since 9
*/
export type RemoteAbilityInfo = _RemoteAbilityInfo;
}
export default distributedBundle;

313
api/@ohos.bundle.freeInstall.d.ts vendored Normal file
View File

@ -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 wether 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<void> } 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>) : void;
/**
* Sets wether 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<void> } - 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<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.
* @param { AsyncCallback<boolean> } 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<boolean>): 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<void>} 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<boolean>;
/**
* Obtains bundlePackInfo based on bundleName and bundleFlags.
* @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<BundlePackInfo> } 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<BundlePackInfo>): void;
/**
* Obtains bundlePackInfo based on bundleName and bundleFlags.
* @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<BundlePackInfo>} 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<BundlePackInfo>;
/**
* Obtains information about the dispatcher version.
* @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
* @param { AsyncCallback<DispatchInfo> } 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<DispatchInfo>): void;
/**
* Obtains information about the dispatcher version.
* @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
* @returns { Promise<DispatchInfo> } 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<DispatchInfo>;
/**
* 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;

View File

@ -13,10 +13,10 @@
* limitations under the License.
*/
import { AsyncCallback, Callback } from './basic';
import { AsyncCallback } from './basic';
import { BundleStatusCallback } from './bundle/bundleStatusCallback';
import { LauncherAbilityInfo as _LauncherAbilityInfo } from './bundle/launcherAbilityInfo';
import * as _ShortCutInfo from './bundle/shortcutInfo';
import { LauncherAbilityInfo } from './bundle/launcherAbilityInfo';
import { ShortcutInfo } from './bundle/shortcutInfo';
/**
* inner bundle manager.
@ -25,6 +25,8 @@ import * as _ShortCutInfo from './bundle/shortcutInfo';
* @syscap SystemCapability.BundleManager.BundleFramework
* @permission NA
* @systemapi Hide this for inner system use
* @deprecated since 9
* @useinstead ohos.bundle.launcherBundleManager
*/
declare namespace innerBundleManager {
@ -38,6 +40,8 @@ declare namespace innerBundleManager {
* @return 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<Array<LauncherAbilityInfo>>) : void;
function getLauncherAbilityInfos(bundleName: string, userId: number) : Promise<Array<LauncherAbilityInfo>>;
@ -52,6 +56,8 @@ declare namespace innerBundleManager {
* @return Returns the result or error maeeage.
* @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<string>) : void;
function on(type:"BundleStatusChange", bundleStatusCallback : BundleStatusCallback): Promise<string>;
@ -65,6 +71,8 @@ declare namespace innerBundleManager {
* @return Returns the result or error maeeage.
* @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<string>) : void;
function off(type:"BundleStatusChange"): Promise<string>;
@ -78,6 +86,8 @@ declare namespace innerBundleManager {
* @return 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<Array<LauncherAbilityInfo>>) : void;
function getAllLauncherAbilityInfos(userId: number) : Promise<Array<LauncherAbilityInfo>>;
@ -91,36 +101,11 @@ declare namespace innerBundleManager {
* @return 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<Array<ShortcutInfo>>) : void;
function getShortcutInfos(bundleName : string) : Promise<Array<ShortcutInfo>>;
/**
* 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;
/**
* 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;

179
api/@ohos.bundle.installer.d.ts vendored Normal file
View File

@ -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<BundleInstaller>): void
/**
* Obtains the interface used to install bundle.
* @param { AsyncCallback } callback - The callback of getting a list of BundleInstaller objects.
* @returns { Promise<BundleInstaller> } BundleInstaller object.
* @throws { BusinessError } 401 - Input parameters check failed.
* @syscap SystemCapability.BundleManager.BundleFramework.Core
* @systemapi
* @since 9
*/
function getBundleInstaller(): Promise<BundleInstaller>;
/**
* 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<string> } 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 userId is not existed.
* @throws { BusinessError } 17700010 - To parse file of config.json or module.json failed.
* @throws { BusinessError } 17700011 - To verify signature failed.
* @throws { BusinessError } 17700012 - Invalid hap file path or too large file size.
* @throws { BusinessError } 17700015 - Multiple haps have inconsistent configured information.
* @throws { BusinessError } 17700016 - No disk space left for installation.
* @throws { BusinessError } 17700017 - Downgrade installation is prohibited.
* @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<string>, installParam: InstallParam, callback: AsyncCallback<void>) : 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 uninstallation.
* @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 userId is not existed.
* @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>) : void;
/**
* recover 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 uninstallation.
* @param { AsyncCallback } callback - The callback of recoverring 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 userId is not existed.
* @syscap SystemCapability.BundleManager.BundleFramework.Core
* @systemapi
* @since 9
*/
recover(bundleName: string, installParam: InstallParam, callback: AsyncCallback<void>): 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<HashParam>;
/**
* Indicates the deadline of the crowdtesting bundle
* @syscap SystemCapability.BundleManager.BundleFramework.Core
* @since 9
*/
crowdtestDeadline?: number;
}
}
export default installer;

View File

@ -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<Array<LauncherAbilityInfo>> } 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<Array<LauncherAbilityInfo>>) : 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<Array<LauncherAbilityInfo>> } 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<Array<LauncherAbilityInfo>>;
/**
* 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<Array<LauncherAbilityInfo>> } 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<Array<LauncherAbilityInfo>>) : 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<Array<LauncherAbilityInfo>> } 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<Array<LauncherAbilityInfo>>;
/**
* 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<Array<ShortcutInfo>> } 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<Array<ShortcutInfo>>) : 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<Array<ShortcutInfo>> } 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<Array<ShortcutInfo>>;
/**
* 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;

View File

@ -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<BundleActiveFormInfo>;
}
/**
* @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<boolean>): void;
function isIdleState(bundleName: string): Promise<boolean>;
@ -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<number>): void;
function queryAppUsagePriorityGroup(): Promise<number>;
@ -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<BundleActiveInfoResponse>): void;
function queryBundleStateInfos(begin: number, end: number): Promise<BundleActiveInfoResponse>;
@ -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<Array<BundleStateInfo>>): void;
function queryBundleStateInfoByInterval(byInterval: IntervalType, begin: number, end: number): Promise<Array<BundleStateInfo>>;
@ -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<Array<BundleActiveState>>): void;
function queryBundleActiveStates(begin: number, end: number): Promise<Array<BundleActiveState>>;
@ -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<Array<BundleActiveState>>): void;
function queryCurrentBundleActiveStates(begin: number, end: number): Promise<Array<BundleActiveState>>;
/**
* 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<Array<BundleActiveModuleInfo>>): void;
function getRecentlyUsedModules(maxNum: number, callback: AsyncCallback<Array<BundleActiveModuleInfo>>): void;
function getRecentlyUsedModules(maxNum?: number): Promise<Array<BundleActiveModuleInfo>>;
/**
* Queries the usage priority group of the calling application.
*
* <p>The priority defined in a priority group restricts the resource usage of an application,
* for example, restricting the running of background tasks. </p>
*
* @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<number>): void;
function queryAppUsagePriorityGroup(bundleName: string, callback: AsyncCallback<number>): void;
function queryAppUsagePriorityGroup(bundleName?: string): Promise<number>;
/**
* 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>): void;
function setBundleGroup(bundleName: string, newGroup: GroupType): Promise<void>;
/**
* 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<BundleActiveGroupCallbackInfo>, 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<BundleActiveGroupCallbackInfo>, callback: AsyncCallback<void>): void;
function registerGroupCallBack(groupCallback: Callback<BundleActiveGroupCallbackInfo>): Promise<void>;
/**
* 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>): void;
function unRegisterGroupCallBack(): Promise<void>;
/*
* 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<Array<BundleActiveEventState>>): void;
function queryBundleActiveEventStates(begin: number, end: number): Promise<Array<BundleActiveEventState>>;
/**
* 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<Array<BundleActiveEventState>>): void;
function queryAppNotificationNumber(begin: number, end: number): Promise<Array<BundleActiveEventState>>;
}
export default bundleState;

View File

@ -25,6 +25,8 @@ import { CommonEventPublishData } from './commonEvent/commonEventPublishData';
* @since 7
* @syscap SystemCapability.Notification.CommonEvent
* @permission N/A
* @deprecated since 9
* @useinstead ohos.commonEventManager
*/
declare namespace commonEvent {
/**
@ -34,6 +36,8 @@ declare namespace commonEvent {
* @param event name of the common event.
* @param callback Specified callback method.
* @return -
* @deprecated since 9
* @useinstead ohos.commonEventManager.publish
*/
function publish(event: string, callback: AsyncCallback<void>): void;
@ -45,6 +49,8 @@ declare namespace commonEvent {
* @param options Indicate the CommonEventPublishData containing the common event content and attributes.
* @param callback Specified callback method.
* @return -
* @deprecated since 9
* @useinstead ohos.commonEventManager.publish
*/
function publish(event: string, options: CommonEventPublishData, callback: AsyncCallback<void>): void;
@ -58,6 +64,8 @@ declare namespace commonEvent {
* @return -
*
* @systemapi Hide this for inner system use.
* @deprecated since 9
* @useinstead ohos.commonEventManager.publishAsUser
*/
function publishAsUser(event: string, userId: number, callback: AsyncCallback<void>): void;
@ -72,6 +80,8 @@ declare namespace commonEvent {
* @return -
*
* @systemapi Hide this for inner system use.
* @deprecated since 9
* @useinstead ohos.commonEventManager.publishAsUser
*/
function publishAsUser(event: string, userId: number, options: CommonEventPublishData, callback: AsyncCallback<void>): void;
@ -82,6 +92,8 @@ declare namespace commonEvent {
* @param subscribeInfo Indicates the information of the subscriber.
* @param callback Specified callback method.
* @return -
* @deprecated since 9
* @useinstead ohos.commonEventManager.createSubscriber
*/
function createSubscriber(subscribeInfo: CommonEventSubscribeInfo, callback: AsyncCallback<CommonEventSubscriber>): void;
@ -91,6 +103,8 @@ declare namespace commonEvent {
* @since 7
* @param subscribeInfo Indicates the information of the subscriber.
* @return Returns common event subscriber object
* @deprecated since 9
* @useinstead ohos.commonEventManager.createSubscriber
*/
function createSubscriber(subscribeInfo: CommonEventSubscribeInfo): Promise<CommonEventSubscriber>;
@ -101,6 +115,8 @@ declare namespace commonEvent {
* @param subscriber Indicate the subscriber of the common event.
* @param callback Specified callback method.
* @return -
* @deprecated since 9
* @useinstead ohos.commonEventManager.subscribe
*/
function subscribe(subscriber: CommonEventSubscriber, callback: AsyncCallback<CommonEventData>): void;
@ -111,6 +127,8 @@ declare namespace commonEvent {
* @param subscriber Indicate the subscriber of the common event.
* @param callback Specified callback method.
* @return -
* @deprecated since 9
* @useinstead ohos.commonEventManager.unsubscribe
*/
function unsubscribe(subscriber: CommonEventSubscriber, callback?: AsyncCallback<void>): void;
@ -119,6 +137,8 @@ declare namespace commonEvent {
* @name Support
* @since 7
* @permission N/A
* @deprecated since 9
* @useinstead ohos.commonEventManager.Support
*/
export enum Support {
/**

Some files were not shown because too many files have changed in this diff Show More