IssueNo: #I5RT32

Description: mod interface
Sig: SIG_ApplicationFramework
Feature or Bugfix: Feature
Binary Source: No

Signed-off-by: yangzk <yangzhongkai@huawei.com>
Change-Id: Ia3092286b30f36e05eba91bc756e84cb48a55b14
This commit is contained in:
yangzk 2022-10-14 21:48:31 +08:00
parent 92db8e3a7f
commit be6f52616a
13 changed files with 147 additions and 57 deletions

View File

@ -26,7 +26,7 @@ import { StartAbilityParameter as _StartAbilityParameter } from './ability/star
*
* @since 9
* @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
* @StageModelOnly
* @FAModelOnly
*/
declare namespace ability {

View File

@ -84,13 +84,35 @@ export interface Caller {
/**
* Register death listener notification callback.
* @param { string } type - release.
* @param { OnReleaseCallBack } callback - Register a callback function for listening for notifications.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
* @stagemodelonly
* @since 9
*/
onRelease(callback: OnReleaseCallBack): void;
on(type: "release", callback: OnReleaseCallBack): void;
/**
* Unregister death listener notification callback.
* @param { string } type - release.
* @param { OnReleaseCallBack } callback - Unregister a callback function for listening for notifications.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
* @stagemodelonly
* @since 9
*/
off(type: "release", callback: OnReleaseCallBack): void;
/**
* Unregister all death listener notification callback.
* @param { string } type - release.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
* @stagemodelonly
* @since 9
*/
off(type: "release"): void;
}
/**
@ -265,7 +287,7 @@ export default class Ability {
* @stagemodelonly
* @since 9
*/
dump(params: Array<string>): Array<string>;
onDump(params: Array<string>): Array<string>;
/**
* Called when the system has determined to trim the memory, for example, when the ability is running in the

View File

@ -61,6 +61,7 @@ declare namespace appManager {
/**
* Register application state observer.
* @permission ohos.permission.RUNNING_STATE_OBSERVER
* @param { string } type - applicationState.
* @param { ApplicationStateObserver } observer - The application state observer.
* @return { number } Returns the number code of the observer.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
@ -68,11 +69,12 @@ declare namespace appManager {
* @systemapi
* @since 9
*/
function registerApplicationStateObserver(observer: ApplicationStateObserver): number;
function on(type: "applicationState", observer: ApplicationStateObserver): number;
/**
* Register application state observer.
* @permission ohos.permission.RUNNING_STATE_OBSERVER
* @param { string } type - applicationState.
* @param { ApplicationStateObserver } observer - The application state observer.
* @param { Array<string> } bundleNameList - The list of bundleName. The max length is 128.
* @return { number } Returns the number code of the observer.
@ -81,23 +83,25 @@ declare namespace appManager {
* @systemapi
* @since 9
*/
function registerApplicationStateObserver(observer: ApplicationStateObserver, bundleNameList: Array<string>): number;
function on(type: "applicationState", observer: ApplicationStateObserver, bundleNameList: Array<string>): number;
/**
* Unregister application state observer.
* @permission ohos.permission.RUNNING_STATE_OBSERVER
* @param { string } type - applicationState.
* @param { number } observerId - Indicates the number code of the observer.
* @param { AsyncCallback<void> } callback - The callback of unregisterApplicationStateObserver.
* @param { AsyncCallback<void> } callback - The callback of off.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @systemapi
* @since 9
*/
function unregisterApplicationStateObserver(observerId: number, callback: AsyncCallback<void>): void;
function off(type: "applicationState", observerId: number, callback: AsyncCallback<void>): void;
/**
* Unregister application state observer.
* @permission ohos.permission.RUNNING_STATE_OBSERVER
* @param { string } type - applicationState.
* @param { number } observerId - Indicates the number code of the observer.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
@ -105,7 +109,7 @@ declare namespace appManager {
* @systemapi
* @since 9
*/
function unregisterApplicationStateObserver(observerId: number): Promise<void>;
function off(type: "applicationState", observerId: number): Promise<void>;
/**
* getForegroundApplications.

View File

@ -25,33 +25,36 @@ import * as _ErrorObserver from './application/ErrorObserver';
declare namespace errorManager {
/**
* Register error observer.
* @param { string } type - error.
* @param { ErrorObserver } observer - The error observer.
* @returns { number } Returns the number code of the observer.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @since 9
*/
function registerErrorObserver(observer: ErrorObserver): number;
function on(type: "error", observer: ErrorObserver): number;
/**
* Unregister error observer.
* @param { string } type - error.
* @param { number } observerId - Indicates the number code of the observer.
* @param { AsyncCallback<void> } callback - The callback of unregisterErrorObserver.
* @param { AsyncCallback<void> } callback - The callback of off.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @since 9
*/
function unregisterErrorObserver(observerId: number, callback: AsyncCallback<void>): void;
function off(type: "error", observerId: number, callback: AsyncCallback<void>): void;
/**
* Unregister error observer.
* @param { string } type - error.
* @param { number } observerId - Indicates the number code of the observer.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @since 9
*/
function unregisterErrorObserver(observerId: number): Promise<void>;
function off(type: "error", observerId: number): Promise<void>;
/**
* The observer will be called by system when an error occurs.

View File

@ -30,33 +30,36 @@ import StartOptions from "./@ohos.application.StartOptions";
declare namespace missionManager {
/**
* Register the missionListener to ams.
* @param { string } type - mission.
* @param { MissionListener } listener - Indicates the MissionListener to be registered.
* @returns { number } Returns the index number of the MissionListener.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.AbilityRuntime.Mission
* @since 9
*/
function registerMissionListener(listener: MissionListener): number;
function on(type: "mission", listener: MissionListener): number;
/**
* Unrgister the missionListener to ams.
* @param { string } type - mission.
* @param { number } listenerId - Indicates the listener id to be unregistered.
* @param { AsyncCallback<void> } callback - The callback of unregisterMissionListener.
* @param { AsyncCallback<void> } callback - The callback of off.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.AbilityRuntime.Mission
* @since 9
*/
function unregisterMissionListener(listenerId: number, callback: AsyncCallback<void>): void;
function off(type: "mission", listenerId: number, callback: AsyncCallback<void>): void;
/**
* Unrgister the missionListener to ams.
* @param { string } type - mission.
* @param { number } listenerId - Indicates the listener id to be unregistered.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.AbilityRuntime.Mission
* @since 9
*/
function unregisterMissionListener(listenerId: number): Promise<void>;
function off(type: "mission", listenerId: number): Promise<void>;
/**
* Get the missionInfo with the given missionId.

View File

@ -26,7 +26,7 @@ import { Configuration } from './@ohos.application.Configuration';
* @syscap SystemCapability.Ability.Form
* @StageModelOnly
*/
export default class FormExtension {
export default class FormExtensionAbility {
/**
* Indicates form extension context.
*
@ -48,7 +48,7 @@ export default class FormExtension {
* @return Returns the created {@link formBindingData#FormBindingData} object.
* @StageModelOnly
*/
onCreate(want: Want): formBindingData.FormBindingData;
onAddForm(want: Want): formBindingData.FormBindingData;
/**
* Called when the form provider is notified that a temporary form is successfully converted to a normal form.
@ -59,7 +59,7 @@ export default class FormExtension {
* @return -
* @StageModelOnly
*/
onCastToNormal(formId: string): void;
onCastToNormalForm(formId: string): void;
/**
* Called to notify the form provider to update a specified form.
@ -70,7 +70,7 @@ export default class FormExtension {
* @return -
* @StageModelOnly
*/
onUpdate(formId: string): void;
onUpdateForm(formId: string): void;
/**
* Called when the form provider receives form events from the system.
@ -85,7 +85,7 @@ export default class FormExtension {
* @return -
* @StageModelOnly
*/
onVisibilityChange(newStatus: { [key: string]: number }): void;
onChangeFormVisibility(newStatus: { [key: string]: number }): void;
/**
* Called when a specified message event defined by the form provider is triggered. This method is valid only for
@ -100,7 +100,7 @@ export default class FormExtension {
* @return -
* @StageModelOnly
*/
onEvent(formId: string, message: string): void;
onFormEvent(formId: string, message: string): void;
/**
* Called to notify the form provider that a specified form has been destroyed. Override this method if
@ -112,7 +112,7 @@ export default class FormExtension {
* @return -
* @StageModelOnly
*/
onDestroy(formId: string): void;
onRemoveForm(formId: string): void;
/**
* Called when the system configuration is updated.
@ -150,5 +150,5 @@ export default class FormExtension {
* @return Returns the wantParams object.
* @StageModelOnly
*/
onShare?(formId: string): {[key: string]: any};
onFormToBeShared?(formId: string): {[key: string]: any};
}

View File

@ -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<void> } callback - The callback of castTempForm.
* @param { AsyncCallback<void> } callback - The callback of castToNormalForm.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.Form
* @systemapi
* @since 9
*/
function castTempForm(formId: string, callback: AsyncCallback<void>): void;
function castToNormalForm(formId: string, callback: AsyncCallback<void>): 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<void>;
function castToNormalForm(formId: string): Promise<void>;
/**
* Sends a notification to the form framework to make the specified forms visible.

View File

@ -133,6 +133,6 @@ export default class ServiceExtensionAbility {
* @return The dump info array.
* @StageModelOnly
*/
dump(params: Array<string>): Array<string>;
onDump(params: Array<string>): Array<string>;
}

View File

@ -190,7 +190,15 @@ declare namespace formInfo {
* @since 8
* @syscap SystemCapability.Ability.Form
*/
JS = 1
JS = 1,
/**
* eTS form.
*
* @since 9
* @syscap SystemCapability.Ability.Form
*/
eTS = 2
}
/**

View File

@ -104,6 +104,7 @@ export default class AbilityContext extends Context {
* @returns { Promise<Caller> } Returns the Caller interface.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @systemapi
* @stagemodelonly
* @since 9
*/
@ -387,11 +388,10 @@ export default class AbilityContext extends Context {
* @returns { number } Returns the number code of the ability connected
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @systemapi
* @stagemodelonly
* @since 9
*/
connectAbility(want: Want, options: ConnectOptions): number;
connectServiceExtensionAbility(want: Want, options: ConnectOptions): number;
/**
* Connects the current ability to an ability using the AbilityInfo.AbilityType.SERVICE template with account.
@ -406,7 +406,7 @@ export default class AbilityContext extends Context {
* @stagemodelonly
* @since 9
*/
connectAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number;
connectServiceExtensionAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number;
/**
* The callback interface was connect successfully.
@ -414,11 +414,10 @@ export default class AbilityContext extends Context {
* @param { AsyncCallback<void> } callback - The callback of disconnectAbility.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @systemapi
* @stagemodelonly
* @since 9
*/
disconnectAbility(connection: number, callback: AsyncCallback<void>): void;
disconnectServiceExtensionAbility(connection: number, callback: AsyncCallback<void>): void;
/**
* The callback interface was connect successfully.
@ -426,11 +425,10 @@ export default class AbilityContext extends Context {
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @systemapi
* @stagemodelonly
* @since 9
*/
disconnectAbility(connection: number): Promise<void>;
disconnectServiceExtensionAbility(connection: number): Promise<void>;
/**
* Set mission label of current ability.

View File

@ -17,6 +17,7 @@ import { AsyncCallback } from "../basic";
import Context from "./Context";
import AbilityLifecycleCallback from "../@ohos.application.AbilityLifecycleCallback";
import EnvironmentCallback from "../@ohos.application.EnvironmentCallback";
import { ProcessRunningInformation } from "./ProcessRunningInformation";
/**
* The context of an application. It allows access to application-specific resources.
@ -27,6 +28,7 @@ import EnvironmentCallback from "../@ohos.application.EnvironmentCallback";
export default class ApplicationContext extends Context {
/**
* Register ability lifecycle callback.
* @param { string } type - abilityLifecycle.
* @param { AbilityLifecycleCallback } callback - The ability lifecycle callback.
* @returns { number } Returns the number code of the callback.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
@ -34,21 +36,23 @@ export default class ApplicationContext extends Context {
* @stagemodelonly
* @since 9
*/
registerAbilityLifecycleCallback(callback: AbilityLifecycleCallback): number;
on(type: "abilityLifecycle", callback: AbilityLifecycleCallback): number;
/**
* Unregister ability lifecycle callback.
* @param { string } type - abilityLifecycle.
* @param { number } callbackId - Indicates the number code of the callback.
* @param { AsyncCallback<void> } callback - The callback of unregisterAbilityLifecycleCallback.
* @param { AsyncCallback<void> } callback - The callback of off.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @stagemodelonly
* @since 9
*/
unregisterAbilityLifecycleCallback(callbackId: number, callback: AsyncCallback<void>): void;
off(type: "abilityLifecycle", callbackId: number, callback: AsyncCallback<void>): void;
/**
* Unregister ability lifecycle callback.
* @param { string } type - abilityLifecycle.
* @param { number } callbackId - Indicates the number code of the callback.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
@ -56,10 +60,11 @@ export default class ApplicationContext extends Context {
* @stagemodelonly
* @since 9
*/
unregisterAbilityLifecycleCallback(callbackId: number): Promise<void>;
off(type: "abilityLifecycle", callbackId: number): Promise<void>;
/**
* Register environment callback.
* @param { string } type - environment.
* @param { EnvironmentCallback } callback - The environment callback.
* @returns { number } Returns the number code of the callback.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
@ -67,10 +72,11 @@ export default class ApplicationContext extends Context {
* @stagemodelonly
* @since 9
*/
registerEnvironmentCallback(callback: EnvironmentCallback): number;
on(type: "environment", callback: EnvironmentCallback): number;
/**
* Unregister environment callback.
* @param { string } type - environment.
* @param { number } callbackId - Indicates the number code of the callback.
* @param { AsyncCallback<void> } callback - The callback of unregisterEnvironmentCallback.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
@ -78,10 +84,11 @@ export default class ApplicationContext extends Context {
* @stagemodelonly
* @since 9
*/
unregisterEnvironmentCallback(callbackId: number, callback: AsyncCallback<void>): void;
off(type: "environment", callbackId: number, callback: AsyncCallback<void>): void;
/**
* Unregister environment callback.
* @param { string } type - environment.
* @param { number } callbackId - Indicates the number code of the callback.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
@ -89,5 +96,45 @@ export default class ApplicationContext extends Context {
* @stagemodelonly
* @since 9
*/
unregisterEnvironmentCallback(callbackId: number): Promise<void>;
off(type: "environment", callbackId: number): Promise<void>;
/**
* Get information about running processes
* @returns { Promise<Array<ProcessRunningInformation>> } Returns the array of {@link ProcessRunningInformation}.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @stagemodelonly
* @since 9
*/
getProcessRunningInformation(): Promise<Array<ProcessRunningInformation>>;
/**
* Get information about running processes
* @param { AsyncCallback<Array<ProcessRunningInformation>> } callback - The callback is used to return the array of {@link ProcessRunningInformation}.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @stagemodelonly
* @since 9
*/
getProcessRunningInformation(callback: AsyncCallback<Array<ProcessRunningInformation>>): void;
/**
* Kill processes by self
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @stagemodelonly
* @since 9
*/
killProcessesBySelf(): Promise<void>;
/**
* Kill processes by self
* @param { AsyncCallback<void> } 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<void>);
}

View File

@ -244,11 +244,10 @@ export default class ServiceExtensionContext extends ExtensionContext {
* @returns { number } Returns the connection id.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @systemapi
* @stagemodelonly
* @since 9
*/
connectAbility(want: Want, options: ConnectOptions): number;
connectServiceExtensionAbility(want: Want, options: ConnectOptions): number;
/**
* Connects an ability to a Service extension with account.
@ -265,7 +264,7 @@ export default class ServiceExtensionContext extends ExtensionContext {
* @stagemodelonly
* @since 9
*/
connectAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number;
connectServiceExtensionAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number;
/**
* Disconnects an ability to a service extension, in contrast to {@link connectAbility}.
@ -273,11 +272,10 @@ export default class ServiceExtensionContext extends ExtensionContext {
* @param { AsyncCallback<void> } callback - The callback of disconnectAbility.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @systemapi
* @stagemodelonly
* @since 9
*/
disconnectAbility(connection: number, callback: AsyncCallback<void>): void;
disconnectServiceExtensionAbility(connection: number, callback: AsyncCallback<void>): void;
/**
* Disconnects an ability to a service extension, in contrast to {@link connectAbility}.
@ -285,11 +283,10 @@ export default class ServiceExtensionContext extends ExtensionContext {
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 401 - If the input parameter is not valid parameter.
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @systemapi
* @stagemodelonly
* @since 9
*/
disconnectAbility(connection: number): Promise<void>;
disconnectServiceExtensionAbility(connection: number): Promise<void>;
/**
* Get the caller object of the startup capability

View File

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