diff --git a/api/@ohos.ability.ability.d.ts b/api/@ohos.ability.ability.d.ts index 44be58f12e8b9ef4cb8065dcefc71c68003f576b..dde29080261399f4c2f9b1ff815d44b17855456e 100755 --- a/api/@ohos.ability.ability.d.ts +++ b/api/@ohos.ability.ability.d.ts @@ -26,7 +26,7 @@ import { StartAbilityParameter as _StartAbilityParameter } from './ability/star * * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @StageModelOnly + * @FAModelOnly */ declare namespace ability { @@ -50,6 +50,7 @@ declare namespace ability { /** * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly */ export type DataAbilityOperation = _DataAbilityOperation @@ -57,24 +58,28 @@ declare namespace ability { * @name DataAbilityResult * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly */ export type DataAbilityResult = _DataAbilityResult /** * @since 9 * @syscap SystemCapability.Ability.AbilityBase + * @FAModelOnly */ export type AbilityResult = _AbilityResult /** * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @FAModelOnly */ export type ConnectOptions = _ConnectOptions /** * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.FAModel + * @FAModelOnly */ export type StartAbilityParameter = _StartAbilityParameter } diff --git a/api/@ohos.ability.wantConstant.d.ts b/api/@ohos.ability.wantConstant.d.ts index 15ce6b7a38b7e0742efabde7e282d361b7686d59..9ad6e2e43a9cb602118252b46736f42557f94169 100644 --- a/api/@ohos.ability.wantConstant.d.ts +++ b/api/@ohos.ability.wantConstant.d.ts @@ -19,6 +19,8 @@ * @since 6 * @syscap SystemCapability.Ability.AbilityBase * @permission N/A + * @deprecated since 9 + * @useinstead ohos.app.ability.wantConstant */ declare namespace wantConstant { /** diff --git a/api/@ohos.app.ability.Ability.d.ts b/api/@ohos.app.ability.Ability.d.ts new file mode 100755 index 0000000000000000000000000000000000000000..b41d046740a277dd82ca772da98b3a5a0e9d7cd8 --- /dev/null +++ b/api/@ohos.app.ability.Ability.d.ts @@ -0,0 +1,312 @@ +/* + * 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 AbilityContext from "./application/AbilityContext"; +import rpc from './@ohos.rpc'; +import Want from './@ohos.app.ability.Want'; +import window from './@ohos.window'; +import { Configuration } from './@ohos.app.ability.Configuration'; + +/** + * The prototype of the listener function interface registered by the Caller. + * @typedef OnReleaseCallback + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @stagemodelonly + * @since 9 + */ +export interface OnReleaseCallback { + (msg: string): void; +} + +/** + * The prototype of the message listener function interface registered by the Callee. + * @typedef CalleeCallback + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @stagemodelonly + * @since 9 + */ +export interface CalleeCallback { + (indata: rpc.MessageParcel): rpc.Sequenceable; +} + +/** + * The interface of a Caller. + * @interface + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @stagemodelonly + * @since 9 + */ +export interface Caller { + /** + * Notify the server of Sequenceable type data. + * @param { string } method - The notification event string listened to by the callee. + * @param { rpc.Sequenceable } data - Notification data to the callee. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @stagemodelonly + * @since 9 + */ + call(method: string, data: rpc.Sequenceable): Promise; + + /** + * Notify the server of Sequenceable type data and return the notification result. + * @param { string } method - The notification event string listened to by the callee. + * @param { rpc.Sequenceable } data - Notification data to the callee. + * @returns { Promise } Returns the callee's notification result data. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @stagemodelonly + * @since 9 + */ + callWithResult(method: string, data: rpc.Sequenceable): Promise; + + /** + * Clear service records. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @stagemodelonly + * @since 9 + */ + release(): void; + + /** + * Register death listener notification callback. + * @param { OnReleaseCallback } callback - Register a callback function for listening for notifications. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @stagemodelonly + * @since 9 + */ + onRelease(callback: OnReleaseCallback): void; + + /** + * Register death listener notification callback. + * @param { string } type - release. + * @param { OnReleaseCallback } callback - Register a callback function for listening for notifications. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @stagemodelonly + * @since 9 + */ + on(type: "release", callback: OnReleaseCallback): void; + + /** + * Unregister death listener notification callback. + * @param { string } type - release. + * @param { OnReleaseCallback } callback - Unregister a callback function for listening for notifications. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @stagemodelonly + * @since 9 + */ + off(type: "release", callback: OnReleaseCallback): void; + + /** + * Unregister all death listener notification callback. + * @param { string } type - release. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @stagemodelonly + * @since 9 + */ + off(type: "release"): void; +} + +/** + * The interface of a Callee. + * @interface + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @stagemodelonly + * @since 9 + */ +export interface Callee { + /** + * Register data listener callback. + * @param { string } method - A string registered to listen for notification events. + * @param { CalleeCallback } callback - Register a callback function that listens for notification events. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @stagemodelonly + * @since 9 + */ + on(method: string, callback: CalleeCallback): void; + + /** + * Unregister data listener callback. + * @param { string } method - A string registered to listen for notification events. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @stagemodelonly + * @since 9 + */ + off(method: string): void; +} + +/** + * The class of an ability. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @stagemodelonly + * @since 9 + */ +export default class Ability { + /** + * Indicates configuration information about an ability context. + * @type { AbilityContext } + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @stagemodelonly + * @since 9 + */ + context: AbilityContext; + + /** + * 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 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 dump client information is required. + * It is recommended that developers don't DUMP sensitive information. + * @param { Array } params - Indicates the params from command. + * @returns { Array } Return the dump info array. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @stagemodelonly + * @since 9 + */ + onDump(params: Array): Array; + + /** + * 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; +} diff --git a/api/@ohos.app.ability.AbilityConstant.d.ts b/api/@ohos.app.ability.AbilityConstant.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f5c61caeb264a4b638a3d96c8116b4a93b46c926 --- /dev/null +++ b/api/@ohos.app.ability.AbilityConstant.d.ts @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * 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, + } + + /** + * 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, + } +} + +export default AbilityConstant diff --git a/api/@ohos.app.ability.AbilityLifecycleCallback.d.ts b/api/@ohos.app.ability.AbilityLifecycleCallback.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a94e3e71d421a652effcb52d92c153a87a238779 --- /dev/null +++ b/api/@ohos.app.ability.AbilityLifecycleCallback.d.ts @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Ability from "./@ohos.app.ability.Ability"; +import dataAbility from "./@ohos.data.dataAbility"; +import window from './@ohos.window'; + +/** + * The ability lifecycle callback. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @stagemodelonly + * @since 9 + */ +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: Ability): 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: Ability, 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: Ability, 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: Ability, 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: Ability, 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: Ability): 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: Ability): 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: Ability): 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: Ability): void; +} \ No newline at end of file diff --git a/api/@ohos.app.ability.AbilityStage.d.ts b/api/@ohos.app.ability.AbilityStage.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8aa0201a3f3c1ad0e0d2e394e8970ecccb3bbcef --- /dev/null +++ b/api/@ohos.app.ability.AbilityStage.d.ts @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import AbilityConstant from "./@ohos.app.ability.AbilityConstant"; +import AbilityStageContext from "./application/AbilityStageContext"; +import Want from './@ohos.app.ability.Want'; +import { Configuration } from './@ohos.app.ability.Configuration'; + +/** + * The class of an ability stage. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ +export default class AbilityStage { + /** + * Indicates configuration information about context. + * @type { AbilityStageContext } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + context: AbilityStageContext; + + /** + * Called back when an ability stage is started for initialization. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + onCreate(): void; + + /** + * Called back when start specified ability. + * @param { Want } want - Indicates the want info of 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; +} diff --git a/api/@ohos.app.ability.Configuration.d.ts b/api/@ohos.app.ability.Configuration.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b5f11c28d254a422316cb7a48353ad53dc13344f --- /dev/null +++ b/api/@ohos.app.ability.Configuration.d.ts @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ConfigurationConstant from "./@ohos.app.ability.ConfigurationConstant"; + +/** + * configuration item. + * @typedef Configuration + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ +export interface Configuration { + /** + * Indicates the current language of the application. + * @type { string } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + language?: string; + + /** + * Indicates the current colorMode of the application. + * @type { ConfigurationConstant.ColorMode } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + colorMode?: ConfigurationConstant.ColorMode; + + /** + * Indicates the screen direction of the current device. + * @type { ConfigurationConstant.Direction } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + direction?: ConfigurationConstant.Direction; + + /** + * Indicates the screen density of the current device. + * @type { ConfigurationConstant.ScreenDensity } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + screenDensity?: ConfigurationConstant.ScreenDensity; + + /** + * Indicates the displayId of the current device. + * @type { number } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + displayId?: number; + + /** + * Indicates whether a pointer type device has connected. + * @type { boolean } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + hasPointerDevice?: boolean; +} diff --git a/api/@ohos.app.ability.ConfigurationConstant.d.ts b/api/@ohos.app.ability.ConfigurationConstant.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..303647c93b6833a7286bb4c86b5de53172822a13 --- /dev/null +++ b/api/@ohos.app.ability.ConfigurationConstant.d.ts @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * The definition of ConfigurationConstant. + * @namespace ConfigurationConstant + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + declare namespace ConfigurationConstant { + /** + * ColorMode + * @enum { number } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + export enum ColorMode { + COLOR_MODE_NOT_SET = -1, + COLOR_MODE_DARK = 0, + COLOR_MODE_LIGHT = 1, + } + + /** + * Direction + * @enum { number } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + export enum Direction { + DIRECTION_NOT_SET = -1, + DIRECTION_VERTICAL = 0, + DIRECTION_HORIZONTAL = 1, + } + + /** + * ScreenDensity + * @name ScreenDensity + * @enum { number } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + export enum ScreenDensity { + SCREEN_DENSITY_NOT_SET = 0, + SCREEN_DENSITY_SDPI = 120, + SCREEN_DENSITY_MDPI = 160, + SCREEN_DENSITY_LDPI = 240, + SCREEN_DENSITY_XLDPI = 320, + SCREEN_DENSITY_XXLDPI = 480, + SCREEN_DENSITY_XXXLDPI = 640, + } +} + +export default ConfigurationConstant diff --git a/api/@ohos.app.ability.EnvironmentCallback.d.ts b/api/@ohos.app.ability.EnvironmentCallback.d.ts new file mode 100755 index 0000000000000000000000000000000000000000..03ccc013c37461487b4f203be3cd28940f895697 --- /dev/null +++ b/api/@ohos.app.ability.EnvironmentCallback.d.ts @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Configuration } from './@ohos.app.ability.Configuration'; + +/** + * The environment callback. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ +export default class EnvironmentCallback { + /** + * Called when the system configuration is updated. + * @param { Configuration } config - Indicates the updated configuration. + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @stagemodelonly + * @since 9 + */ + onConfigurationUpdated(config: Configuration): void; +} diff --git a/api/@ohos.app.ability.ExtensionAbility.d.ts b/api/@ohos.app.ability.ExtensionAbility.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6f27489e3f3df8408f615c7ae75bdaf04d83a492 --- /dev/null +++ b/api/@ohos.app.ability.ExtensionAbility.d.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import AbilityConstant from "./@ohos.app.ability.AbilityConstant"; +import { Configuration } from './@ohos.app.ability.Configuration'; + +/** + * class of extension. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ +export default class ExtensionAbility { + /** + * Called when the system configuration is updated. + * @param { Configuration } newConfig - Indicates the updated configuration. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + 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; +} \ No newline at end of file diff --git a/api/@ohos.app.ability.ServiceExtensionAbility.d.ts b/api/@ohos.app.ability.ServiceExtensionAbility.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d4eaab2f12079d274012c15d2d4b5c9b5a8ae94d --- /dev/null +++ b/api/@ohos.app.ability.ServiceExtensionAbility.d.ts @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import rpc from "./@ohos.rpc"; +import ServiceExtensionContext from "./application/ServiceExtensionContext"; +import Want from './@ohos.app.ability.Want'; +import { Configuration } from './@ohos.app.ability.Configuration'; + +/** + * class of service extension ability. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ +export default class ServiceExtensionAbility { + /** + * Indicates service extension ability context. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ + context: ServiceExtensionContext; + + /** + * Called back when a service extension is started for initialization. + * @param { Want } want - Indicates the want of created service extension. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ + onCreate(want: Want): void; + + /** + * Called back before a service extension is destroyed. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ + onDestroy(): void; + + /** + * Called back when a service extension is started. + * @param { Want } want - Indicates the want of service extension to start. + * @param { number } startId - Indicates the number of times the service extension has been started. + * The {@code startId} is incremented by 1 every time the service extension is started. + * For example, if the service extension has been started for six times. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ + onRequest(want: Want, startId: number): void; + + /** + * Called back when a service extension is first connected to an ability. + * @param { Want } want - Indicates connection information about the Service ability. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ + onConnect(want: Want): rpc.RemoteObject; + + /** + * Called back when all abilities connected to a service extension are disconnected. + * @param { Want } want - Indicates disconnection information about the service extension. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ + onDisconnect(want: Want): void; + + /** + * Called when a new client attempts to connect to a service extension after all previous client connections to it + * are disconnected. + * @param { Want } want - Indicates the want of the service extension being connected. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ + onReconnect(want: Want): void; + + /** + * Called when the system configuration is updated. + * @param { Configuration } newConfig - Indicates the updated configuration. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ + onConfigurationUpdate(newConfig: Configuration): void; + + /** + * Called when dump client information is required. + * It is recommended that developers don't DUMP sensitive information. + * @param { Array } params - Indicates the params from command. + * @return { Array } The dump info array. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ + onDump(params: Array): Array; +} diff --git a/api/@ohos.app.ability.StartOptions.d.ts b/api/@ohos.app.ability.StartOptions.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2650fce27a14a68529ff154d9b2f25d1f6c55f56 --- /dev/null +++ b/api/@ohos.app.ability.StartOptions.d.ts @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * StartOptions is the basic communication component of the system. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ +export default class StartOptions { + /** + * windowMode + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + windowMode?: number; + + /** + * displayId + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + displayId?: number; +} \ No newline at end of file diff --git a/api/@ohos.app.ability.Want.d.ts b/api/@ohos.app.ability.Want.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..39f02017e5703848cbd06d7cd865bc758eea8d3e --- /dev/null +++ b/api/@ohos.app.ability.Want.d.ts @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Want is the basic communication component of the system. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ +export default class Want { + /** + * device id + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + deviceId?: string; + + /** + * bundle name + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + bundleName?: string; + + /** + * ability name + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + abilityName?: string; + + /** + * The description of a URI in a Want. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + uri?: string; + + /** + * The description of the type in this Want. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + type?: string; + + /** + * The options of the flags in this Want. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + flags?: number; + + /** + * The description of an action in an want. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + action?: string; + + /** + * The description of the WantParams object in an Want + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + parameters?: {[key: string]: any}; + + /** + * The description of a entities in a Want. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + entities?: Array; + + /** + * The description of an module name in an want. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + moduleName?: string; +} diff --git a/api/@ohos.app.ability.abilityDelegatorRegistry.d.ts b/api/@ohos.app.ability.abilityDelegatorRegistry.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a3177d986c0fc589bbfc0769d8b6ec098d8c5206 --- /dev/null +++ b/api/@ohos.app.ability.abilityDelegatorRegistry.d.ts @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { AbilityDelegator as _AbilityDelegator } from './application/abilityDelegator'; +import { AbilityDelegatorArgs as _AbilityDelegatorArgs } from './application/abilityDelegatorArgs'; +import { AbilityMonitor as _AbilityMonitor } from './application/abilityMonitor'; +import { ShellCmdResult as _ShellCmdResult } from './application/shellCmdResult'; + +/** + * A global register used to store the AbilityDelegator and AbilityDelegatorArgs objects registered + * during application startup. + * @namespace abilityDelegatorRegistry + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ +declare namespace abilityDelegatorRegistry { + /** + * Get the AbilityDelegator object of the application. + * @returns { AbilityDelegator } Return the AbilityDelegator object initialized when the application is started. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function getAbilityDelegator(): AbilityDelegator; + + /** + * Get unit test arguments stored in the AbilityDelegatorArgs object. + * @returns { AbilityDelegator } Return the previously registered AbilityDelegatorArgs object. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function getArguments(): AbilityDelegatorArgs; + + /** + * Describes all lifecycle states of an ability. + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + export enum AbilityLifecycleState { + UNINITIALIZED, + CREATE, + FOREGROUND, + BACKGROUND, + DESTROY, + } + + /** + * A global test utility interface used for adding AbilityMonitor objects and control lifecycle states of abilities. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + export type AbilityDelegator = _AbilityDelegator + + /** + * Store unit testing-related parameters, including test case names, and test runner name. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + export type AbilityDelegatorArgs = _AbilityDelegatorArgs + + /** + * Provide methods for matching monitored Ability objects that meet specified conditions. + * The most recently matched Ability objects will be saved in the AbilityMonitor object. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + export type AbilityMonitor = _AbilityMonitor + + /** + * A object that records the result of shell command executes. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + export type ShellCmdResult = _ShellCmdResult +} + +export default abilityDelegatorRegistry; \ No newline at end of file diff --git a/api/@ohos.app.ability.abilityManager.d.ts b/api/@ohos.app.ability.abilityManager.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..fcf61cb6b214a0ae614170e4ae624d4434a918a0 --- /dev/null +++ b/api/@ohos.app.ability.abilityManager.d.ts @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { AsyncCallback } from './basic'; +import { Configuration } from './@ohos.app.ability.Configuration'; +import { AbilityRunningInfo as _AbilityRunningInfo } from './application/AbilityRunningInfo'; +import { ExtensionRunningInfo as _ExtensionRunningInfo } from './application/ExtensionRunningInfo'; +import { ElementName } from './bundle/elementName'; + +/** + * The class of an ability manager. + * @namespace abilityManager + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ +declare namespace abilityManager { + /** + * Enum for the ability state + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + export enum AbilityState { + INITIAL = 0, + FOREGROUND = 9, + BACKGROUND = 10, + FOREGROUNDING = 11, + BACKGROUNDING = 12 + } + + /** + * Updates the configuration by modifying the configuration. + * @permission ohos.permission.UPDATE_CONFIGURATION + * @param { Configuration } config - Indicates the new configuration. + * @param { AsyncCallback } callback - The callback of updateConfiguration. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + function updateConfiguration(config: Configuration, callback: AsyncCallback): void; + + /** + * Updates the configuration by modifying the configuration. + * @permission ohos.permission.UPDATE_CONFIGURATION + * @param { Configuration } config - Indicates the new configuration. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + function updateConfiguration(config: Configuration): Promise; + + /** + * Get information about running abilities + * @permission ohos.permission.GET_RUNNING_INFO + * @returns { Promise> } Returns the array of AbilityRunningInfo. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + function getAbilityRunningInfos(): Promise>; + + /** + * Get information about the running ability + * @permission ohos.permission.GET_RUNNING_INFO + * @param { AsyncCallback> } callback - The callback is used to return the array of AbilityRunningInfo. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + function getAbilityRunningInfos(callback: AsyncCallback>): void; + + /** + * Get information about running extensions + * @permission ohos.permission.GET_RUNNING_INFO + * @param { number } upperLimit - Get the maximum limit of the number of messages. + * @returns { Promise> } Returns the array of ExtensionRunningInfo. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + function getExtensionRunningInfos(upperLimit: number): Promise>; + + /** + * Get information about running extensions + * @permission ohos.permission.GET_RUNNING_INFO + * @param { number } upperLimit - Get the maximum limit of the number of messages. + * @param { AsyncCallback> } callback - The callback is used to return the array of ExtensionRunningInfo. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + function getExtensionRunningInfos(upperLimit: number, callback: AsyncCallback>): void; + + /** + * Get the top ability information of the display. + * @returns { Promise } Returns the elementName info of the top ability. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + function getTopAbility(): Promise; + + /** + * Get the top ability information of the display. + * @param { AsyncCallback } callback - The callback is used to return the elementName info of the top ability. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + function getTopAbility(callback: AsyncCallback): void; + + /** + * The class of an ability running information. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + export type AbilityRunningInfo = _AbilityRunningInfo + + /** + * The class of an extension running information. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + export type ExtensionRunningInfo = _ExtensionRunningInfo +} + +export default abilityManager; \ No newline at end of file diff --git a/api/@ohos.app.ability.appManager.d.ts b/api/@ohos.app.ability.appManager.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ebc1872c806476003af7a702ab638aa3c065cb1a --- /dev/null +++ b/api/@ohos.app.ability.appManager.d.ts @@ -0,0 +1,325 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { AsyncCallback } from './basic'; +import * as _ApplicationStateObserver from './application/ApplicationStateObserver'; +import * as _AbilityStateData from './application/AbilityStateData'; +import * as _AppStateData from './application/AppStateData'; +import { ProcessRunningInfo as _ProcessRunningInfo } from './application/ProcessRunningInfo'; +import { ProcessRunningInformation as _ProcessRunningInformation } from './application/ProcessRunningInformation'; + +/** + * This module provides the function of app manager service. + * @namespace appManager + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + * + */ +declare namespace appManager { + /** + * Enum for the application state + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + export enum ApplicationState { + STATE_CREATE, + STATE_FOREGROUND, + STATE_ACTIVE, + STATE_BACKGROUND, + STATE_DESTROY + } + + /** + * Enum for the process state + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + export enum ProcessState { + STATE_CREATE, + STATE_FOREGROUND, + STATE_ACTIVE, + STATE_BACKGROUND, + STATE_DESTROY + } + + /** + * Register application state observer. + * @permission ohos.permission.RUNNING_STATE_OBSERVER + * @param { string } type - applicationState. + * @param { ApplicationStateObserver } observer - The application state observer. + * @return { number } Returns the number code of the observer. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + function on(type: "applicationState", observer: ApplicationStateObserver): number; + + /** + * Register application state observer. + * @permission ohos.permission.RUNNING_STATE_OBSERVER + * @param { string } type - applicationState. + * @param { ApplicationStateObserver } observer - The application state observer. + * @param { Array } bundleNameList - The list of bundleName. The max length is 128. + * @return { number } Returns the number code of the observer. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + function on(type: "applicationState", observer: ApplicationStateObserver, bundleNameList: Array): number; + + /** + * Unregister application state observer. + * @permission ohos.permission.RUNNING_STATE_OBSERVER + * @param { string } type - applicationState. + * @param { number } observerId - Indicates the number code of the observer. + * @param { AsyncCallback } callback - The callback of off. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + function off(type: "applicationState", observerId: number, callback: AsyncCallback): void; + + /** + * Unregister application state observer. + * @permission ohos.permission.RUNNING_STATE_OBSERVER + * @param { string } type - applicationState. + * @param { number } observerId - Indicates the number code of the observer. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + function off(type: "applicationState", observerId: number): Promise; + + /** + * getForegroundApplications. + * @permission ohos.permission.GET_RUNNING_INFO + * @param { AsyncCallback> } callback - The callback is used to return the list of AppStateData. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + function getForegroundApplications(callback: AsyncCallback>): void; + + /** + * getForegroundApplications. + * @permission ohos.permission.GET_RUNNING_INFO + * @returns { Promise> } Returns the list of AppStateData. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + function getForegroundApplications(): Promise>; + + /** + * Kill process with account. + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS and ohos.permission.CLEAN_BACKGROUND_PROCESSES + * @param { string } bundleName - The process bundle name. + * @param { number } accountId - The account id. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + function killProcessWithAccount(bundleName: string, accountId: number): Promise; + + /** + * Kill process with account. + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS and ohos.permission.CLEAN_BACKGROUND_PROCESSES + * @param { string } bundleName - The process bundle name. + * @param { number } accountId - The account id. + * @param { AsyncCallback } callback - The callback of killProcessWithAccount. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + function killProcessWithAccount(bundleName: string, accountId: number, callback: AsyncCallback): void; + + /** + * Is user running in stability test. + * @param { AsyncCallback } callback - The callback is used to return true if user is running stability test. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function isRunningInStabilityTest(callback: AsyncCallback): void; + + /** + * Is user running in stability test. + * @returns { Promise } Returns true if user is running stability test. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function isRunningInStabilityTest(): Promise; + + /** + * Kill processes by bundle name + * @permission ohos.permission.CLEAN_BACKGROUND_PROCESSES + * @param { string } bundleName - bundle name. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + function killProcessesByBundleName(bundleName: string): Promise; + + /** + * Kill processes by bundle name + * @permission ohos.permission.CLEAN_BACKGROUND_PROCESSES + * @param { string } bundleName - bundle name. + * @param { AsyncCallback } callback - The callback of killProcessesByBundleName. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + function killProcessesByBundleName(bundleName: string, callback: AsyncCallback); + + /** + * Clear up application data by bundle name + * @permission ohos.permission.CLEAN_APPLICATION_DATA + * @param { string } bundleName - bundle name. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + function clearUpApplicationData(bundleName: string): Promise; + + /** + * Clear up application data by bundle name + * @permission ohos.permission.CLEAN_APPLICATION_DATA + * @param { string } bundleName - bundle name. + * @param { AsyncCallback } callback - The callback of clearUpApplicationData. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + function clearUpApplicationData(bundleName: string, callback: AsyncCallback); + + /** + * Is it a ram-constrained device + * @returns { Promise } Returns true if the device is ram-constrained. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function isRamConstrainedDevice(): Promise; + + /** + * Is it a ram-constrained device + * @param { AsyncCallback } callback - The callback is used to return true if the device is ram-constrained. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function isRamConstrainedDevice(callback: AsyncCallback): void; + + /** + * Get the memory size of the application + * @returns { Promise } Returns the application memory size. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function getAppMemorySize(): Promise; + + /** + * Get the memory size of the application + * @param { AsyncCallback } callback - The callback is used to return the application memory size. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function getAppMemorySize(callback: AsyncCallback): void; + + /** + * Get information about running processes + * @permission ohos.permission.GET_RUNNING_INFO + * @returns { Promise> } Returns the array of {@link ProcessRunningInformation}. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + function getProcessRunningInformation(): Promise>; + + /** + * Get information about running processes + * @permission ohos.permission.GET_RUNNING_INFO + * @param { AsyncCallback> } callback - The callback is used to return the array of {@link ProcessRunningInformation}. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + function getProcessRunningInformation(callback: AsyncCallback>): void; + + /** + * The ability or extension state data. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + export type AbilityStateData = _AbilityStateData.default + + /** + * The application state data. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + export type AppStateData = _AppStateData.default + + /** + * The application state observer. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + export type ApplicationStateObserver = _ApplicationStateObserver.default + + /** + * The class of an process running information. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + export type ProcessRunningInfo = _ProcessRunningInfo + + /** + * The class of a process running information. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + export type ProcessRunningInformation = _ProcessRunningInformation +} + +export default appManager; diff --git a/api/@ohos.app.ability.common.d.ts b/api/@ohos.app.ability.common.d.ts new file mode 100755 index 0000000000000000000000000000000000000000..1716916ce86e2b7f1913342e420e9bf390634e37 --- /dev/null +++ b/api/@ohos.app.ability.common.d.ts @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as _AbilityContext from './application/AbilityContext'; +import * as _AbilityStageContext from './application/AbilityStageContext'; +import * as _ApplicationContext from './application/ApplicationContext'; +import * as _BaseContext from './application/BaseContext'; +import * as _Context from './application/Context'; +import * as _ExtensionContext from './application/ExtensionContext'; +import * as _FormExtensionContext from './application/FormExtensionContext'; +import * as _EventHub from './application/EventHub'; +import * as _PermissionRequestResult from './application/PermissionRequestResult'; +import { 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 AbilityContext = _AbilityContext.default + + /** + * The context of an abilityStage. It allows access to abilityStage-specific resources. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + export type AbilityStageContext = _AbilityStageContext.default + + /** + * The context of an application. It allows access to application-specific resources. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + export type ApplicationContext = _ApplicationContext.default + + /** + * The base context of 'app.Context' for FA Mode or 'application.Context' for Stage Mode. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + export type BaseContext = _BaseContext.default + + /** + * The base context of an ability or an application. It allows access to + * application-specific resources. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + export type Context = _Context.default + + /** + * The context of an extension. It allows access to extension-specific resources. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + export type ExtensionContext = _ExtensionContext.default + + /** + * The context of form extension. It allows access to + * formExtension-specific resources. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + export type FormExtensionContext = _FormExtensionContext.default + + /** + * File area mode + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + export enum AreaMode { + /** + * @syscap SystemCapability.Ability.AbilityRuntime.Core + */ + EL1 = 0, + /** + * @syscap SystemCapability.Ability.AbilityRuntime.Core + */ + EL2 = 1 + } + + /** + * The event center of a context, support the subscription and publication of events. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + export type EventHub = _EventHub.default + + /** + * The result of requestPermissionsFromUser with asynchronous callback. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + export type PermissionRequestResult = _PermissionRequestResult.default + + /** + * Defines a PacMap object for storing a series of values. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + export type PacMap = _PacMap + + /** + * Indicates the result of startAbility. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + export type AbilityResult = _AbilityResult + + /** + * Indicates the callback of connection + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + export type ConnectOptions = _ConnectOptions +} + +export default common; diff --git a/api/@ohos.app.ability.errorManager.d.ts b/api/@ohos.app.ability.errorManager.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..10573f876d2656e024b895b74ab3b8210e0b2bad --- /dev/null +++ b/api/@ohos.app.ability.errorManager.d.ts @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { AsyncCallback } from './basic'; +import * as _ErrorObserver from './application/ErrorObserver'; + +/** + * This module provides the function of error manager. + * @namespace errorManager + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ +declare namespace errorManager { + /** + * Register error observer. + * @param { string } type - error. + * @param { ErrorObserver } observer - The error observer. + * @returns { number } Returns the number code of the observer. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function on(type: "error", observer: ErrorObserver): number; + + /** + * Unregister error observer. + * @param { string } type - error. + * @param { number } observerId - Indicates the number code of the observer. + * @param { AsyncCallback } callback - The callback of off. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function off(type: "error", observerId: number, callback: AsyncCallback): void; + + /** + * Unregister error observer. + * @param { string } type - error. + * @param { number } observerId - Indicates the number code of the observer. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function off(type: "error", observerId: number): Promise; + + /** + * The observer will be called by system when an error occurs. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + export type ErrorObserver = _ErrorObserver.default +} + +export default errorManager; diff --git a/api/@ohos.app.ability.missionManager.d.ts b/api/@ohos.app.ability.missionManager.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..efbed8686fd8d8b3373662f62c44f30e296334ac --- /dev/null +++ b/api/@ohos.app.ability.missionManager.d.ts @@ -0,0 +1,287 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { AsyncCallback } from './basic'; +import { MissionInfo as _MissionInfo } from './application/MissionInfo'; +import { MissionListener as _MissionListener } from './application/MissionListener'; +import { MissionSnapshot as _MissionSnapshot } from './application/MissionSnapshot'; +import StartOptions from "./@ohos.app.ability.StartOptions"; + +/** + * This module provides the capability to manage abilities and obtaining system task information. + * @permission ohos.permission.MANAGE_MISSIONS + * @namespace missionManager + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @systemapi + * @since 9 + */ +declare namespace missionManager { + /** + * Register the missionListener to ams. + * @param { string } type - mission. + * @param { MissionListener } listener - Indicates the MissionListener to be registered. + * @returns { number } Returns the index number of the MissionListener. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @since 9 + */ + function on(type: "mission", listener: MissionListener): number; + + /** + * Unrgister the missionListener to ams. + * @param { string } type - mission. + * @param { number } listenerId - Indicates the listener id to be unregistered. + * @param { AsyncCallback } callback - The callback of 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; + + /** + * Unrgister the missionListener to ams. + * @param { string } type - mission. + * @param { number } listenerId - Indicates the listener id to be unregistered. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @since 9 + */ + function off(type: "mission", listenerId: number): Promise; + + /** + * Get the missionInfo with the given missionId. + * @param { string } deviceId - Indicates the device to be queried. + * @param { number } missionId - Indicates mission id to be queried. + * @param { AsyncCallback } callback - The callback is used to return the MissionInfo of the given id. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @since 9 + */ + function getMissionInfo(deviceId: string, missionId: number, callback: AsyncCallback): void; + + /** + * Get the missionInfo with the given missionId. + * @param { string } deviceId - Indicates the device to be queried. + * @param { number } missionId - Indicates mission id to be queried. + * @returns { Promise } Returns the MissionInfo of the given id. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @since 9 + */ + function getMissionInfo(deviceId: string, missionId: number): Promise; + + /** + * Get the missionInfo with the given missionId. + * @param { string } deviceId - Indicates the device to be queried. + * @param { number } numMax - Indicates the maximum number of returned missions. + * @param { AsyncCallback> } callback - The callback is used to return the array of the MissionInfo. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @since 9 + */ + function getMissionInfos(deviceId: string, numMax: number, callback: AsyncCallback>): void; + + /** + * Get the missionInfo with the given missionId. + * @param { string } deviceId - Indicates the device to be queried. + * @param { number } numMax - Indicates the maximum number of returned missions. + * @returns { Promise> } Returns the array of the MissionInfo. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @since 9 + */ + function getMissionInfos(deviceId: string, numMax: number): Promise>; + + /** + * Get the mission snapshot with the given missionId. + * @param { string } deviceId - Indicates the device to be queried. + * @param { number } missionId - Indicates mission id to be queried. + * @param { AsyncCallback } callback - The callback is used to return the MissionSnapshot of the given id. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @since 9 + */ + function getMissionSnapShot(deviceId: string, missionId: number, callback: AsyncCallback): void; + + /** + * Get the mission snapshot with the given missionId. + * @param { string } deviceId - Indicates the device to be queried. + * @param { number } missionId - Indicates mission id to be queried. + * @returns { Promise } Returns the MissionSnapshot of the given id. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @since 9 + */ + function getMissionSnapShot(deviceId: string, missionId: number): Promise; + + /** + * Get the mission low resolution snapshot with the given missionId. + * @param { string } deviceId - Indicates the device to be queried. + * @param { number } missionId - Indicates mission id to be queried. + * @param { AsyncCallback } callback - The callback is used to return the MissionSnapshot of the given id. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @since 9 + */ + function getLowResolutionMissionSnapShot(deviceId: string, missionId: number, callback: AsyncCallback): void; + + /** + * Get the mission low resolution snapshot with the given missionId. + * @param { string } deviceId - Indicates the device to be queried. + * @param { number } missionId - Indicates mission id to be queried. + * @returns { Promise } Returns the MissionSnapshot of the given id. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @since 9 + */ + function getLowResolutionMissionSnapShot(deviceId: string, missionId: number): Promise; + + /** + * Lock the mission. + * @param { number } missionId - Indicates mission id to be locked. + * @param { AsyncCallback } callback - The callback of lockMission. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @since 9 + */ + function lockMission(missionId: number, callback: AsyncCallback): void; + + /** + * Lock the mission. + * @param { number } missionId - Indicates mission id to be locked. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @since 9 + */ + function lockMission(missionId: number): Promise; + + /** + * Unlock the mission. + * @param { number } missionId - Indicates mission id to be unlocked. + * @param { AsyncCallback } callback - The callback of unlockMission. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @since 9 + */ + function unlockMission(missionId: number, callback: AsyncCallback): void; + + /** + * Unlock the mission. + * @param { number } missionId - Indicates mission id to be unlocked. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @since 9 + */ + function unlockMission(missionId: number): Promise; + + /** + * Clear the given mission in the ability manager service. + * @param { number } missionId - Indicates mission id to be cleared. + * @param { AsyncCallback } callback - The callback of clearMission. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @since 9 + */ + function clearMission(missionId: number, callback: AsyncCallback): void; + + /** + * Clear the given mission in the ability manager service. + * @param { number } missionId - Indicates mission id to be cleared. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @since 9 + */ + function clearMission(missionId: number): Promise; + + /** + * Clear all missions in the ability manager service. + * @param { AsyncCallback } callback - The callback of clearAllMissions. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @since 9 + */ + function clearAllMissions(callback: AsyncCallback): void; + + /** + * Clear all missions in the ability manager service. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @since 9 + */ + function clearAllMissions(): Promise; + + /** + * Schedule the given mission to foreground. + * @param { number } missionId - Indicates mission id to be moved to foreground. + * @param { AsyncCallback } callback - The callback of moveMissionToFront. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @since 9 + */ + function moveMissionToFront(missionId: number, callback: AsyncCallback): void; + + /** + * Schedule the given mission to foreground. + * @param { number } missionId - Indicates mission id to be moved to foreground. + * @param { StartOptions } options - Indicates the start options. + * @param { AsyncCallback } callback - The callback of moveMissionToFront. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @since 9 + */ + function moveMissionToFront(missionId: number, options: StartOptions, callback: AsyncCallback): void; + + /** + * Schedule the given mission to foreground. + * @param { number } missionId - Indicates mission id to be moved to foreground. + * @param { StartOptions } options - Indicates the start options. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @since 9 + */ + function moveMissionToFront(missionId: number, options?: StartOptions): Promise; + + /** + * Mission information corresponding to ability. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @systemapi + * @since 9 + */ + export type MissionInfo = _MissionInfo + + /** + * MissionListener registered by app. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @systemapi + * @since 9 + */ + export type MissionListener = _MissionListener + + /** + * Mission snapshot corresponding to mission. + * @syscap SystemCapability.Ability.AbilityRuntime.Mission + * @systemapi + * @since 9 + */ + export type MissionSnapshot = _MissionSnapshot +} + +export default missionManager; \ No newline at end of file diff --git a/api/@ohos.application.quickFixManager.d.ts b/api/@ohos.app.ability.quickFixManager.d.ts similarity index 58% rename from api/@ohos.application.quickFixManager.d.ts rename to api/@ohos.app.ability.quickFixManager.d.ts index d30e16fe0359d8994441e76fc13321cff46eaf58..89cf51bc871e11911812bfe0513f681c01cf14f4 100644 --- a/api/@ohos.application.quickFixManager.d.ts +++ b/api/@ohos.app.ability.quickFixManager.d.ts @@ -17,137 +17,160 @@ import { AsyncCallback } from "./basic"; /** * Interface of quickFixManager. - * - * @name quickFixManager - * @since 9 + * @namespace quickFixManager * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @systemapi Hide this for inner system use. + * @systemapi + * @since 9 */ declare namespace quickFixManager { /** * Quick fix info of hap module. - * - * @since 9 + * @typedef HapModuleQuickFixInfo * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @systemapi Hide this for inner system use. + * @systemapi + * @since 9 */ export interface HapModuleQuickFixInfo { /** * Indicates hap module name. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @systemapi Hide this for inner system use. + * @systemapi + * @since 9 */ readonly moduleName: string; /** * Indicates hash value of a hap. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @systemapi Hide this for inner system use. + * @systemapi + * @since 9 */ readonly originHapHash: string; /** * Indicates installed path of quick fix file. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @systemapi Hide this for inner system use. + * @systemapi + * @since 9 */ readonly quickFixFilePath: string; } /** * Quick fix info of application. - * - * @since 9 + * @typedef ApplicationQuickFixInfo * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @systemapi Hide this for inner system use. + * @systemapi + * @since 9 */ export interface ApplicationQuickFixInfo { /** * Bundle name. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @systemapi Hide this for inner system use. + * @systemapi + * @since 9 */ readonly bundleName: string; /** * The version number of the bundle. - * - * @since 9 + * @type { number } * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @systemapi Hide this for inner system use. + * @systemapi + * @since 9 */ readonly bundleVersionCode: number; /** * The version name of the bundle. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @systemapi Hide this for inner system use. + * @systemapi + * @since 9 */ readonly bundleVersionName: string; /** * The version number of the quick fix. - * - * @since 9 + * @type { number } * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @systemapi Hide this for inner system use. + * @systemapi + * @since 9 */ readonly quickFixVersionCode: number; /** * The version name of the quick fix. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @systemapi Hide this for inner system use. + * @systemapi + * @since 9 */ readonly quickFixVersionName: string; /** * Hap module quick fix info. - * - * @since 9 + * @type { Array } * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @systemapi Hide this for inner system use. + * @systemapi + * @since 9 */ readonly hapModuleQuickFixInfo: Array; } /** * Apply quick fix files. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @param hapModuleQuickFixFiles Quick fix files need to apply, this value should include file path and file name. - * @systemapi Hide this for inner system use. - * @return - * @permission ohos.permission.INSTALL_BUNDLE + * @param { Array } hapModuleQuickFixFiles - Quick fix files need to apply, this value should include file + * path and file name. + * @param { AsyncCallback } callback - The callback of applyQuickFix. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix + * @systemapi + * @since 9 */ function applyQuickFix(hapModuleQuickFixFiles: Array, callback: AsyncCallback): void; + + /** + * Apply quick fix files. + * @permission ohos.permission.INSTALL_BUNDLE + * @param { Array } hapModuleQuickFixFiles - Quick fix files need to apply, this value should include file + * path and file name. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix + * @systemapi + * @since 9 + */ function applyQuickFix(hapModuleQuickFixFiles: Array): Promise; /** * Get application quick fix info by bundle name. - * - * @since 9 + * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { string } bundleName - Bundle name wish to query. + * @param { AsyncCallback } callback - The callback is used to return the ApplicationQuickFixInfo. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix - * @param bundleName Bundle name wish to query. - * @systemapi Hide this for inner system use. - * @return Returns the {@link ApplicationQuickFixInfo}. + * @systemapi + * @since 9 + */ + function getApplicationQuickFixInfo(bundleName: string, callback: AsyncCallback): void; + + /** + * Get application quick fix info by bundle name. * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + * @param { string } bundleName - Bundle name wish to query. + * @returns { Promise } Returns the ApplicationQuickFixInfo. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.QuickFix + * @systemapi + * @since 9 */ - function getApplicationQuickFixInfo(bundleName: string, callback: AsyncCallback): void; - function getApplicationQuickFixInfo(bundleName: string): Promise; + function getApplicationQuickFixInfo(bundleName: string): Promise; } export default quickFixManager; \ No newline at end of file diff --git a/api/@ohos.app.ability.wantAgent.d.ts b/api/@ohos.app.ability.wantAgent.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ace81f0b4464298d5876d152a614b66e5bda32da --- /dev/null +++ b/api/@ohos.app.ability.wantAgent.d.ts @@ -0,0 +1,350 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { AsyncCallback , Callback} from './basic'; +import Want from './@ohos.app.ability.Want'; +import { WantAgentInfo as _WantAgentInfo } from './wantAgent/wantAgentInfo'; +import { TriggerInfo as _TriggerInfo } from './wantAgent/triggerInfo'; + +/** + * Provide the method obtain trigger, cancel, and compare and to obtain + * the bundle name, UID of an {@link WantAgent} object. + * @namespace wantAgent + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ +declare namespace wantAgent { + /** + * Obtains the bundle name of a WantAgent. + * @param { WantAgent } agent - Indicates the WantAgent. + * @param { AsyncCallback } callback - The callback is used to return the bundle name. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function getBundleName(agent: WantAgent, callback: AsyncCallback): void; + + /** + * Obtains the bundle name of a WantAgent. + * @param { WantAgent } agent - Indicates the WantAgent. + * @returns { Promise } Returns the bundle name. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function getBundleName(agent: WantAgent): Promise; + + /** + * Obtains the UID of a WantAgent. + * @param { WantAgent } agent - Indicates the WantAgent. + * @param { AsyncCallback } callback - The callback is used to return the UID. + * @returns { Promise } Returns the UID. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function getUid(agent: WantAgent, callback: AsyncCallback): void; + function getUid(agent: WantAgent): Promise; + + /** + * Obtains the {@link Want} of an {@link WantAgent}. + * @param { WantAgent } agent - Indicates the WantAgent. + * @param { AsyncCallback } callback - The callback is used to return the Want. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + function getWant(agent: WantAgent, callback: AsyncCallback): void; + + /** + * Obtains the {@link Want} of an {@link WantAgent}. + * @param { WantAgent } agent - Indicates the WantAgent. + * @returns { Promise } Returns the Want. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @since 9 + */ + function getWant(agent: WantAgent): Promise; + + /** + * Cancels a WantAgent. Only the application that creates the WantAgent can cancel it. + * @param { WantAgent } agent - Indicates the WantAgent. + * @param { AsyncCallback } callback - The callback of cancel. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function cancel(agent: WantAgent, callback: AsyncCallback): void; + + /** + * Cancels a WantAgent. Only the application that creates the WantAgent can cancel it. + * @param { WantAgent } agent - Indicates the WantAgent. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function cancel(agent: WantAgent): Promise; + + /** + * Triggers a WantAgent. + * @param { WantAgent } agent - Indicates the WantAgent. + * @param { TriggerInfo } triggerInfo - Indicates the information required for triggering a WantAgent. + * @param { Callback } callback - The callback is used to return the CompleteData. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: Callback): void; + + /** + * Triggers a WantAgent. + * @param { WantAgent } agent - Indicates the WantAgent. + * @param { TriggerInfo } triggerInfo - Indicates the information required for triggering a WantAgent. + * @param { AsyncCallback } callback - The callback is used to return the CompleteData. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: AsyncCallback): void; + + /** + * Checks whether two WantAgent objects are equal. + * @param { WantAgent } agent - Indicates the WantAgent. + * @param { WantAgent } otherAgent - Indicates the other WantAgent. + * @param { AsyncCallback } callback - Returns true if the two WantAgents are the same. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function equal(agent: WantAgent, otherAgent: WantAgent, callback: AsyncCallback): void; + + /** + * Checks whether two WantAgent objects are equal. + * @param { WantAgent } agent - Indicates the WantAgent. + * @param { WantAgent } otherAgent - Indicates the other WantAgent. + * @returns { Promise } Returns true if the two WantAgents are the same. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function equal(agent: WantAgent, otherAgent: WantAgent): Promise; + + /** + * Obtains a WantAgent object. + * @param { WantAgentInfo } info - Information about the WantAgent object to obtain. + * @param { AsyncCallback } callback - The callback is used to return the created WantAgent. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function getWantAgent(info: WantAgentInfo, callback: AsyncCallback): void; + + /** + * Obtains a WantAgent object. + * @param { WantAgentInfo } info - Information about the WantAgent object to obtain. + * @returns { Promise } Returns the created WantAgent. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function getWantAgent(info: WantAgentInfo): Promise; + + /** + * Obtains the {@link OperationType} of a {@link WantAgent}. + * @param { WantAgent } agent - Indicates the WantAgent. + * @param { AsyncCallback } callback - The callback is used to return the OperationType of the WantAgent. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function getOperationType(agent: WantAgent, callback: AsyncCallback): void; + + /** + * Obtains the {@link OperationType} of a {@link WantAgent}. + * @param { WantAgent } agent - Indicates the WantAgent. + * @returns { Promise } Returns the OperationType of the WantAgent. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + function getOperationType(agent: WantAgent): Promise; + + /** + * Enumerates flags for using a WantAgent. + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + export enum WantAgentFlags { + /** + * Indicates that the WantAgent can be used only once. + * This flag is valid only when OperationType is set to START_ABILITY, START_SERVICE, or SEND_COMMON_EVENT. + */ + ONE_TIME_FLAG = 0, + + /** + * Indicates that null is returned if the WantAgent does not exist. + * This flag is valid only when OperationType is set to START_ABILITY, START_SERVICE, or SEND_COMMON_EVENT. + */ + NO_BUILD_FLAG, + + /** + * Indicates that the existing WantAgent should be canceled before a new object is generated. + * This flag is valid only when OperationType is set to START_ABILITY, START_SERVICE, or SEND_COMMON_EVENT. + */ + CANCEL_PRESENT_FLAG, + + /** + * Indicates that the system only replaces the extra data of the existing WantAgent with that of the new object. + * This flag is valid only when OperationType is set to START_ABILITY, START_SERVICE, or SEND_COMMON_EVENT. + */ + UPDATE_PRESENT_FLAG, + + /** + * Indicates that the created WantAgent should be immutable. + */ + CONSTANT_FLAG, + + /** + * Indicates that the current value of element can be replaced when the WantAgent is triggered. + */ + REPLACE_ELEMENT, + + /** + * Indicates that the current value of action can be replaced when the WantAgent is triggered. + */ + REPLACE_ACTION, + + /** + * Indicates that the current value of uri can be replaced when the WantAgent is triggered. + */ + REPLACE_URI, + + /** + * Indicates that the current value of entities can be replaced when the WantAgent is triggered. + */ + REPLACE_ENTITIES, + + /** + * Indicates that the current value of packageName can be replaced when the WantAgent is triggered. + */ + REPLACE_BUNDLE + } + + /** + * Identifies the operation for using a WantAgent, such as starting an ability or sending a common event. + * @enum { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + export enum OperationType { + /** + * Unknown operation. + */ + UNKNOWN_TYPE = 0, + + /** + * Starts an ability with a UI. + */ + START_ABILITY, + + /** + * Starts multiple abilities with a UI. + */ + START_ABILITIES, + + /** + * Starts an ability without a UI. + */ + START_SERVICE, + + /** + * Sends a common event. + */ + SEND_COMMON_EVENT + } + + /** + * Describes the data returned by after wantAgent.trigger is called. + * @typedef CompleteData + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + export interface CompleteData { + /** + * Triggered WantAgent. + * @type { WantAgent } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + info: WantAgent; + + /** + * Existing Want that is triggered. + * @type { Want } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + want: Want; + + /** + * Request code used to trigger the WantAgent. + * @type { number } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + finalCode: number; + + /** + * Final data collected by the common event. + * @type { string } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + finalData: string; + + /** + * Extra data collected by the common event. + * @type { { [key: string]: any } } + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + extraInfo?: { [key: string]: any }; + } + + /** + * Provides the information required for triggering a WantAgent. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + export type TriggerInfo = _TriggerInfo + + /** + * Provides the information required for triggering a WantAgent. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + export type WantAgentInfo = _WantAgentInfo +} + +/** + * WantAgent object. + */ +export type WantAgent = object; + +export default wantAgent; diff --git a/api/@ohos.app.ability.wantConstant.d.ts b/api/@ohos.app.ability.wantConstant.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..05e563cd9f72d0d1db14468f5ddcf6fe2ea0eaa5 --- /dev/null +++ b/api/@ohos.app.ability.wantConstant.d.ts @@ -0,0 +1,439 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * the constant for action and entity in the want + * @namespace wantConstant + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ +declare namespace wantConstant { + /** + * the constant for action of the want + * @enum { string } + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + export enum Action { + /** + * Indicates the action of backing home. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_HOME = "ohos.want.action.home", + + /** + * Indicates the action of starting a Page ability that displays a keypad. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_DIAL = "ohos.want.action.dial", + + /** + * Indicates the action of starting a Page ability for search. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_SEARCH = "ohos.want.action.search", + + /** + * Indicates the action of starting a Page ability that provides wireless network settings, for example, + * Wi-Fi options. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_WIRELESS_SETTINGS = "ohos.settings.wireless", + + /** + * Indicates the action of starting a Page ability that manages installed applications. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_MANAGE_APPLICATIONS_SETTINGS = "ohos.settings.manage.applications", + + /** + * Indicates the action of starting a Page ability that displays details of a specified application. + * + *

You must specify the application bundle name in the {@code package} attribute of the {@code Intent} + * containing this action. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_APPLICATION_DETAILS_SETTINGS = "ohos.settings.application.details", + + /** + * Indicates the action of starting a Page ability for setting an alarm clock. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_SET_ALARM = "ohos.want.action.setAlarm", + + /** + * Indicates the action of starting a Page ability that displays all alarm + * clocks. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_SHOW_ALARMS = "ohos.want.action.showAlarms", + + /** + * Indicates the action of starting a Page ability for snoozing an alarm clock. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_SNOOZE_ALARM = "ohos.want.action.snoozeAlarm", + + /** + * Indicates the action of starting a Page ability for deleting an alarm clock. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_DISMISS_ALARM = "ohos.want.action.dismissAlarm", + + /** + * Indicates the action of starting a Page ability for dismissing a timer. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_DISMISS_TIMER = "ohos.want.action.dismissTimer", + + /** + * Indicates the action of starting a Page ability for sending a sms. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_SEND_SMS = "ohos.want.action.sendSms", + + /** + * Indicates the action of starting a Page ability for opening contacts or pictures. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_CHOOSE = "ohos.want.action.choose", + + /** + * Indicates the action of starting a Page ability for take a picture. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_IMAGE_CAPTURE = "ohos.want.action.imageCapture", + + /** + * Indicates the action of starting a Page ability for Take a video. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_VIDEO_CAPTURE = "ohos.want.action.videoCapture", + + /** + * Indicates the action of showing the application selection dialog box. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_SELECT = "ohos.want.action.select", + + /** + * Indicates the action of sending a single data record. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_SEND_DATA = "ohos.want.action.sendData", + + /** + * Indicates the action of sending multiple data records. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_SEND_MULTIPLE_DATA = "ohos.want.action.sendMultipleData", + + /** + * Indicates the action of requesting the media scanner to scan files and adding the files to the media library. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_SCAN_MEDIA_FILE = "ohos.want.action.scanMediaFile", + + /** + * Indicates the action of viewing data. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_VIEW_DATA = "ohos.want.action.viewData", + + /** + * Indicates the action of editing data. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_EDIT_DATA = "ohos.want.action.editData", + + /** + * Indicates the choices you will show with {@link #ACTION_PICKER}. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + INTENT_PARAMS_INTENT = "ability.want.params.INTENT", + + /** + * Indicates the CharSequence dialog title when used with a {@link #ACTION_PICKER}. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + INTENT_PARAMS_TITLE = "ability.want.params.TITLE", + + /** + * Indicates the action of select file. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_FILE_SELECT = "ohos.action.fileSelect", + + /** + * Indicates the URI holding a stream of data associated with the Intent when used with a {@link #ACTION_SEND_DATA}. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + PARAMS_STREAM = "ability.params.stream", + + /** + * Indicates the action of providing auth service. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ACTION_APP_ACCOUNT_AUTH = "account.appAccount.action.auth", + + /** + * Indicates the action of an application downloaded from the application market. + * @syscap SystemCapability.Ability.AbilityBase + * @systemapi + * @since 9 + */ + ACTION_MARKET_DOWNLOAD = "ohos.want.action.marketDownload", + + /** + * Indicates the action of an application crowdtested from the application market. + * @syscap SystemCapability.Ability.AbilityBase + * @systemapi + * @since 9 + */ + ACTION_MARKET_CROWDTEST = "ohos.want.action.marketCrowdTest", + + /** + * Indicates the param of sandbox flag. + * @syscap SystemCapability.Ability.AbilityBase + * @systemapi + * @since 9 + */ + DLP_PARAMS_SANDBOX = "ohos.dlp.params.sandbox", + + /** + * Indicates the param of dlp bundle name. + * @syscap SystemCapability.Ability.AbilityBase + * @systemapi + * @since 9 + */ + DLP_PARAMS_BUNDLE_NAME = "ohos.dlp.params.bundleName", + + /** + * Indicates the param of dlp module name. + * @syscap SystemCapability.Ability.AbilityBase + * @systemapi + * @since 9 + */ + DLP_PARAMS_MODULE_NAME = "ohos.dlp.params.moduleName", + + /** + * Indicates the param of dlp ability name. + * @syscap SystemCapability.Ability.AbilityBase + * @systemapi + * @since 9 + */ + DLP_PARAMS_ABILITY_NAME = "ohos.dlp.params.abilityName", + + /** + * Indicates the param of dlp bundle index. + * @syscap SystemCapability.Ability.AbilityBase + * @systemapi + * @since 9 + */ + DLP_PARAMS_INDEX = "ohos.dlp.params.index" + } + + /** + * the constant for Entity of the want + * @enum { string } + * @name Entity + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + export enum Entity { + /** + * Indicates the default entity, which is used if the entity is not specified. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ENTITY_DEFAULT = "entity.system.default", + + /** + * Indicates the home screen entity. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ENTITY_HOME = "entity.system.home", + + /** + * Indicates the voice interaction entity. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ENTITY_VOICE = "entity.system.voice", + + /** + * Indicates the browser category. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ENTITY_BROWSABLE = "entity.system.browsable", + + /** + * Indicates the video category. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + ENTITY_VIDEO = "entity.system.video" + } + + export enum Flags { + /** + * Indicates the grant to perform read operations on the URI. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + FLAG_AUTH_READ_URI_PERMISSION = 0x00000001, + + /** + * Indicates the grant to perform write operations on the URI. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + FLAG_AUTH_WRITE_URI_PERMISSION = 0x00000002, + + /** + * Returns the result to the source ability. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + FLAG_ABILITY_FORWARD_RESULT = 0x00000004, + + /** + * Determines whether an ability on the local device can be migrated to a remote device. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + FLAG_ABILITY_CONTINUATION = 0x00000008, + + /** + * Specifies whether a component does not belong to OHOS. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + FLAG_NOT_OHOS_COMPONENT = 0x00000010, + + /** + * Specifies whether an ability is started. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + FLAG_ABILITY_FORM_ENABLED = 0x00000020, + + /** + * Indicates the grant for possible persisting on the URI. + * @syscap SystemCapability.Ability.AbilityBase + * @systemapi + * @since 9 + */ + FLAG_AUTH_PERSISTABLE_URI_PERMISSION = 0x00000040, + + /** + * Returns the result to the source ability slice. + * @syscap SystemCapability.Ability.AbilityBase + * @systemapi + * @since 9 + */ + FLAG_AUTH_PREFIX_URI_PERMISSION = 0x00000080, + + /** + * Supports multi-device startup in the distributed scheduling system. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + FLAG_ABILITYSLICE_MULTI_DEVICE = 0x00000100, + + /** + * Indicates that an ability using the Service template is started regardless of whether the host application has + * been started. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + FLAG_START_FOREGROUND_ABILITY = 0x00000200, + + /** + * Indicates the continuation is reversible. + * @syscap SystemCapability.Ability.AbilityBase + * @systemapi + * @since 9 + */ + FLAG_ABILITY_CONTINUATION_REVERSIBLE = 0x00000400, + + /** + * Install the specified ability if it's not installed. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + FLAG_INSTALL_ON_DEMAND = 0x00000800, + + /** + * Install the specifiedi ability with background mode if it's not installed. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + FLAG_INSTALL_WITH_BACKGROUND_MODE = 0x80000000, + + /** + * Indicates the operation of clearing other missions. This flag can be set for the {@code Intent} passed to + * {@link ohos.app.Context#startAbility} and must be used together with {@link FLAG_ABILITY_NEW_MISSION}. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + FLAG_ABILITY_CLEAR_MISSION = 0x00008000, + + /** + * Indicates the operation of creating a task on the historical mission stack. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + FLAG_ABILITY_NEW_MISSION = 0x10000000, + + /** + * Indicates that the existing instance of the ability to start will be reused if it is already at the top of + * the mission stack. Otherwise, a new ability instance will be created. + * @syscap SystemCapability.Ability.AbilityBase + * @since 9 + */ + FLAG_ABILITY_MISSION_TOP = 0x20000000 + } +} + +export default wantConstant; diff --git a/api/@ohos.app.form.FormExtensionAbility.d.ts b/api/@ohos.app.form.FormExtensionAbility.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..aeed2002d1196653393922c27658130ee075a84c --- /dev/null +++ b/api/@ohos.app.form.FormExtensionAbility.d.ts @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import formBindingData from './@ohos.app.form.formBindingData'; +import formInfo from "./@ohos.app.form.formInfo"; +import FormExtensionContext from "./application/FormExtensionContext"; +import Want from './@ohos.app.ability.Want'; +import { Configuration } from './@ohos.app.ability.Configuration'; + +/** + * class of form extension. + * @syscap SystemCapability.Ability.Form + * @stagemodelonly + * @since 9 + */ +export default class FormExtensionAbility { + /** + * Indicates form extension context. + * @type { FormExtensionContext } + * @syscap SystemCapability.Ability.Form + * @stagemodelonly + * @since 9 + */ + context: FormExtensionContext; + + /** + * Called to return a {@link formBindingData#FormBindingData} object. + * @param { Want } want - Indicates the detailed information for creating a {@link formBindingData#FormBindingData}. + * The {@code Want} object must include the form ID, form name, and grid style of the form. + * Such form information must be managed as persistent data for further form + * acquisition, update, and deletion. + * @return { formBindingData.FormBindingData } Returns the created {@link formBindingData#FormBindingData} object. + * @syscap SystemCapability.Ability.Form + * @stagemodelonly + * @since 9 + */ + onAddForm(want: Want): formBindingData.FormBindingData; + + /** + * Called when the form provider is notified that a temporary form is successfully converted to a normal form. + * @param { string } formId - Indicates the ID of the form. + * @syscap SystemCapability.Ability.Form + * @stagemodelonly + * @since 9 + */ + onCastToNormalForm(formId: string): void; + + /** + * Called to notify the form provider to update a specified form. + * @param { string } formId - Indicates the ID of the form to update. + * @syscap SystemCapability.Ability.Form + * @stagemodelonly + * @since 9 + */ + onUpdateForm(formId: string): void; + + /** + * Called when the form provider receives form events from the system. + * @param { { [key: string]: number } } newStatus - Indicates the form events occurred. The key in the {@code Map} + * object indicates the form ID, and the value indicates the event type, which can be either + * {@link formInfo#VisibilityType#FORM_VISIBLE} or {@link formInfo#VisibilityType#FORM_INVISIBLE}. + * {@link formInfo#VisibilityType#FORM_VISIBLE} means that the form becomes visible, and + * {@link formInfo#VisibilityType#FORM_INVISIBLE} means that the form becomes invisible. + * @syscap SystemCapability.Ability.Form + * @stagemodelonly + * @since 9 + */ + onChangeFormVisibility(newStatus: { [key: string]: number }): void; + + /** + * Called when a specified message event defined by the form provider is triggered. This method is valid only for + * JS forms. + * @param { string } formId - Indicates the ID of the form on which the message event is triggered, which is + * provided by the client to the form provider. + * @param { string } message - Indicates the value of the {@code params} field of the message event. This parameter + * is used to identify the specific component on which the event is triggered. + * @syscap SystemCapability.Ability.Form + * @stagemodelonly + * @since 9 + */ + onFormEvent(formId: string, message: string): void; + + /** + * Called to notify the form provider that a specified form has been destroyed. Override this method if + * you want your application, as the form provider, to be notified of form deletion. + * @param { string } formId - Indicates the ID of the destroyed form. + * @syscap SystemCapability.Ability.Form + * @stagemodelonly + * @since 9 + */ + onRemoveForm(formId: string): void; + + /** + * Called when the system configuration is updated. + * @param { Configuration } newConfig - Indicates the system configuration, such as language and color mode. + * @syscap SystemCapability.Ability.Form + * @stagemodelonly + * @since 9 + */ + onConfigurationUpdate(newConfig: Configuration): void; + + /** + * Called to return a {@link FormState} object. + *

You must override this callback if you want this ability to return the actual form state. Otherwise, + * this method returns {@link FormState#DEFAULT} by default.

+ * @param { Want } want - Indicates the description of the form for which the {@link formInfo#FormState} + * is obtained. The description covers the bundle name, ability name, module name, + * form name, and form dimensions. + * @return { formInfo.FormState } Returns the {@link formInfo#FormState} object. + * @syscap SystemCapability.Ability.Form + * @stagemodelonly + * @since 9 + */ + onAcquireFormState?(want: Want): formInfo.FormState; + + /** + * Called when the system shares the form. + * @param { string } formId - Indicates the ID of the form. + * @return { { [key: string]: any } } Returns the wantParams object. + * @syscap SystemCapability.Ability.Form + * @systemapi + * @stagemodelonly + * @since 9 + */ + onShareForm?(formId: string): { [key: string]: any }; +} diff --git a/api/@ohos.app.form.formHost.d.ts b/api/@ohos.app.form.formHost.d.ts index 4e066920eb4431adadb9b56d4489e516ec58bee8..96d204f779240bf6004b80f7a28d00bab714a0ec 100644 --- a/api/@ohos.app.form.formHost.d.ts +++ b/api/@ohos.app.form.formHost.d.ts @@ -15,8 +15,8 @@ import { AsyncCallback } from "./basic"; import { Callback } from "./basic"; -import Want from './@ohos.application.Want'; -import formInfo from './@ohos.application.formInfo' +import Want from './@ohos.app.ability.Want'; +import formInfo from './@ohos.app.form.formInfo'; /** * Interface of formHost. @@ -137,13 +137,13 @@ declare namespace formHost { * Converts a specified temporary form that has been obtained by the application into a normal form. * @permission ohos.permission.REQUIRE_FORM * @param { string } formId - Indicates the ID of the temporary form to convert. - * @param { AsyncCallback } callback - The callback of castTempForm. + * @param { AsyncCallback } callback - The callback of castToNormalForm. * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.Form * @systemapi * @since 9 */ - function castTempForm(formId: string, callback: AsyncCallback): void; + function castToNormalForm(formId: string, callback: AsyncCallback): void; /** * Converts a specified temporary form that has been obtained by the application into a normal form. @@ -155,7 +155,7 @@ declare namespace formHost { * @systemapi * @since 9 */ - function castTempForm(formId: string): Promise; + function castToNormalForm(formId: string): Promise; /** * Sends a notification to the form framework to make the specified forms visible. @@ -490,13 +490,50 @@ declare namespace formHost { * @param { string } formId - Indicates the form ID. * @param { string } deviceId - Indicates the remote device ID. * @param { AsyncCallback } callback - The callback of shareForm. - * @returns { Promise } The promise returned by the function. * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.Form * @systemapi * @since 9 */ function shareForm(formId: string, deviceId: string, callback: AsyncCallback): void; + + /** + * Share form by formId and deviceId. + * @permission ohos.permission.REQUIRE_FORM and ohos.permission.DISTRIBUTED_DATASYNC + * @param { string } formId - Indicates the form ID. + * @param { string } deviceId - Indicates the remote device ID. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.Form + * @systemapi + * @since 9 + */ function shareForm(formId: string, deviceId: string): Promise; + + /** + * Notify form that privacy whether to be protected. + * @permission ohos.permission.REQUIRE_FORM. + * @param { Array } formIds - Indicates the specified form id. + * @param { boolean } isProtected - Indicates whether to be protected. + * @param { AsyncCallback } callback - The callback of notifyFormsPrivacyProtected. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.Form + * @systemapi + * @since 9 + */ + function notifyFormsPrivacyProtected(formIds: Array, isProtected: boolean, callback: AsyncCallback): void; + + /** + * Notify form that privacy whether to be protected. + * @permission ohos.permission.REQUIRE_FORM. + * @param { Array } formIds - Indicates the specified form id. + * @param { boolean } isProtected - Indicates whether to be protected. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.Form + * @systemapi + * @since 9 + */ + function notifyFormsPrivacyProtected(formIds: Array, isProtected: boolean): Promise; } export default formHost; \ No newline at end of file diff --git a/api/@ohos.app.form.formInfo.d.ts b/api/@ohos.app.form.formInfo.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ee5c9648fe488ae09d91eb01126bfbf147ab9ad0 --- /dev/null +++ b/api/@ohos.app.form.formInfo.d.ts @@ -0,0 +1,498 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Want from './@ohos.app.ability.Want'; + +/** + * interface of formInfo. + * @namespace formInfo + * @syscap SystemCapability.Ability.Form + * @since 9 + */ +declare namespace formInfo { + /** + * Provides information about a form. + * @typedef FormInfo + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + interface FormInfo { + /** + * Obtains the bundle name of the application to which this form belongs. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + bundleName: string; + + /** + * Obtains the name of the application module to which this form belongs. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + moduleName: string; + + /** + * Obtains the class name of the ability to which this form belongs. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + abilityName: string; + + /** + * Obtains the name of this form. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + name: string; + + /** + * Obtains the name of this form. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + description: string; + + /** + * Obtains the type of this form. Currently, JS forms are supported. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + type: FormType; + + /** + * Obtains the JS component name of this JS form. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + jsComponentName: string; + + /** + * Obtains the color mode of this form. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + colorMode: ColorMode; + + /** + * Checks whether this form is a default form. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + isDefault: boolean; + + /** + * Obtains the updateEnabled. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + updateEnabled: boolean; + + /** + * Obtains whether notify visible of this form. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + formVisibleNotify: boolean; + + /** + * Obtains the bundle relatedBundleName of the application to which this form belongs. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + relatedBundleName: string; + + /** + * Obtains the scheduledUpdateTime. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + scheduledUpdateTime: string; + + /** + * Obtains the form config ability about this form. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + formConfigAbility: string; + + /** + * Obtains the updateDuration. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + updateDuration: number; + + /** + * Obtains the default grid style of this form. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + defaultDimension: number; + + /** + * Obtains the grid styles supported by this form. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + supportDimensions: Array; + + /** + * Obtains the custom data defined in this form. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + customizeData: {[key: string]: [value: string]}; + } + + /** + * Type of form. + * @enum { number } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + enum FormType { + /** + * JS form. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + JS = 1, + + /** + * eTS form. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + eTS = 2 + } + + /** + * Color mode. + * @enum { number } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + enum ColorMode { + /** + * Automatic mode. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + MODE_AUTO = -1, + + /** + * Dark mode. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + MODE_DARK = 0, + + /** + * Light mode. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + MODE_LIGHT = 1 + } + + /** + * Provides state information about a form. + * @typedef FormStateInfo + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + interface FormStateInfo { + /** + * Obtains the form state. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + formState: FormState; + + /** + * Obtains the want form . + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + want: Want; + } + + /** + * Provides state about a form. + * @enum { number } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + enum FormState { + /** + * Indicates that the form status is unknown due to an internal error. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + UNKNOWN = -1, + + /** + * Indicates that the form is in the default state. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + DEFAULT = 0, + + /** + * Indicates that the form is ready. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + READY = 1, + } + + /** + * Parameter of form. + * @enum { string } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + enum FormParam { + /** + * Indicates the key specifying the ID of the form to be obtained, which is represented as + * want: { + * "parameters": { + * IDENTITY_KEY: 1L + * } + * }. + * + * @syscap SystemCapability.Ability.Form + * @systemapi + * @since 9 + */ + /** + * Indicates the key specifying the ID of the form to be obtained, which is represented as + * want: { + * "parameters": { + * IDENTITY_KEY: "119476135" + * } + * }. + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + IDENTITY_KEY = "ohos.extra.param.key.form_identity", + + /** + * Indicates the key specifying the grid style of the form to be obtained, which is represented as + * want: { + * "parameters": { + * DIMENSION_KEY: FormDimension.Dimension_1_2 + * } + * }. + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + DIMENSION_KEY = "ohos.extra.param.key.form_dimension", + + /** + * Indicates the key specifying the name of the form to be obtained, which is represented as + * want: { + * "parameters": { + * NAME_KEY: "formName" + * } + * }. + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + NAME_KEY = "ohos.extra.param.key.form_name", + + /** + * Indicates the key specifying the name of the module to which the form to be obtained belongs, which is + * represented as + * want: { + * "parameters": { + * MODULE_NAME_KEY: "formEntry" + * } + * } + * This constant is mandatory. + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + MODULE_NAME_KEY = "ohos.extra.param.key.module_name", + + /** + * Indicates the key specifying the width of the form to be obtained, which is represented as + * want: { + * "parameters": { + * WIDTH_KEY: 800 + * } + * } + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + WIDTH_KEY = "ohos.extra.param.key.form_width", + + /** + * Indicates the key specifying the height of the form to be obtained, which is represented as + * want: { + * "parameters": { + * HEIGHT_KEY: 400 + * } + * } + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + HEIGHT_KEY = "ohos.extra.param.key.form_height", + + /** + * Indicates the key specifying whether a form is temporary, which is represented as + * want: { + * "parameters": { + * TEMPORARY_KEY: true + * } + * } + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + TEMPORARY_KEY = "ohos.extra.param.key.form_temporary", + + /** + * Indicates the key specifying the name of the bundle to be obtained, which is represented as + * want: { + * "parameters": { + * BUNDLE_NAME_KEY: "bundleName" + * } + * } + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + BUNDLE_NAME_KEY = "ohos.extra.param.key.bundle_name", + + /** + * Indicates the key specifying the name of the ability to be obtained, which is represented as + * want: { + * "parameters": { + * ABILITY_NAME_KEY: "abilityName" + * } + * } + * + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + ABILITY_NAME_KEY = "ohos.extra.param.key.ability_name", + + /** + * Indicates the key specifying the the device ID, which is represented as + * want: { + * "parameters": { + * DEVICE_ID_KEY : "EFC11C0C53628D8CC2F8CB5052477E130D075917034613B9884C55CD22B3DEF2" + * } + * } + * + * @syscap SystemCapability.Ability.Form + * @systemapi + * @since 9 + */ + DEVICE_ID_KEY = "ohos.extra.param.key.device_id" + } + + /** + * The optional options used as filters to ask + * getFormsInfo to return formInfos from only forms that match the options. + * @typedef FormInfoFilter + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + interface FormInfoFilter { + /** + * optional moduleName that used to ask getFormsInfo to return + * form infos with the same moduleName. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + moduleName?: string; + } + + /** + * Defines the FormDimension enum. + * @enum { number } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + enum FormDimension { + /** + * 1 x 2 form + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + Dimension_1_2 = 1, + + /** + * 2 x 2 form + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + Dimension_2_2, + + /** + * 2 x 4 form + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + Dimension_2_4, + + /** + * 4 x 4 form + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + Dimension_4_4, + + /** + * 2 x 1 form + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + Dimension_2_1, + } + /** + * The visibility of a form. + * @enum { number } + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + enum VisibilityType { + /** + * Indicates the type of the form is visible. + * Often used as a condition variable in function OnVisibilityChange to specify actions only on forms that are + * changing to visible. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + FORM_VISIBLE = 1, + /** + * Indicates the type of the form is invisible. + * Often used as a condition variable in function OnVisibilityChange to specify actions only on forms that are + * changing to invisible. + * @syscap SystemCapability.Ability.Form + * @since 9 + */ + FORM_INVISIBLE, + } +} +export default formInfo; \ No newline at end of file diff --git a/api/@ohos.app.form.formProvider.d.ts b/api/@ohos.app.form.formProvider.d.ts index f2a87e039e76e711005d86f00afb4dffcad483b8..31b048c78337ba2b85652aae4e58552c11f906eb 100644 --- a/api/@ohos.app.form.formProvider.d.ts +++ b/api/@ohos.app.form.formProvider.d.ts @@ -15,8 +15,8 @@ import { AsyncCallback } from "./basic"; import formBindingData from "./@ohos.app.form.formBindingData"; -import formInfo from "./@ohos.application.formInfo"; -import Want from "./@ohos.application.Want" +import formInfo from "./@ohos.app.form.formInfo"; +import Want from "./@ohos.app.ability.Want"; /** * Interface of formProvider. diff --git a/api/@ohos.application.Ability.d.ts b/api/@ohos.application.Ability.d.ts index 99cfd355610983da6d601b990f88caef60734b66..f0c54d72a5f5a4d8a074e09ea29af0bcfba1df28 100755 --- a/api/@ohos.application.Ability.d.ts +++ b/api/@ohos.application.Ability.d.ts @@ -29,6 +29,8 @@ import rpc from './@ohos.rpc'; * @param msg Monitor status notification information. * @return - * @StageModelOnly + * @deprecated since 9 + * @useinstead ohos.app.ability.Ability */ export interface OnReleaseCallBack { (msg: string): void; @@ -43,6 +45,8 @@ export interface OnReleaseCallBack { * @param indata Notification data notified from the caller. * @return rpc.Sequenceable * @StageModelOnly + * @deprecated since 9 + * @useinstead ohos.app.ability.Ability */ export interface CalleeCallBack { (indata: rpc.MessageParcel): rpc.Sequenceable; @@ -55,6 +59,8 @@ export interface CalleeCallBack { * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore * @permission N/A * @StageModelOnly + * @deprecated since 9 + * @useinstead ohos.app.ability.Ability */ export interface Caller { /** @@ -110,6 +116,8 @@ export interface Caller { * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore * @permission N/A * @StageModelOnly + * @deprecated since 9 + * @useinstead ohos.app.ability.Ability */ export interface Callee { @@ -144,6 +152,8 @@ export interface Callee { * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore * @permission N/A * @StageModelOnly + * @deprecated since 9 + * @useinstead ohos.app.ability.Ability */ export default class Ability { /** diff --git a/api/@ohos.application.AbilityConstant.d.ts b/api/@ohos.application.AbilityConstant.d.ts index 2847a26649da5ad1cd18755a44126c049512fb47..1ee74d5e785201fc8a4667237d57f41668e4f1d2 100644 --- a/api/@ohos.application.AbilityConstant.d.ts +++ b/api/@ohos.application.AbilityConstant.d.ts @@ -20,6 +20,8 @@ * @syscap SystemCapability.Ability.AbilityRuntime.Core * @permission N/A * @StageModelOnly + * @deprecated since 9 + * @useinstead ohos.app.ability.AbilityConstant */ declare namespace AbilityConstant { /** diff --git a/api/@ohos.application.AbilityLifecycleCallback.d.ts b/api/@ohos.application.AbilityLifecycleCallback.d.ts index 33db234da5362cd83e943d739ec29e5eb86d02dd..4e1f22ac9c3d3528091f2325a41d6da4514045c1 100644 --- a/api/@ohos.application.AbilityLifecycleCallback.d.ts +++ b/api/@ohos.application.AbilityLifecycleCallback.d.ts @@ -23,6 +23,8 @@ import window from './@ohos.window'; * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core * @permission N/A + * @deprecated since 9 + * @useinstead ohos.app.ability.AbilityLifecycleCallback */ export default class AbilityLifecycleCallback { /** diff --git a/api/@ohos.application.AbilityStage.d.ts b/api/@ohos.application.AbilityStage.d.ts index a0369329ced0b6fd370c0dba7f70721357ac2e33..8d7b4cc1c8180a13903434f6e8719310a01d654e 100644 --- a/api/@ohos.application.AbilityStage.d.ts +++ b/api/@ohos.application.AbilityStage.d.ts @@ -25,6 +25,8 @@ import { Configuration } from './@ohos.application.Configuration'; * @syscap SystemCapability.Ability.AbilityRuntime.Core * @permission N/A * @StageModelOnly + * @deprecated since 9 + * @useinstead ohos.app.ability.AbilityStage */ export default class AbilityStage { /** diff --git a/api/@ohos.application.Configuration.d.ts b/api/@ohos.application.Configuration.d.ts index b1c3861169ad7dcd36bd1e5e1940b4cfc8228cb6..2d339a39400374a1178cb4e08795ad856cd794c6 100644 --- a/api/@ohos.application.Configuration.d.ts +++ b/api/@ohos.application.Configuration.d.ts @@ -22,6 +22,8 @@ import ConfigurationConstant from "./@ohos.application.ConfigurationConstant"; * @since 8 * @syscap SystemCapability.Ability.AbilityBase * @permission N/A + * @deprecated since 9 + * @useinstead ohos.app.ability.Configuration */ export interface Configuration { /** diff --git a/api/@ohos.application.ConfigurationConstant.d.ts b/api/@ohos.application.ConfigurationConstant.d.ts index cdf3b32724869aa6705e85d53a58b7dddbff196f..7e3853aa5d8abc9dd362264bc2c0843a7eb48e20 100644 --- a/api/@ohos.application.ConfigurationConstant.d.ts +++ b/api/@ohos.application.ConfigurationConstant.d.ts @@ -19,6 +19,8 @@ * @since 8 * @syscap SystemCapability.Ability.AbilityBase * @permission N/A + * @deprecated since 9 + * @useinstead ohos.app.ability.ConfigurationConstant */ declare namespace ConfigurationConstant { /** diff --git a/api/@ohos.application.EnvironmentCallback.d.ts b/api/@ohos.application.EnvironmentCallback.d.ts index b19bd5792eff52fc21ea06e0d6501cf543ba9f7c..55f6504a703c7fb597ea521be36d6df177ab16d4 100755 --- a/api/@ohos.application.EnvironmentCallback.d.ts +++ b/api/@ohos.application.EnvironmentCallback.d.ts @@ -21,6 +21,8 @@ import { Configuration } from './@ohos.application.Configuration'; * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core * @permission N/A + * @deprecated since 9 + * @useinstead ohos.app.ability.EnvironmentCallback */ export default class EnvironmentCallback { /** diff --git a/api/@ohos.application.ExtensionAbility.d.ts b/api/@ohos.application.ExtensionAbility.d.ts index 3cfd0d921354adae992e94462b2adb463e8b5dc4..eda81a8ac3c5ace16928b4a04e0072336177b684 100644 --- a/api/@ohos.application.ExtensionAbility.d.ts +++ b/api/@ohos.application.ExtensionAbility.d.ts @@ -22,6 +22,8 @@ import { Configuration } from './@ohos.application.Configuration'; * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core * @StageModelOnly + * @deprecated since 9 + * @useinstead ohos.app.ability.ExtensionAbility */ export default class ExtensionAbility { /** diff --git a/api/@ohos.application.FormExtension.d.ts b/api/@ohos.application.FormExtension.d.ts index 4c52a8387e5b8fe5d5cde711b3f72c6d13f698cf..e3bbfc7fdc0aaba3789c923bb11e05214329e07e 100644 --- a/api/@ohos.application.FormExtension.d.ts +++ b/api/@ohos.application.FormExtension.d.ts @@ -25,6 +25,8 @@ import { Configuration } from './@ohos.application.Configuration'; * @since 9 * @syscap SystemCapability.Ability.Form * @StageModelOnly + * @deprecated since 9 + * @useinstead ohos.app.form.FormExtensionAbility */ export default class FormExtension { /** diff --git a/api/@ohos.application.ServiceExtensionAbility.d.ts b/api/@ohos.application.ServiceExtensionAbility.d.ts index 9b7e74eb470afa71b6dad5910c8255d029a9c3a1..5b850b90f6fde5f4dd8e9c491e93e6e1161d96a7 100644 --- a/api/@ohos.application.ServiceExtensionAbility.d.ts +++ b/api/@ohos.application.ServiceExtensionAbility.d.ts @@ -25,6 +25,8 @@ import { Configuration } from './@ohos.application.Configuration'; * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi hide for inner use. * @StageModelOnly + * @deprecated since 9 + * @useinstead ohos.app.ability.ServiceExtensionAbility */ export default class ServiceExtensionAbility { /** diff --git a/api/@ohos.application.StartOptions.d.ts b/api/@ohos.application.StartOptions.d.ts index b4cd41bbceab5748d8c933e5331f968ec393817e..0fc112e6d91d9097b515f98c4d9ebb8e760bfc79 100644 --- a/api/@ohos.application.StartOptions.d.ts +++ b/api/@ohos.application.StartOptions.d.ts @@ -21,6 +21,8 @@ * @syscap SystemCapability.Ability.AbilityRuntime.Core * @permission N/A * @StageModelOnly + * @deprecated since 9 + * @useinstead ohos.app.ability.StartOptions */ export default class StartOptions { /** diff --git a/api/@ohos.application.Want.d.ts b/api/@ohos.application.Want.d.ts index 1a54ebefd9e6dd0cff0c86d9681044c0147318b1..b417aba928315badd9a3438d4c36c03f10c962e8 100644 --- a/api/@ohos.application.Want.d.ts +++ b/api/@ohos.application.Want.d.ts @@ -20,6 +20,8 @@ * @since 8 * @syscap SystemCapability.Ability.AbilityBase * @permission N/A + * @deprecated since 9 + * @useinstead ohos.app.ability.Want */ export default class Want { /** diff --git a/api/@ohos.application.abilityDelegatorRegistry.d.ts b/api/@ohos.application.abilityDelegatorRegistry.d.ts index ad936320c56840c0517b6d5d55d041aab539644d..d8d7a51a5b03418ae8a3542a5ea6d937bec1d50e 100644 --- a/api/@ohos.application.abilityDelegatorRegistry.d.ts +++ b/api/@ohos.application.abilityDelegatorRegistry.d.ts @@ -26,6 +26,8 @@ import { ShellCmdResult as _ShellCmdResult } from './application/shellCmdResult' * @syscap SystemCapability.Ability.AbilityRuntime.Core * @import import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' * @permission N/A + * @deprecated since 9 + * @useinstead ohos.app.ability.abilityDelegatorRegistry */ declare namespace abilityDelegatorRegistry { /** diff --git a/api/@ohos.application.abilityManager.d.ts b/api/@ohos.application.abilityManager.d.ts index a35eebd58311a8ce2ebcd8102ae9b4c09abf6649..dfa26ab42bde00f254c423fa7173ae4d5699ab03 100644 --- a/api/@ohos.application.abilityManager.d.ts +++ b/api/@ohos.application.abilityManager.d.ts @@ -26,6 +26,8 @@ import { ElementName } from './bundle/elementName'; * @syscap SystemCapability.Ability.AbilityRuntime.Core * @systemapi Hide this for inner system use * @permission N/A + * @deprecated since 9 + * @useinstead ohos.app.ability.abilityManager */ declare namespace abilityManager { /** diff --git a/api/@ohos.application.appManager.d.ts b/api/@ohos.application.appManager.d.ts index 834a8ef58d767279399e56eec2936495cedce034..3be17cb2018657e9bfc5176c48ec62083604d6ef 100644 --- a/api/@ohos.application.appManager.d.ts +++ b/api/@ohos.application.appManager.d.ts @@ -27,6 +27,8 @@ import { ProcessRunningInformation as _ProcessRunningInformation } from './appli * @syscap SystemCapability.Ability.AbilityRuntime.Core * @import import appManager from '@ohos.application.appManager' * @permission N/A + * @deprecated since 9 + * @useinstead ohos.app.ability.appManager */ declare namespace appManager { /** diff --git a/api/@ohos.application.context.d.ts b/api/@ohos.application.context.d.ts index cae84c127a276814734bf67b0dca81780e7a3d09..d9fc6b0c6b325dd8b68e3ae1c26c7f4c8bcd393b 100755 --- a/api/@ohos.application.context.d.ts +++ b/api/@ohos.application.context.d.ts @@ -29,6 +29,8 @@ import * as _PermissionRequestResult from './application/PermissionRequestResul * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core * @StageModelOnly + * @deprecated since 9 + * @useinstead ohos.app.ability.common */ declare namespace context { diff --git a/api/@ohos.application.errorManager.d.ts b/api/@ohos.application.errorManager.d.ts index dda4361c792b435dc9a79088111180181cbd6216..1709d8e029dd08871acc5ea349c37bb483d91d0e 100644 --- a/api/@ohos.application.errorManager.d.ts +++ b/api/@ohos.application.errorManager.d.ts @@ -23,6 +23,8 @@ import * as _ErrorObserver from './application/ErrorObserver'; * @syscap SystemCapability.Ability.AbilityRuntime.Core * @import import errorManager from '@ohos.application.errorManager' * @permission N/A + * @deprecated since 9 + * @useinstead ohos.app.ability.errorManager */ declare namespace errorManager { /** diff --git a/api/@ohos.application.formInfo.d.ts b/api/@ohos.application.formInfo.d.ts index 46c60e52744dacff91de00ec1ec7d58cabe75a3b..49b86eceadb42834caa0095b976773372f8b5d81 100644 --- a/api/@ohos.application.formInfo.d.ts +++ b/api/@ohos.application.formInfo.d.ts @@ -21,6 +21,8 @@ import Want from './@ohos.application.Want'; * @name formInfo * @since 8 * @syscap SystemCapability.Ability.Form + * @deprecated since 9 + * @useinstead ohos.app.form.formInfo */ declare namespace formInfo { /** @@ -190,7 +192,15 @@ declare namespace formInfo { * @since 8 * @syscap SystemCapability.Ability.Form */ - JS = 1 + JS = 1, + + /** + * eTS form. + * + * @since 9 + * @syscap SystemCapability.Ability.Form + */ + eTS = 2 } /** diff --git a/api/@ohos.application.missionManager.d.ts b/api/@ohos.application.missionManager.d.ts index 3f43e85ddc99b2646f8bb7b1cb80c07b05a882f0..46062f5f4255cfb4f78665164ddf8bfe53619241 100644 --- a/api/@ohos.application.missionManager.d.ts +++ b/api/@ohos.application.missionManager.d.ts @@ -27,6 +27,8 @@ import StartOptions from "./@ohos.application.StartOptions"; * @syscap SystemCapability.Ability.AbilityRuntime.Mission * @permission ohos.permission.MANAGE_MISSIONS * @systemapi hide for inner use. + * @deprecated since 9 + * @useinstead ohos.app.ability.missionManager */ declare namespace missionManager { /** diff --git a/api/@ohos.wantAgent.d.ts b/api/@ohos.wantAgent.d.ts index 48a996a4816d4cb917332e965b0ca0d4c0b1f803..9863e89de47d141f7d29f357844a65d5061cc505 100644 --- a/api/@ohos.wantAgent.d.ts +++ b/api/@ohos.wantAgent.d.ts @@ -27,6 +27,8 @@ import { TriggerInfo as _TriggerInfo } from './wantAgent/triggerInfo'; * @syscap SystemCapability.Ability.AbilityRuntime.Core * @import import wantAgent from '@ohos.wantAgent'; * @permission N/A + * @deprecated since 9 + * @useinstead ohos.app.ability.wantAgent */ declare namespace wantAgent { /** diff --git a/api/application/AbilityContext.d.ts b/api/application/AbilityContext.d.ts index c42a2a2981bb67cd740d475160dd03b0764c3191..ffa23b2ef0fd1ab06779d968a3bfd6ae50831a15 100755 --- a/api/application/AbilityContext.d.ts +++ b/api/application/AbilityContext.d.ts @@ -22,200 +22,363 @@ import { ConnectOptions } from "../ability/connectOptions"; import { HapModuleInfo } from "../bundle/hapModuleInfo"; import Context from "./Context"; import Want from "../@ohos.application.Want"; -import StartOptions from "../@ohos.application.StartOptions"; +import StartOptions from "../@ohos.app.ability.StartOptions"; import PermissionRequestResult from "./PermissionRequestResult"; import { Configuration } from '../@ohos.application.Configuration'; -import Caller from '../@ohos.application.Ability'; +import { Caller } from '../@ohos.app.ability.Ability'; import { LocalStorage } from 'StateManagement'; import image from '../@ohos.multimedia.image'; /** * The context of an ability. It allows access to ability-specific resources. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @permission N/A - * @StageModelOnly + * @stagemodelonly + * @since 9 */ export default class AbilityContext extends Context { /** * Indicates configuration information about an ability. - * - * @since 9 + * @type { AbilityInfo } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ abilityInfo: AbilityInfo; /** - * Indicates configuration information about an module. - * - * @since 9 + * Indicates configuration information about the module. + * @type { HapModuleInfo } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ currentHapModuleInfo: HapModuleInfo; /** * Indicates configuration information. - * - * @since 9 + * @type { Configuration } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ config: Configuration; /** * Starts a new ability. - * - * @since 9 + * @param want { Want } - Indicates the ability to start. + * @param { AsyncCallback } callback - The callback of startAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the ability to start. - * @param options Indicates the start options. - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ startAbility(want: Want, callback: AsyncCallback): void; + + /** + * Starts a new ability. + * @param { Want } want - Indicates the ability to start. + * @param { StartOptions } options - Indicates the start options. + * @param { AsyncCallback } callback - The callback of startAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ startAbility(want: Want, options: StartOptions, callback: AsyncCallback): void; + + /** + * Starts a new ability. + * @param { Want } want - Indicates the ability to start. + * @param { StartOptions } options - Indicates the start options. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ startAbility(want: Want, options?: StartOptions): Promise; /** * Get the caller object of the startup capability - * - * @since 9 + * @param { Want } want - Indicates the ability to start. + * @returns { Promise } Returns the Caller interface. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the ability to start. - * @return Returns to the Caller interface on success Returns empty or undefined on failure - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ startAbilityByCall(want: Want): Promise; /** * Starts a new ability with account. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the want info to start. - * @param accountId Indicates the account to start. - * @param options Indicates the start options. - * @systemapi hide for inner use. - * @return - * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS - * @StageModelOnly + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the account to start. + * @param { AsyncCallback } callback - The callback of startAbilityWithAccount. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 */ startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + + /** + * Starts a new ability with account. + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the account to start. + * @param { StartOptions } options - Indicates the start options. + * @param { AsyncCallback } callback - The callback of startAbilityWithAccount. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback): void; + + /** + * Starts a new ability with account. + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the account to start. + * @param { StartOptions } options - Indicates the start options. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): Promise; /** * Starts an ability and returns the execution result when the ability is destroyed. - * - * @since 9 + * @param { Want } want - Indicates the ability to start. + * @param { AsyncCallback } callback - The callback is used to return the result of startAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the ability to start. - * @param options Indicates the start options. - * @return Returns the {@link AbilityResult}. - * @StageModelOnly + * @stagemodelonly + * @since 9 */ startAbilityForResult(want: Want, callback: AsyncCallback): void; + + /** + * Starts an ability and returns the execution result when the ability is destroyed. + * @param { Want } want - Indicates the ability to start. + * @param { StartOptions } options - Indicates the start options. + * @param { AsyncCallback } callback - The callback is used to return the result of startAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback): void; + + /** + * Starts an ability and returns the execution result when the ability is destroyed. + * @param { Want } want - Indicates the ability to start. + * @param { StartOptions } options - Indicates the start options. + * @returns { Promise } Returns the result of startAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ startAbilityForResult(want: Want, options?: StartOptions): Promise; /** * Starts an ability and returns the execution result when the ability is destroyed with account. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the want info to start. - * @param accountId Indicates the account to start. - * @param options Indicates the start options. - * @systemapi hide for inner use. - * @return Returns the {@link AbilityResult}. * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS - * @StageModelOnly + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the account to start. + * @param { AsyncCallback } callback - The callback is used to return the result of startAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 */ startAbilityForResultWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + + /** + * Starts an ability and returns the execution result when the ability is destroyed with account. + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the account to start. + * @param { StartOptions } options - Indicates the start options. + * @param { AsyncCallback } callback - The callback is used to return the result of startAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ startAbilityForResultWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback): void; + + /** + * Starts an ability and returns the execution result when the ability is destroyed with account. + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the account to start. + * @param { StartOptions } options - Indicates the start options. + * @returns { Promise } Returns the result of startAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ startAbilityForResultWithAccount(want: Want, accountId: number, options?: StartOptions): Promise; /** * Starts a new service extension ability. - * - * @since 9 + * @param { Want } want - Indicates the want info to start. + * @param { AsyncCallback } callback - The callback of startServiceExtensionAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the want info to start. - * @systemapi hide for inner use. - * @return - - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ startServiceExtensionAbility(want: Want, callback: AsyncCallback): void; + + /** + * Starts a new service extension ability. + * @param { Want } want - Indicates the want info to start. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ startServiceExtensionAbility(want: Want): Promise; /** * Starts a new service extension ability with account. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the want info to start. - * @param accountId Indicates the account to start. - * @systemapi hide for inner use. - * @return - * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. - * @StageModelOnly + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the account to start. + * @param { AsyncCallback } callback - The callback of startServiceExtensionAbilityWithAccount. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 */ startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + + /** + * Starts a new service extension ability with account. + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the account to start. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise; /** * Stops a service within the same application. - * - * @since 9 + * @param { Want } want - Indicates the want info to start. + * @param { AsyncCallback } callback - The callback of stopServiceExtensionAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the want info to start. - * @systemapi hide for inner use. - * @return - - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ stopServiceExtensionAbility(want: Want, callback: AsyncCallback): void; + + /** + * Stops a service within the same application. + * @param { Want } want - Indicates the want info to start. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ stopServiceExtensionAbility(want: Want): Promise; /** * Stops a service within the same application with account. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the want info to start. - * @param accountId Indicates the accountId to start. - * @systemapi hide for inner use. - * @return - * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. - * @StageModelOnly + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the accountId to start. + * @param { AsyncCallback } callback - The callback of stopServiceExtensionAbilityWithAccount. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 */ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + + /** + * Stops a service within the same application with account. + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the accountId to start. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise; /** * Destroys this Page ability. - * - * @since 9 + * @param { AsyncCallback } callback - The callback of terminateSelf. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ terminateSelf(callback: AsyncCallback): void; + + /** + * Destroys this Page ability. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ terminateSelf(): Promise; /** * Sets the result code and data to be returned by this Page ability to the caller * and destroys this Page ability. - * - * @since 9 + * @param { AbilityResult } parameter - Indicates the result to return. + * @param { AsyncCallback } callback - The callback of terminateSelfWithResult. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param parameter Indicates the result to return. - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback): void; + + /** + * Sets the result code and data to be returned by this Page ability to the caller + * and destroys this Page ability. + * @param { AbilityResult } parameter - Indicates the result to return. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ terminateSelfWithResult(parameter: AbilityResult): Promise; /** @@ -228,6 +391,8 @@ export default class AbilityContext extends Context { * @systemapi Hide this for inner system use. * @return Returns the number code of the ability connected * @StageModelOnly + * @deprecated since 9 + * @useinstead connectServiceExtensionAbility */ connectAbility(want: Want, options: ConnectOptions): number; @@ -243,6 +408,8 @@ export default class AbilityContext extends Context { * @return Returns the number code of the ability connected * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS * @StageModelOnly + * @deprecated since 9 + * @useinstead connectServiceExtensionAbilityWithAccount */ connectAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number; @@ -254,63 +421,152 @@ export default class AbilityContext extends Context { * @param connection The number code of the ability connected * @systemapi Hide this for inner system use. * @StageModelOnly + * @deprecated since 9 + * @useinstead disconnectServiceExtensionAbility */ disconnectAbility(connection: number, callback:AsyncCallback): void; disconnectAbility(connection: number): Promise; + /** + * Connects the current ability to an ability using the AbilityInfo.AbilityType.SERVICE template. + * @param { Want } want - The element name of the service ability + * @param { ConnectOptions } options - The remote object instance + * @returns { number } Returns the number code of the ability connected + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + connectServiceExtensionAbility(want: Want, options: ConnectOptions): number; + + /** + * Connects the current ability to an ability using the AbilityInfo.AbilityType.SERVICE template with account. + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS + * @param { Want } want - The element name of the service ability + * @param { number } accountId - The account to connect + * @param { ConnectOptions } options - The remote object instance + * @returns { number } Returns the number code of the ability connected + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ + connectServiceExtensionAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number; + + /** + * The callback interface was connect successfully. + * @param { number } connection - The number code of the ability connected + * @param { AsyncCallback } callback - The callback of disconnectAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + disconnectServiceExtensionAbility(connection: number, callback: AsyncCallback): void; + + /** + * The callback interface was connect successfully. + * @param { number } connection - The number code of the ability connected + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + disconnectServiceExtensionAbility(connection: number): Promise; + /** * Set mission label of current ability. - * + * @param { string } label - The label of ability that showed in recent missions. + * @param { AsyncCallback } callback - The callback of setMissionLabel. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly * @since 9 + */ + setMissionLabel(label: string, callback: AsyncCallback): void; + + /** + * Set mission label of current ability. + * @param { string } label - The label of ability that showed in recent missions. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param label The label of ability that showed in recent missions. - * @StageModelOnly + * @stagemodelonly + * @since 9 */ - setMissionLabel(label: string, callback:AsyncCallback): void; - setMissionLabel(label: string): Promise; + setMissionLabel(label: string): Promise; /** * Set mission icon of current ability. - * + * @param { image.PixelMap } icon - The icon of ability that showed in recent missions. + * @param { AsyncCallback } callback - The callback of setMissionIcon. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly * @since 9 + */ + setMissionIcon(icon: image.PixelMap, callback: AsyncCallback): void; + + /** + * Set mission icon of current ability. + * @param { image.PixelMap } icon - The icon of ability that showed in recent missions. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param icon The icon of ability that showed in recent missions. - * @systemapi hide for inner use. - * @return - - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ - setMissionIcon(icon: image.PixelMap, callback:AsyncCallback): void; - setMissionIcon(icon: image.PixelMap): Promise; + setMissionIcon(icon: image.PixelMap): Promise; - /** + /** * Requests certain permissions from the system. - * + * @param { Array } permissions - Indicates the list of permissions to be requested. This parameter + * cannot be null or empty. + * @param { AsyncCallback } requestCallback - The callback is used to return the permission + * request result. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly * @since 9 + */ + requestPermissionsFromUser(permissions: Array, requestCallback: AsyncCallback): void; + + /** + * Requests certain permissions from the system. + * @param { Array } permissions - Indicates the list of permissions to be requested. This parameter + * cannot be null or empty. + * @returns { Promise } Returns the permission request result. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param permissions Indicates the list of permissions to be requested. This parameter cannot be null or empty. - * @return Returns the {@link PermissionRequestResult}. - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ - requestPermissionsFromUser(permissions: Array, requestCallback: AsyncCallback) : void; - requestPermissionsFromUser(permissions: Array) : Promise; + requestPermissionsFromUser(permissions: Array): Promise; /** * Restore window stage data in ability continuation - * - * @since 9 + * @param { LocalStorage } localStorage - the storage data used to restore window stage + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param LocalStorage the storage data used to restore window stage - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ - restoreWindowStage(localStorage: LocalStorage) : void; + restoreWindowStage(localStorage: LocalStorage): void; /** * check to see ability is in terminating state. - * - * @since 9 + * @returns { boolean } Returns true when ability is in terminating state, else returns false. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @return Returns true when ability is in terminating state, else returns false. - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ isTerminating(): boolean; } diff --git a/api/application/AbilityRunningInfo.d.ts b/api/application/AbilityRunningInfo.d.ts index 864465c87b22972ca735b6293fb3b5ad2e39de80..63b82692d4882b7fb2ee1e533577287609fff864 100644 --- a/api/application/AbilityRunningInfo.d.ts +++ b/api/application/AbilityRunningInfo.d.ts @@ -14,7 +14,7 @@ */ import { ElementName } from '../bundle/elementName'; -import abilityManager from '../@ohos.application.abilityManager'; +import abilityManager from '../@ohos.app.ability.abilityManager'; /** * The class of an ability running information. diff --git a/api/application/ApplicationContext.d.ts b/api/application/ApplicationContext.d.ts index 2f605c61cf00e4bfa78422ab766a12527bcc5db8..8fc1e3b46f25faebf87a887c0f0345e78b9680bb 100755 --- a/api/application/ApplicationContext.d.ts +++ b/api/application/ApplicationContext.d.ts @@ -15,16 +15,15 @@ import { AsyncCallback } from "../basic"; import Context from "./Context"; -import AbilityLifecycleCallback from "../@ohos.application.AbilityLifecycleCallback"; -import EnvironmentCallback from "../@ohos.application.EnvironmentCallback"; +import AbilityLifecycleCallback from "../@ohos.app.ability.AbilityLifecycleCallback"; +import EnvironmentCallback from "../@ohos.app.ability.EnvironmentCallback"; +import { ProcessRunningInformation } from "./ProcessRunningInformation"; /** * The context of an application. It allows access to application-specific resources. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @permission N/A - * @StageModelOnly + * @stagemodelonly + * @since 9 */ export default class ApplicationContext extends Context { /** @@ -35,6 +34,8 @@ export default class ApplicationContext extends Context { * @param callback The ability lifecycle callback. * @return Returns the number code of the callback. * @StageModelOnly + * @deprecated since 9 + * @useinstead on */ registerAbilityLifecycleCallback(callback: AbilityLifecycleCallback): number; @@ -46,6 +47,8 @@ export default class ApplicationContext extends Context { * @param callbackId Indicates the number code of the callback. * @return - * @StageModelOnly + * @deprecated since 9 + * @useinstead off */ unregisterAbilityLifecycleCallback(callbackId: number, callback: AsyncCallback): void; unregisterAbilityLifecycleCallback(callbackId: number): Promise; @@ -58,6 +61,8 @@ export default class ApplicationContext extends Context { * @param callback The environment callback. * @return Returns the number code of the callback. * @StageModelOnly + * @deprecated since 9 + * @useinstead on */ registerEnvironmentCallback(callback: EnvironmentCallback): number; @@ -69,7 +74,121 @@ export default class ApplicationContext extends Context { * @param callbackId Indicates the number code of the callback. * @return - * @StageModelOnly + * @deprecated since 9 + * @useinstead off */ unregisterEnvironmentCallback(callbackId: number, callback: AsyncCallback): void; unregisterEnvironmentCallback(callbackId: number): Promise; + + /** + * Register ability lifecycle callback. + * @param { string } type - abilityLifecycle. + * @param { AbilityLifecycleCallback } callback - The ability lifecycle callback. + * @returns { number } Returns the number code of the callback. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + on(type: "abilityLifecycle", callback: AbilityLifecycleCallback): number; + + /** + * Unregister ability lifecycle callback. + * @param { string } type - abilityLifecycle. + * @param { number } callbackId - Indicates the number code of the callback. + * @param { AsyncCallback } callback - The callback of off. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + off(type: "abilityLifecycle", callbackId: number, callback: AsyncCallback): void; + + /** + * Unregister ability lifecycle callback. + * @param { string } type - abilityLifecycle. + * @param { number } callbackId - Indicates the number code of the callback. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + off(type: "abilityLifecycle", callbackId: number): Promise; + + /** + * Register environment callback. + * @param { string } type - environment. + * @param { EnvironmentCallback } callback - The environment callback. + * @returns { number } Returns the number code of the callback. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + on(type: "environment", callback: EnvironmentCallback): number; + + /** + * Unregister environment callback. + * @param { string } type - environment. + * @param { number } callbackId - Indicates the number code of the callback. + * @param { AsyncCallback } callback - The callback of unregisterEnvironmentCallback. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + off(type: "environment", callbackId: number, callback: AsyncCallback): void; + + /** + * Unregister environment callback. + * @param { string } type - environment. + * @param { number } callbackId - Indicates the number code of the callback. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + off(type: "environment", callbackId: number): Promise; + + /** + * Get information about running processes + * @returns { Promise> } Returns the array of {@link ProcessRunningInformation}. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + getProcessRunningInformation(): Promise>; + + /** + * Get information about running processes + * @param { AsyncCallback> } callback - The callback is used to return the array of {@link ProcessRunningInformation}. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + getProcessRunningInformation(callback: AsyncCallback>): void; + + /** + * Kill processes by self + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + killProcessesBySelf(): Promise; + + /** + * Kill processes by self + * @param { AsyncCallback } callback - The callback of killProcessesBySelf. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + killProcessesBySelf(callback: AsyncCallback); } diff --git a/api/application/Context.d.ts b/api/application/Context.d.ts index 26c6eadcadde30f17ddc7dac2d1dcd787881ad7b..32aeb23e08cc65dad9ad4e78ef34f9a309e402bb 100755 --- a/api/application/Context.d.ts +++ b/api/application/Context.d.ts @@ -22,166 +22,163 @@ import ApplicationContext from "./ApplicationContext"; /** * The base context of an ability or an application. It allows access to * application-specific resources. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @permission N/A - * @StageModelOnly + * @stagemodelonly + * @since 9 */ export default class Context extends BaseContext { /** * Indicates the capability of accessing application resources. - * - * @since 9 + * @type { resmgr.ResourceManager } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ resourceManager: resmgr.ResourceManager; /** * Indicates configuration information about an application. - * - * @since 9 + * @type { ApplicationInfo } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ applicationInfo: ApplicationInfo; /** * Indicates app cache dir. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ cacheDir: string; /** * Indicates app temp dir. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ tempDir: string; /** * Indicates app files dir. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ - filesDir : string; + filesDir: string; /** * Indicates app database dir. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ - databaseDir : string; + databaseDir: string; /** * Indicates app preferences dir. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ - preferencesDir : string; + preferencesDir: string; /** * Indicates app bundle code dir. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ - bundleCodeDir : string; + bundleCodeDir: string; /** * Indicates app distributed files dir. - * - * @since 9 + * @type { string } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ distributedFilesDir: string; /** * Indicates event hub. - * - * @since 9 + * @type { EventHub } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ eventHub: EventHub; /** * Indicates file area. - * - * @since 9 + * @type { AreaMode } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ area: AreaMode; /** * Create a bundle context - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi hide for inner use. - * @param bundleName Indicates the bundle name. - * @return application context * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED - * @StageModelOnly + * @param { string } bundleName - Indicates the bundle name. + * @returns { Context } Returns the application context. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 */ createBundleContext(bundleName: string): Context; /** * Create a module context - * - * @since 9 + * @param { string } moduleName - Indicates the module name. + * @returns { Context } Returns the application context. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param moduleName Indicates the module name. - * @return application context - * @StageModelOnly + * @stagemodelonly + * @since 9 */ createModuleContext(moduleName: string): Context; /** * Create a module context - * - * @since 9 + * @param { string } bundleName - Indicates the bundle name. + * @param { string } moduleName - Indicates the module name. + * @returns { Context } Returns the application context. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi hide for inner use. - * @param bundleName Indicates the bundle name. - * @param moduleName Indicates the module name. - * @return application context - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ createModuleContext(bundleName: string, moduleName: string): Context; /** * Get application context - * - * @since 9 + * @returns { ApplicationContext } Returns the application context. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @return application context - * @StageModelOnly + * @stagemodelonly + * @since 9 */ getApplicationContext(): ApplicationContext; } /** - * File area mode - * - * @since 9 + * Enum for the file area mode + * @enum { number } * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly + * @stagemodelonly + * @since 9 */ export enum AreaMode { /** diff --git a/api/application/EventHub.d.ts b/api/application/EventHub.d.ts index 7fe3d203caeeacd2d0139d830ecb382e61b02538..6947fca11f426cfbaff5ac2f66e0e18843c9289f 100644 --- a/api/application/EventHub.d.ts +++ b/api/application/EventHub.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"), * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,48 +13,45 @@ * limitations under the License. */ +import { BusinessError } from '../basic'; + /** * The event center of a context, support the subscription and publication of events. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @permission N/A - * @StageModelOnly + * @stagemodelonly + * @since 9 */ export default class EventHub { /** * Subscribe to an event. - * - * @since 9 + * @param { string } event - Indicates the event. + * @param { Function } callback - Indicates the callback. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param event Indicates the event. - * @param callback Indicates the callback. - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ on(event: string, callback: Function): void /** * Unsubscribe from an event. - * - * @since 9 + * @param { string } event - Indicates the event. + * @param { Function } callback - Indicates the callback. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param event Indicates the event. - * @param callback Indicates the callback. - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ off(event: string, callback?: Function): void /** * Trigger the event callbacks. - * - * @since 9 + * @param { string } event - Indicates the event. + * @param { Object[] } args - Indicates the callback arguments. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param event Indicates the event. - * @param args Indicates the callback arguments. - * @return - - * @StageModelOnly + * @stagemodelonly + * @since 9 */ emit(event: string, ...args: Object[]): void } \ No newline at end of file diff --git a/api/application/ServiceExtensionContext.d.ts b/api/application/ServiceExtensionContext.d.ts index dd21ca7d0a1e5c23fa5b7bd77e6e709f5779c922..e6326f414e149e586c3499e302722f2cdb1ec5cb 100644 --- a/api/application/ServiceExtensionContext.d.ts +++ b/api/application/ServiceExtensionContext.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"), * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -15,119 +15,223 @@ import { AsyncCallback } from "../basic"; import { ConnectOptions } from "../ability/connectOptions"; -import Caller from '../@ohos.application.Ability'; +import { Caller } from '../@ohos.app.ability.Ability'; import ExtensionContext from "./ExtensionContext"; import Want from "../@ohos.application.Want"; -import StartOptions from "../@ohos.application.StartOptions"; +import StartOptions from "../@ohos.app.ability.StartOptions"; /** * The context of service extension. It allows access to * serviceExtension-specific resources. - * - * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi hide for inner use. - * @permission N/A - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ export default class ServiceExtensionContext extends ExtensionContext { /** * Service extension uses this method to start a specific ability. - * - * @since 9 + * @param { Want } want - Indicates the ability to start. + * @param { AsyncCallback } callback - The callback of startAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the ability to start. - * @param options Indicates the start options. - * @systemapi hide for inner use. - * @return - - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ startAbility(want: Want, callback: AsyncCallback): void; + + /** + * Service extension uses this method to start a specific ability. + * @param { Want } want - Indicates the ability to start. + * @param { StartOptions } options - Indicates the start options. + * @param { AsyncCallback } callback - The callback of startAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ startAbility(want: Want, options: StartOptions, callback: AsyncCallback): void; + + /** + * Service extension uses this method to start a specific ability. + * @param { Want } want - Indicates the ability to start. + * @param { StartOptions } options - Indicates the start options. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ startAbility(want: Want, options?: StartOptions): Promise; /** * Service extension uses this method to start a specific ability with account. - * - * @since 9 + * @param { Want } want - Indicates the ability to start. + * @param { number } accountId - Indicates the accountId to start. + * @param { AsyncCallback } callback - The callback of startAbilityWithAccount. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the ability to start. - * @param accountId Indicates the accountId to start. - * @param options Indicates the start options. - * @systemapi hide for inner use. - * @return - - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + + /** + * Service extension uses this method to start a specific ability with account. + * @param { Want } want - Indicates the ability to start. + * @param { number } accountId - Indicates the accountId to start. + * @param { StartOptions } options - Indicates the start options. + * @param { AsyncCallback } callback - The callback of startAbilityWithAccount. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback): void; + + /** + * Service extension uses this method to start a specific ability with account. + * @param { Want } want - Indicates the ability to start. + * @param { number } accountId - Indicates the accountId to start. + * @param { StartOptions } options - Indicates the start options. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): Promise; /** * Starts a new service extension ability. - * - * @since 9 + * @param { Want } want - Indicates the want info to start. + * @param { AsyncCallback } callback - The callback of startServiceExtensionAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the want info to start. - * @systemapi hide for inner use. - * @return - - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ startServiceExtensionAbility(want: Want, callback: AsyncCallback): void; + + /** + * Starts a new service extension ability. + * @param { Want } want - Indicates the want info to start. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ startServiceExtensionAbility(want: Want): Promise; /** * Starts a new service extension ability with account. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the want info to start. - * @param accountId Indicates the account to start. - * @systemapi hide for inner use. - * @return - * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. - * @StageModelOnly + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the account to start. + * @param { AsyncCallback } callback - The callback of startServiceExtensionAbilityWithAccount. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 */ startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + + /** + * Starts a new service extension ability with account. + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the account to start. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise; /** * Stops a service within the same application. - * - * @since 9 + * @param { Want } want - Indicates the want info to start. + * @param { AsyncCallback } callback - The callback of stopServiceExtensionAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the want info to start. - * @systemapi hide for inner use. - * @return - - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ stopServiceExtensionAbility(want: Want, callback: AsyncCallback): void; + + /** + * Stops a service within the same application. + * @param { Want } want - Indicates the want info to start. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ stopServiceExtensionAbility(want: Want): Promise; /** * Stops a service within the same application with account. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the want info to start. - * @param accountId Indicates the accountId to start. - * @systemapi hide for inner use. - * @return - * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. - * @StageModelOnly + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the accountId to start. + * @param { AsyncCallback } callback - The callback of stopServiceExtensionAbilityWithAccount. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 */ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback): void; + + /** + * Stops a service within the same application with account. + * @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS. + * @param { Want } want - Indicates the want info to start. + * @param { number } accountId - Indicates the accountId to start. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise; /** * Destroys this service extension. - * - * @since 9 + * @param { AsyncCallback } callback - The callback of terminateSelf. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @systemapi hide for inner use. - * @return - - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 */ terminateSelf(callback: AsyncCallback): void; + + /** + * Destroys this service extension. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 + */ terminateSelf(): Promise; /** @@ -144,6 +248,8 @@ export default class ServiceExtensionContext extends ExtensionContext { * @systemapi hide for inner use. * @return connection id, int value. * @StageModelOnly + * @deprecated since 9 + * @useinstead connectServiceExtensionAbility */ connectAbility(want: Want, options: ConnectOptions): number; @@ -162,6 +268,8 @@ export default class ServiceExtensionContext extends ExtensionContext { * @systemapi hide for inner use. * @return connection id, int value. * @StageModelOnly + * @deprecated since 9 + * @useinstead connectServiceExtensionAbilityWithAccount */ connectAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number; @@ -175,18 +283,75 @@ export default class ServiceExtensionContext extends ExtensionContext { * @systemapi hide for inner use. * @return - * @StageModelOnly + * @deprecated since 9 + * @useinstead disconnectServiceExtensionAbility */ disconnectAbility(connection: number, callback:AsyncCallback): void; disconnectAbility(connection: number): Promise; /** - * Get the caller object of the startup capability - * + * Connects an ability to a Service extension. + *

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

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

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

+ * @param { Want } want - Indicates the service extension to connect. + * @param { number } accountId - Indicates the account to connect. + * @param { ConnectOptions } options - Indicates the callback of connection. + * @returns { number } Returns the connection id. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the ability to start. - * @return Returns to the Caller interface on success Returns empty or undefined on failure - * @StageModelOnly + * @systemapi + * @stagemodelonly + * @since 9 + */ + connectServiceExtensionAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number; + + /** + * Disconnects an ability to a service extension, in contrast to {@link connectAbility}. + * @param { number } connection - the connection id returned from connectAbility api. + * @param { AsyncCallback } callback - The callback of disconnectAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + disconnectServiceExtensionAbility(connection: number, callback: AsyncCallback): void; + + /** + * Disconnects an ability to a service extension, in contrast to {@link connectAbility}. + * @param { number } connection - the connection id returned from connectAbility api. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @stagemodelonly + * @since 9 + */ + disconnectServiceExtensionAbility(connection: number): Promise; + + /** + * Get the caller object of the startup capability + * @param { Want } want - Indicates the ability to start. + * @returns { Promise } Returns the Caller interface. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @systemapi + * @stagemodelonly + * @since 9 */ - startAbilityByCall(want: Want): Promise; + startAbilityByCall(want: Want): Promise; } \ No newline at end of file diff --git a/api/application/abilityDelegator.d.ts b/api/application/abilityDelegator.d.ts index d6e08d73b2da9897b764087e2fb95667bd74c348..72ac4c9d985ec63d62b80b51251183ea4b839692 100644 --- a/api/application/abilityDelegator.d.ts +++ b/api/application/abilityDelegator.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -14,8 +14,8 @@ */ import { AsyncCallback } from '../basic'; -import Ability from '../@ohos.application.Ability'; -import AbilityStage from '../@ohos.application.AbilityStage'; +import Ability from '../@ohos.app.ability.Ability'; +import AbilityStage from '../@ohos.app.ability.AbilityStage'; import { AbilityMonitor } from './abilityMonitor'; import { AbilityStageMonitor } from './abilityStageMonitor'; import Context from './Context'; @@ -24,140 +24,249 @@ import { ShellCmdResult } from './shellCmdResult'; /** * A global test utility interface used for adding AbilityMonitor objects and control lifecycle states of abilities. - * - * @since 8 + * @interface * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @import import AbilityDelegator from 'application/abilityDelegator.d' - * @permission N/A + * @since 9 */ export interface AbilityDelegator { /** * Add an AbilityMonitor object for monitoring the lifecycle state changes of the specified ability. - * - * @since 9 + * @param { AbilityMonitor } monitor - AbilityMonitor object + * @param { AsyncCallback } callback - The callback of addAbilityMonitor. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param monitor AbilityMonitor object + * @since 9 */ addAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback): void; + + /** + * Add an AbilityMonitor object for monitoring the lifecycle state changes of the specified ability. + * @param { AbilityMonitor } monitor - AbilityMonitor object + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ addAbilityMonitor(monitor: AbilityMonitor): Promise; /** * Add an AbilityStageMonitor object for monitoring the lifecycle state changes of the specified abilityStage. - * + * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. + * @param { AsyncCallback } callback - The callback of addAbilityStageMonitor. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @since 9 + */ + addAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback): void; + + /** + * Add an AbilityStageMonitor object for monitoring the lifecycle state changes of the specified abilityStage. + * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param monitor AbilityStageMonitor object + * @since 9 */ - addAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback): void; - addAbilityStageMonitor(monitor: AbilityStageMonitor): Promise; + addAbilityStageMonitor(monitor: AbilityStageMonitor): Promise; /** * Remove a specified AbilityMonitor object from the application memory. - * - * @since 9 + * @param { AbilityMonitor } monitor - AbilityMonitor object. + * @param { AsyncCallback } callback - The callback of removeAbilityMonitor. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param monitor AbilityMonitor object + * @since 9 */ removeAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback): void; + + /** + * Remove a specified AbilityMonitor object from the application memory. + * @param { AbilityMonitor } monitor - AbilityMonitor object. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ removeAbilityMonitor(monitor: AbilityMonitor): Promise; /** * Remove a specified AbilityStageMonitor object from the application memory. - * + * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. + * @param { AsyncCallback } callback - The callback of removeAbilityStageMonitor. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @since 9 + */ + removeAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback): void; + + /** + * Remove a specified AbilityStageMonitor object from the application memory. + * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param monitor AbilityStageMonitor object + * @since 9 */ - removeAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback): void; - removeAbilityStageMonitor(monitor: AbilityStageMonitor): Promise; + removeAbilityStageMonitor(monitor: AbilityStageMonitor): Promise; /** * Wait for and returns the Ability object that matches the conditions set in the given AbilityMonitor. - * - * @since 9 + * @param { AbilityMonitor } monitor - AbilityMonitor object. + * @param { AsyncCallback } callback - The callback is used to return the Ability object. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param monitor AbilityMonitor object - * @param timeout Maximum wait time, in milliseconds - * @return success: return the Ability object, failure: return null + * @since 9 */ waitAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback): void; + + /** + * Wait for and returns the Ability object that matches the conditions set in the given AbilityMonitor. + * @param { AbilityMonitor } monitor - AbilityMonitor object. + * @param { number } timeout - Maximum wait time, in milliseconds. + * @param { AsyncCallback } callback - The callback is used to return the Ability object. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ waitAbilityMonitor(monitor: AbilityMonitor, timeout: number, callback: AsyncCallback): void; + + /** + * Wait for and returns the Ability object that matches the conditions set in the given AbilityMonitor. + * @param { AbilityMonitor } monitor - AbilityMonitor object. + * @param { number } timeout - Maximum wait time, in milliseconds. + * @returns { Promise } Returns the Ability object. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ waitAbilityMonitor(monitor: AbilityMonitor, timeout?: number): Promise; /** * Wait for and returns the AbilityStage object that matches the conditions set in the given AbilityStageMonitor. - * + * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. + * @param { AsyncCallback } callback - The callback is used to return the AbilityStage object. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + waitAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback): void; + + /** + * Wait for and returns the AbilityStage object that matches the conditions set in the given AbilityStageMonitor. + * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. + * @param { number } timeout - Maximum wait time, in milliseconds. + * @param { AsyncCallback } callback - The callback is used to return the AbilityStage object. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @since 9 + */ + waitAbilityStageMonitor(monitor: AbilityStageMonitor, timeout: number, callback: AsyncCallback): void; + + /** + * Wait for and returns the AbilityStage object that matches the conditions set in the given AbilityStageMonitor. + * @param { AbilityStageMonitor } monitor - AbilityStageMonitor object. + * @param { number } timeout - Maximum wait time, in milliseconds. + * @returns { Promise } Returns the AbilityStage object. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param monitor AbilityStageMonitor object - * @param timeout Maximum wait time, in milliseconds - * @return success: return the AbilityStage object, failure: return null + * @since 9 */ - waitAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback): void; - waitAbilityStageMonitor(monitor: AbilityStageMonitor, timeout: number, callback: AsyncCallback): void; - waitAbilityStageMonitor(monitor: AbilityStageMonitor, timeout?: number): Promise; + waitAbilityStageMonitor(monitor: AbilityStageMonitor, timeout?: number): Promise; /** * Obtain the application context. - * - * @since 9 + * @returns { Context } Returns the app Context. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @return App Context + * @since 9 */ getAppContext(): Context; /** * Obtain the lifecycle state of a specified ability. - * - * @since 9 + * @param { Ability } ability - The Ability object. + * @returns { number } Returns the state of the Ability object. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param ability The Ability object - * @return The state of the Ability object. enum AbilityLifecycleState + * @since 9 */ getAbilityState(ability: Ability): number; /** * Obtain the ability that is currently being displayed. - * - * @since 9 + * @param { AsyncCallback } callback - The callback is used to return the Ability object. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @return The top ability of the current application + * @since 9 */ getCurrentTopAbility(callback: AsyncCallback): void; + + /** + * Obtain the ability that is currently being displayed. + * @returns { Promise } Returns the Ability object. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ getCurrentTopAbility(): Promise /** * Start a new ability. - * - * @since 9 + * @param { Want } want - Indicates the ability to start + * @param { AsyncCallback } callback - The callback of startAbility. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param want Indicates the ability to start - * @return - + * @since 9 */ startAbility(want: Want, callback: AsyncCallback): void; + + /** + * Start a new ability. + * @param { Want } want - Indicates the ability to start + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ startAbility(want: Want): Promise; /** * Invoke the Ability.onForeground() callback of a specified ability without changing its lifecycle state. - * + * @param { Ability } ability - The ability object. + * @param { AsyncCallback } callback - The callback of doAbilityForeground. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @since 9 + */ + doAbilityForeground(ability: Ability, callback: AsyncCallback): void; + + /** + * Invoke the Ability.onForeground() callback of a specified ability without changing its lifecycle state. + * @param { Ability } ability - The ability object. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param ability The ability object - * @return true: success false: failure + * @since 9 */ - doAbilityForeground(ability: Ability, callback: AsyncCallback): void; - doAbilityForeground(ability: Ability): Promise; + doAbilityForeground(ability: Ability): Promise; /** * Invoke the Ability.onBackground() callback of a specified ability without changing its lifecycle state. - * + * @param { Ability } ability - The ability object. + * @param { AsyncCallback } callback - The callback of doAbilityBackground. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @since 9 + */ + doAbilityBackground(ability: Ability, callback: AsyncCallback): void; + + /** + * Invoke the Ability.onBackground() callback of a specified ability without changing its lifecycle state. + * @param { Ability } ability - The ability object. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param ability The ability object - * @return true: success false: failure + * @since 9 */ - doAbilityBackground(ability: Ability, callback: AsyncCallback): void; - doAbilityBackground(ability: Ability): Promise; + doAbilityBackground(ability: Ability): Promise; /** * Prints log information to the unit testing console. @@ -173,12 +282,34 @@ export interface AbilityDelegator { /** * Prints log information to the unit testing console. * The total length of the log information to be printed cannot exceed 1000 characters. - * + * @param { string } msg - Log information. + * @param { AsyncCallback } callback - The callback of printMsg. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core * @since 9 + */ + printMsg(msg: string, callback: AsyncCallback): void; + + /** + * Prints log information to the unit testing console. + * The total length of the log information to be printed cannot exceed 1000 characters. + * @param { string } msg - Log information. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param msg Log information + * @since 9 */ - printSync(msg: string): void; + printMsg(msg: string): Promise; + + /** + * Prints log information to the unit testing console. + * The total length of the log information to be printed cannot exceed 1000 characters. + * @param { string } msg - Log information. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + printSync(msg: string): void; /** * Execute the given command in the aa tools side. @@ -193,16 +324,60 @@ export interface AbilityDelegator { executeShellCommand(cmd: string, timeoutSecs: number, callback: AsyncCallback): void; executeShellCommand(cmd: string, timeoutSecs?: number): Promise; + /** + * Execute the given command in the aa tools side. + * @param { string } cmd - The shell command. + * @param { AsyncCallback } callback - The callback is used to return the ShellCmdResult object. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + executeShellCmd(cmd: string, callback: AsyncCallback): void; + + /** + * Execute the given command in the aa tools side. + * @param { string } cmd - Shell command. + * @param { number } timeoutSecs - Timeout, in seconds. + * @param { AsyncCallback } callback - The callback is used to return the ShellCmdResult object. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + executeShellCmd(cmd: string, timeoutSecs: number, callback: AsyncCallback): void; + + /** + * Execute the given command in the aa tools side. + * @param { string } cmd - Shell command. + * @param { number } timeoutSecs - Timeout, in seconds. + * @returns { Promise } Returns the ShellCmdResult object. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ + executeShellCmd(cmd: string, timeoutSecs?: number): Promise; + /** * Finish the test and print log information to the unit testing console. * The total length of the log information to be printed cannot exceed 1000 characters. - * - * @since 9 + * @param { string } msg - Log information. + * @param { number } code - Result code. + * @param { AsyncCallback } callback - The callback of finishTest. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @param msg Log information - * @param code Result code + * @since 9 */ finishTest(msg: string, code: number, callback: AsyncCallback): void; + + /** + * Finish the test and print log information to the unit testing console. + * The total length of the log information to be printed cannot exceed 1000 characters. + * @param { string } msg - Log information. + * @param { number } code - Result code. + * @returns { Promise } The promise returned by the function. + * @throws { BusinessError } 401 - If the input parameter is not valid parameter. + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @since 9 + */ finishTest(msg: string, code: number): Promise; } diff --git a/api/application/abilityMonitor.d.ts b/api/application/abilityMonitor.d.ts index 6af8397d2af4374028708d8c240d8dcc38d3f524..dd0a1989f104933c169a322e27b1d4ebb6a23845 100644 --- a/api/application/abilityMonitor.d.ts +++ b/api/application/abilityMonitor.d.ts @@ -13,7 +13,7 @@ * limitations under the License. */ -import Ability from '../@ohos.application.Ability'; +import Ability from '../@ohos.app.ability.Ability'; /** * Provide methods for matching monitored Ability objects that meet specified conditions. @@ -33,13 +33,21 @@ export interface AbilityMonitor { */ abilityName: string; + /** + * The name of the module to monitor. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + */ + moduleName?: string; + /** * Called back when the ability is started for initialization. * * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core */ - onAbilityCreate?:(data: Ability) => void; + onAbilityCreate?:(ability: Ability) => void; /** * Called back when the state of the ability changes to foreground. @@ -47,7 +55,7 @@ export interface AbilityMonitor { * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core */ - onAbilityForeground?:(data: Ability) => void; + onAbilityForeground?:(ability: Ability) => void; /** * Called back when the state of the ability changes to background. @@ -55,7 +63,7 @@ export interface AbilityMonitor { * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core */ - onAbilityBackground?:(data: Ability) => void; + onAbilityBackground?:(ability: Ability) => void; /** * Called back before the ability is destroyed. @@ -63,7 +71,7 @@ export interface AbilityMonitor { * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core */ - onAbilityDestroy?:(data: Ability) => void; + onAbilityDestroy?:(ability: Ability) => void; /** * Called back when an ability window stage is created. @@ -71,7 +79,7 @@ export interface AbilityMonitor { * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core */ - onWindowStageCreate?:(data: Ability) => void; + onWindowStageCreate?:(ability: Ability) => void; /** * Called back when an ability window stage is restored. @@ -79,7 +87,7 @@ export interface AbilityMonitor { * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core */ - onWindowStageRestore?:(data: Ability) => void; + onWindowStageRestore?:(ability: Ability) => void; /** * Called back when an ability window stage is destroyed. @@ -87,7 +95,7 @@ export interface AbilityMonitor { * @since 9 * @syscap SystemCapability.Ability.AbilityRuntime.Core */ - onWindowStageDestroy?:(data: Ability) => void; + onWindowStageDestroy?:(ability: Ability) => void; } export default AbilityMonitor; \ No newline at end of file