diff --git a/api/@ohos.application.Ability.d.ts b/api/@ohos.application.Ability.d.ts index 130fd64dcdec5f4d48567799f396116ca74ea400..3779d699fe45f94130ee0c535cb89f58e1d91446 100644 --- a/api/@ohos.application.Ability.d.ts +++ b/api/@ohos.application.Ability.d.ts @@ -17,6 +17,87 @@ import AbilityConstant from "./@ohos.application.AbilityConstant"; import AbilityContext from "./application/AbilityContext"; import Want from './@ohos.application.Want'; import window from './@ohos.window'; +import rpc from '/@ohos.rpc"; + +/** + * The interface of an Caller. + * + * @since 9 + * @sysCap AAFwk + * @devices phone, tablet, tv, wearable, car + * @permission N/A + * @StageModelOnly + */ + interface Caller { + /** + * Notify the server of Sequenceable type data. + * + * @since 9 + * @sysCap AAFwk + * @StageModelOnly + */ + call(method, data: rpc.Sequenceable): Promise; + + /** + * Notify the server of Sequenceable type data and return the notification result. + * + * @since 9 + * @sysCap AAFwk + * return Sequenceable data + * @StageModelOnly + */ + callWithResult(method: string, data: rpc.Sequenceable): Promise; + + /** + * Clear service records. + * + * @since 9 + * @sysCap AAFwk + * return Sequenceable data + * @StageModelOnly + */ + release(): void; + + /** + * Register death listener notification callback. + * + * @since 9 + * @sysCap AAFwk + * return Sequenceable data + * @StageModelOnly + */ + onRelease(callback: function): void; + } + + /** + * The interface of an Callee. + * + * @since 9 + * @sysCap AAFwk + * @devices phone, tablet, tv, wearable, car + * @permission N/A + * @StageModelOnly + */ + interface Callee { + + /** + * Register data listener callback. + * + * @since 9 + * @sysCap AAFwk + * @StageModelOnly + */ + on(method: string, callback: function): void; + + /** + * Unregister data listener callback. + * + * @since 9 + * @sysCap AAFwk + * @StageModelOnly + */ + off(method: string): void; + } /** * The class of an ability. @@ -55,6 +136,15 @@ export default class Ability { */ lastRequestWant: Want; + /** + * Call Service Sutb Object + * + * @since 9 + * @sysCap AAFwk + * @StageModelOnly + */ + callee: Callee; + /** * Called back when an ability is started for initialization. * diff --git a/api/application/AbilityContext.d.ts b/api/application/AbilityContext.d.ts index 1757c2c771ab3cee867ccc44b8aadeff99afc0a2..78fbb91b33931f95d621c920969c31f6000e1b43 100644 --- a/api/application/AbilityContext.d.ts +++ b/api/application/AbilityContext.d.ts @@ -22,6 +22,7 @@ import Context from "./Context"; import Want from "../@ohos.application.Want"; import StartOptions from "../@ohos.application.StartOptions"; import PermissionRequestResult from "./PermissionRequestResult"; +import Caller from "../@ohos.application.Ability"; /** * The context of an ability. It allows access to ability-specific resources. @@ -64,6 +65,18 @@ export default class AbilityContext extends Context { startAbility(want: Want, callback: AsyncCallback): void; startAbility(want: Want, options: StartOptions, callback: AsyncCallback): void; startAbility(want: Want, options?: StartOptions): Promise; + + /** + * Get the caller object of the startup capability + * + * @devices phone, tablet, tv, wearable, car + * @since 9 + * @sysCap AAFwk + * @param parameter Indicates the ability to start. + * @return Caller + * @StageModelOnly + */ + startAbilityByCall(want: Want): Promise; /** * Starts a new ability with account.