Signed-off-by: zhongjianfei <zhongjianfei@huawei.com>
Change-Id: Iaabcd22fc9a409965c78c6d2fc813f64c9bc2c5e
This commit is contained in:
zhongjianfei 2022-01-10 11:12:24 +08:00
parent 2558da78a1
commit c53271a638
25 changed files with 1783 additions and 0 deletions

156
api/@ohos.application.Ability.d.ts vendored Normal file
View File

@ -0,0 +1,156 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"),
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityContext from "./application/AbilityContext";
import Want from './@ohos.application.Want';
import window from './@ohos.window';
/**
* The class of an ability.
*
* @since 8
* @sysCap AAFwk
* @devices phone, tablet, tv, wearable, car
* @permission N/A
*/
export default class Ability {
/**
* Indicates configuration information about an ability context.
*
* @since 8
* @sysCap AAFwk
*/
context: AbilityContext;
/**
* Indicates ability launch want.
*
* @since 8
* @sysCap AAFwk
*/
launchWant: Want;
/**
* Indicates ability last request want.
*
* @since 8
* @sysCap AAFwk
*/
lastRequestWant: Want;
/**
* Called back when an ability is started for initialization.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @return -
*/
onCreate(want: Want, param: LaunchParam): void;
/**
* Called back when an ability window stage is created.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @return -
*/
onWindowStageCreate(windowStage: window.WindowStage): void;
/**
* Called back when an ability window stage is destroyed.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @return -
*/
onWindowStageDestroy(): void;
/**
* Called back before an ability is destroyed.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @return -
*/
onDestroy(): void;
/**
* Called back when the state of an ability changes to foreground.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @return -
*/
onForeground(): void;
/**
* Called back when the state of an ability changes to background.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @return -
*/
onBackground(): void;
}
export interface LaunchParam {
/**
* Indicates launch reason.
*
* @since 8
* @sysCap AAFwk
*/
launchReason: LaunchReason;
/**
* Indicates last exit reason.
*
* @since 8
* @sysCap AAFwk
*/
lastExitReason: LastExitReason;
}
/**
* Type of launch reason.
*
* @since 8
* @sysCap AAFwk
*/
export enum LaunchReason {
UNKNOWN = 0,
START_ABILITY = 1,
CALL = 2,
CONTINUATION = 3,
}
/**
* Type of last exit reason.
*
* @since 8
* @sysCap AAFwk
*/
export enum LastExitReason {
UNKNOWN = 0,
ABILITY_NOT_RESPONDING = 1,
NORMAL = 2,
}

44
api/@ohos.application.AbilityStage.d.ts vendored Normal file
View File

@ -0,0 +1,44 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"),
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityStageContext from "./application/AbilityStageContext";
/**
* The class of an ability stage.
*
* @since 8
* @sysCap AAFwk
* @devices phone, tablet, tv, wearable, car
* @permission N/A
*/
export default class AbilityStage {
/**
* Indicates configuration information about context.
*
* @since 8
* @sysCap AAFwk
*/
context: AbilityStageContext;
/**
* Called back when an ability stage is started for initialization.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @return -
*/
onCreate(): void;
}

113
api/@ohos.application.FormExtension.d.ts vendored Normal file
View File

@ -0,0 +1,113 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"),
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import formBindingData from './@ohos.application.formBindingData';
import FormExtensionContext from "./application/FormExtensionContext";
import Want from './@ohos.application.Want';
/**
* class of form extension.
*
* @since 8
* @sysCap AAFwk
* @devices phone, tablet, tv, wearable, car
*/
export default class FormExtension {
/**
* Indicates form extension context.
*
* @since 8
* @sysCap AAFwk
*/
context: FormExtensionContext;
/**
* Called to return a {@link formBindingData#FormBindingData} object.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @param 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 Returns the created {@link formBindingData#FormBindingData} object.
*/
onCreate(want: Want): formBindingData.FormBindingData;
/**
* Called when the form provider is notified that a temporary form is successfully converted to a normal form.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @param formId Indicates the ID of the form.
* @return -
*/
onCastToNormal(formId: string): void;
/**
* Called to notify the form provider to update a specified form.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @param formId Indicates the ID of the form to update.
* @return -
*/
onUpdate(formId: string): void;
/**
* Called when the form provider receives form events from the system.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @param 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 formManager#VisibilityType#FORM_VISIBLE}
* or {@link formManager#VisibilityType#FORM_INVISIBLE}. {@link formManager#VisibilityType#FORM_VISIBLE}
* means that the form becomes visible, and {@link formManager#VisibilityType#FORM_INVISIBLE}
* means that the form becomes invisible.
* @return -
*/
onVisibilityChange(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.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @param 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 message Indicates the value of the {@code params} field of the message event. This parameter is
* used to identify the specific component on which the event is triggered.
* @return -
*/
onEvent(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.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @param formId Indicates the ID of the destroyed form.
* @return -
*/
onDestroy(formId: string): void;
}

View File

@ -0,0 +1,112 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"),
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import rpc from "./@ohos.rpc";
import ServiceExtensionContext from "./application/ServiceExtensionContext";
import Want from './@ohos.application.Want';
/**
* class of service extension.
*
* @since 8
* @sysCap AAFwk
* @devices phone, tablet, tv, wearable, car
* @systemapi hide for inner use.
*/
export default class ServiceExtension {
/**
* Indicates service extension context.
*
* @since 8
* @sysCap AAFwk
* @systemapi hide for inner use.
*/
context: ServiceExtensionContext;
/**
* Called back when a service extension is started for initialization.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @systemapi hide for inner use.
* @return -
*/
onCreate(want: Want): void;
/**
* Called back before a service extension is destroyed.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @systemapi hide for inner use.
* @return -
*/
onDestroy(): void;
/**
* Called back when a service extension is started.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @param want Indicates the want of service extension to start.
* @param startId Indicates the number of times the service extension has been started. The {@code startId} is
* incremented by 1 every time the service extension is started. For example, if the service extension
* has been started for six times.
* @systemapi hide for inner use.
* @return -
*/
onRequest(want: Want, startId: number): void;
/**
* Called back when a service extension is first connected to an ability.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @param want Indicates connection information about the Service ability.
* @systemapi hide for inner use.
* @return Returns the proxy of the Service ability.
*/
onConnect(want: Want): rpc.RemoteObject;
/**
* Called back when all abilities connected to a service extension are disconnected.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @param want Indicates disconnection information about the service extension.
* @systemapi hide for inner use.
* @return -
*/
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.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @param want Indicates the want of the service extension being connected.
* @systemapi hide for inner use.
* @return -
*/
onReconnect(want: Want): void;
}

34
api/@ohos.application.StartOptions.d.ts vendored Normal file
View File

@ -0,0 +1,34 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* StartOptions is the basic communication component of the system.
*
* @name StartOptions
* @since 8
* @sysCap AAFwk
* @devices phone, tablet, tv, wearable, car
* @permission N/A
*/
export default class StartOptions {
/**
* windowMode
* @default -
* @devices phone, tablet
* @since 8
* @sysCap AAFwk
*/
windowMode?: number;
}

106
api/@ohos.application.Want.d.ts vendored Normal file
View File

@ -0,0 +1,106 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Want is the basic communication component of the system.
*
* @name Want
* @since 8
* @sysCap AAFwk
* @devices phone, tablet, tv, wearable, car
* @permission N/A
*/
export default class Want {
/**
* device id
* @default -
* @devices phone, tablet
* @since 8
* @sysCap AAFwk
*/
deviceId?: string;
/**
* bundle name
* @default -
* @devices phone, tablet
* @since 8
* @sysCap AAFwk
*/
bundleName?: string;
/**
* ability name
* @default -
* @devices phone, tablet
* @since 8
* @sysCap AAFwk
*/
abilityName?: string;
/**
* The description of a URI in a Want.
* @devices phone, tablet
* @since 8
* @sysCap AAFwk
* @default -
*/
uri?: string;
/**
* The description of the type in this Want.
* @devices phone, tablet
* @since 8
* @sysCap AAFwk
* @default -
*/
type?: string;
/**
* The options of the flags in this Want.
* @devices phone, tablet
* @since 8
* @sysCap AAFwk
* @default -
*/
flags?: number;
/**
* The description of an action in an want.
* @devices phone, tablet
* @since 8
* @sysCap AAFwk
* @default -
*/
action?: string;
/**
* The description of the WantParams object in an Want
* @devices phone, tablet
* @since 8
* @sysCap AAFwk
* @default -
*/
parameters?: {[key: string]: any};
/**
* The description of a entities in a Want.
* @devices phone, tablet
* @since 8
* @sysCap AAFwk
* @default -
*/
entities?: Array<string>;
}

66
api/@ohos.application.appManager.d.ts vendored Normal file
View File

@ -0,0 +1,66 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { AsyncCallback } from './basic';
import ApplicationStateObserver from './application/ApplicationStateObserver';
import AppStateData from './application/AppStateData';
/**
* This module provides the function of app manager service.
*
* @since 8
* @SysCap appexecfwk
* @devices phone, tablet, tv, wearable, car
* @import import appManager from '@ohos.application.appManager'
* @permission N/A
*/
declare namespace appManager {
/**
* Register application state observer.
*
* @default -
* @devices phone, tablet, tv, wearable, car
* @since 8
* @SysCap appexecfwk
* @param observer The application state observer.
* @return Returns the number code of the observer.
*/
function registerApplicationStateObserver(observer: ApplicationStateObserver): number;
/**
* Unregister application state observer.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @SysCap appexecfwk
* @param observerId Indicates the number code of the observer.
* @return -
*/
function unregisterApplicationStateObserver(observerId: number, callback: AsyncCallback<void>): void;
function unregisterApplicationStateObserver(observerId: number): Promise<void>;
/**
* getForegroundApplications.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @SysCap appexecfwk
* @return Returns the list of AppStateData.
*/
function getForegroundApplications(callback: AsyncCallback<Array<AppStateData>>): void;
function getForegroundApplications(): Promise<Array<AppStateData>>;
}
export default appManager;

View File

@ -0,0 +1,40 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* interface of formBindingData.
*
* @name formBindingData
* @since 8
* @sysCap AAFwk
* @devices phone, tablet, tv, wearable, car
*/
declare namespace formBindingData {
/**
* Create an FormBindingData instance.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @param obj Indicates the FormBindingData instance data.
* @return Returns the {@link FormBindingData} instance.
*/
function createFormBindingData(obj: Object | string): FormBindingData;
interface FormBindingData {
data: Object
}
}
export default formBindingData;

View File

@ -0,0 +1,142 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"),
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { AsyncCallback } from './basic';
import { MissionInfo } from './application/MissionInfo';
import { MissionListener } from './application/MissionListener';
import { MissionSnapshot } from './application/MissionSnapshot';
/**
* This module provides the capability to manage abilities and obtaining system task information.
*
* @name missionManager
* @since 8
* @sysCap AAFwk
* @devices phone, tablet
* @permission N/A
* @systemapi hide for inner use.
*/
declare namespace missionManager {
/**
* Register the missionListener to ams.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @return The index number of the MissionListener.
*/
function registerMissionListener(listener: MissionListener): number;
/**
* Unrgister the missionListener to ams.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @return -
*/
function unregisterMissionListener(listenerId: number, callback: AsyncCallback<void>): void;
function unregisterMissionListener(listenerId: number): Promise<void>;
/**
* Get the missionInfo with the given missionId.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @return the {@link MissionInfo} of the given id.
*/
function getMissionInfo(deviceId: string, missionId: number, callback: AsyncCallback<MissionInfo>): void;
function getMissionInfo(deviceId: string, missionId: number): Promise<MissionInfo>;
/**
* Get the missionInfo with the given missionId.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @return The array of the {@link MissionInfo}.
*/
function getMissionInfos(deviceId: string, numMax: number, callback: AsyncCallback<Array<MissionInfo>>): void;
function getMissionInfos(deviceId: string, numMax: number): Promise<Array<MissionInfo>>;
/**
* Get the mission snapshot with the given missionId.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @return The {@link MissionSnapshot} of the given id.
*/
function getMissionSnapShot(deviceId: string, missionId: number, callback: AsyncCallback<MissionSnapshot>): void;
function getMissionSnapShot(deviceId: string, missionId: number): Promise<MissionSnapshot>;
/**
* Lock the mission.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @return -
*/
function lockMission(missionId: number, callback: AsyncCallback<void>): void;
function lockMission(missionId: number): Promise<void>;
/**
* Unlock the mission.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @return -
*/
function unlockMission(missionId: number, callback: AsyncCallback<void>): void;
function unlockMission(missionId: number): Promise<void>;
/**
* Clear the given mission in the ability manager service.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @return -
*/
function clearMission(missionId: number, callback: AsyncCallback<void>): void;
function clearMission(missionId: number): Promise<void>;
/**
* Clear all missions in the ability manager service.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @return -
*/
function clearAllMissions(callback: AsyncCallback<void>): void;
function clearAllMissions(): Promise<void>;
/**
* Schedule the given mission to foreground.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @return -
*/
function moveMissionToFront(missionId: number, callback: AsyncCallback<void>): void;
function moveMissionToFront(missionId: number): Promise<void>;
}
export default missionManager;

View File

@ -543,6 +543,15 @@ declare namespace notification {
function supportDoNotDisturbMode(callback: AsyncCallback<boolean>): void;
function supportDoNotDisturbMode(): Promise<boolean>;
/**
* Obtains whether the template is supported by the system.
*
* @since 8
* @param templateName Name of template to be Obtained
*/
function isSupportTemplate(templateName: string, callback: AsyncCallback<boolean>): void;
function isSupportTemplate(templateName: string): Promise<boolean>;
/**
* Describes a BundleOption.
*/

123
api/application/AbilityContext.d.ts vendored Normal file
View File

@ -0,0 +1,123 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"),
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { AbilityInfo } from "../bundle/abilityInfo";
import { AbilityResult } from "../ability/abilityResult";
import { AsyncCallback } from "../basic";
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";
/**
* The context of an ability. It allows access to ability-specific resources.
*
* @since 8
* @sysCap AAFwk
* @devices phone, tablet, tv, wearable, car
* @permission N/A
*/
export default class AbilityContext extends Context {
/**
* Indicates configuration information about an ability.
*
* @since 8
* @sysCap AAFwk
*/
abilityInfo: AbilityInfo;
/**
* Indicates configuration information about an module.
*
* @since 8
* @sysCap AAFwk
*/
currentHapModuleInfo: HapModuleInfo;
/**
* Starts a new ability.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @param parameter Indicates the ability to start.
* @return -
*/
startAbility(want: Want, callback: AsyncCallback<void>): void;
startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void>): void;
startAbility(want: Want, options?: StartOptions): Promise<void>;
/**
* Starts an ability and returns the execution result when the ability is destroyed.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @param parameter Indicates the ability to start.
* @return Returns the {@link AbilityResult}.
*/
startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>): void;
startAbilityForResult(want: Want): Promise<AbilityResult>;
/**
* Destroys this Page ability.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @return -
*/
terminateSelf(callback: AsyncCallback<void>): void;
terminateSelf(): Promise<void>;
/**
* Sets the result code and data to be returned by this Page ability to the caller
* and destroys this Page ability.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @param parameter Indicates the result to return.
* @return -
*/
terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback<void>): void;
terminateSelfWithResult(parameter: AbilityResult): Promise<void>;
/**
* Connects the current ability to an ability using the AbilityInfo.AbilityType.SERVICE template.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @param want The element name of the service ability
* @param options The remote object instance
* @hide hide for inner use.
* @return Returns the number code of the ability connected
*/
connectAbility(want: Want, options: ConnectOptions): number;
/**
* The callback interface was connect successfully.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @param connection The number code of the ability connected
* @hide hide for inner use.
*/
disconnectAbility(connection: number, callback:AsyncCallback<void>): void;
disconnectAbility(connection: number): Promise<void>;
}

View File

@ -0,0 +1,36 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"),
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { HapModuleInfo } from "../bundle/hapModuleInfo";
import Context from "./Context";
/**
* The context of an abilityStage. It allows access to abilityStage-specific resources.
*
* @since 8
* @sysCap AAFwk
* @devices phone, tablet, tv, wearable, car
* @permission N/A
*/
export default class AbilityStageContext extends Context {
/**
* Indicates configuration information about an module.
*
* @since 8
* @sysCap AAFwk
*/
currentHapModuleInfo: HapModuleInfo;
}

75
api/application/AbilityStateData.d.ts vendored Normal file
View File

@ -0,0 +1,75 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"),
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* The ability or extension state data.
*
* @since 8
* @sysCap appexecfwk
* @devices phone, tablet, tv, wearable, car
* @systemapi hide for inner use.
* @permission N/A
*/
export default class AbilityStateData {
/**
* The bundle name.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap appexecfwk
* @systemapi hide for inner use.
*/
bundleName: string;
/**
* The ability name.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap appexecfwk
* @systemapi hide for inner use.
*/
abilityName: string;
/**
* The pid.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap appexecfwk
* @systemapi hide for inner use.
*/
pid: number;
/**
* The uid.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap appexecfwk
* @systemapi hide for inner use.
*/
uid: number;
/**
* The application state.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap appexecfwk
* @systemapi hide for inner use.
*/
state: number;
}

55
api/application/AppStateData.d.ts vendored Normal file
View File

@ -0,0 +1,55 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"),
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* The application state data.
*
* @since 8
* @sysCap appexecfwk
* @devices phone, tablet, tv, wearable, car
* @systemapi hide for inner use.
* @permission N/A
*/
export default class AppStateData {
/**
* The bundle name.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap appexecfwk
* @systemapi hide for inner use.
*/
bundleName: string;
/**
* The uid.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap appexecfwk
* @systemapi hide for inner use.
*/
uid: number;
/**
* The application state.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap appexecfwk
* @systemapi hide for inner use.
*/
state: number;
}

View File

@ -0,0 +1,89 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"),
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AppStateData from "./AppStateData";
import AbilityStateData from "./AbilityStateData";
import ProcessData from "./ProcessData";
/**
* The application state observer.
*
* @since 8
* @sysCap appexecfwk
* @devices phone, tablet, tv, wearable, car
* @systemapi hide for inner use.
* @permission N/A
*/
export default class ApplicationStateObserver {
/**
* Will be called when foreground or background application changed.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap appexecfwk
* @param appStateData State changed Application info.
* @systemapi hide for inner use.
* @return -
*/
onForegroundApplicationChanged(appStateData: AppStateData): void;
/**
* Will be called when ability state changed.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap appexecfwk
* @param abilityStateData State changed ability info.
* @systemapi hide for inner use.
* @return -
*/
onAbilityStateChanged(abilityStateData: AbilityStateData): void;
/**
* Will be called when extension state changed.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap appexecfwk
* @param abilityStateData State changed extension info.
* @systemapi hide for inner use.
* @return -
*/
onExtensionStateChanged(abilityStateData: AbilityStateData): void;
/**
* Will be called when process created.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap appexecfwk
* @param processData Process info.
* @systemapi hide for inner use.
* @return -
*/
onProcessCreated(processData: ProcessData): void;
/**
* Will be called when process died.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap appexecfwk
* @param processData Process info.
* @systemapi hide for inner use.
* @return -
*/
onProcessDied(processData: ProcessData): void;
}

122
api/application/Context.d.ts vendored Normal file
View File

@ -0,0 +1,122 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"),
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { ApplicationInfo } from "../bundle/applicationInfo";
import resmgr from "../@ohos.resourceManager";
/**
* The base context of an ability or an application. It allows access to
* application-specific resources.
*
* @since 8
* @sysCap AAFwk
* @devices phone, tablet, tv, wearable, car
* @permission N/A
*/
export default class Context {
/**
* Indicates the capability of accessing application resources.
*
* @since 8
* @sysCap AAFwk
*/
resourceManager: resmgr.ResourceManager;
/**
* Indicates configuration information about an application.
*
* @since 8
* @sysCap AAFwk
*/
applicationInfo: ApplicationInfo;
/**
* Indicates app cache dir.
*
* @since 8
* @sysCap AAFwk
*/
cacheDir: string;
/**
* Indicates app temp dir.
*
* @since 8
* @sysCap AAFwk
*/
tempDir: string;
/**
* Indicates app files dir.
*
* @since 8
* @sysCap AAFwk
*/
filesDir : string;
/**
* Indicates app database dir.
*
* @since 8
* @sysCap AAFwk
*/
databaseDir : string;
/**
* Indicates app storage dir.
*
* @since 8
* @sysCap AAFwk
*/
storageDir : string;
/**
* Indicates app bundle code dir.
*
* @since 8
* @sysCap AAFwk
*/
bundleCodeDir : string;
/**
* Indicates app distributed files dir.
*
* @since 8
* @sysCap AAFwk
*/
distributedFilesDir: string;
/**
* Create a bundle context
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @systemapi hide for inner use.
* @param bundleName Indicates the bundle name.
* @return application context
*/
createBundleContext(bundleName: string): Context;
/**
* Get application context
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @return application context
*/
getApplicationContext(): Context;
}

36
api/application/ExtensionContext.d.ts vendored Normal file
View File

@ -0,0 +1,36 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"),
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { HapModuleInfo } from "../bundle/hapModuleInfo";
import Context from "./Context";
/**
* The context of an extension. It allows access to extension-specific resources.
*
* @since 8
* @sysCap AAFwk
* @devices phone, tablet, tv, wearable, car
* @permission N/A
*/
export default class ExtensionContext extends Context {
/**
* Indicates configuration information about an module.
*
* @since 8
* @sysCap AAFwk
*/
currentHapModuleInfo: HapModuleInfo;
}

View File

@ -0,0 +1,46 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"),
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { AsyncCallback } from "../basic";
import ExtensionContext from "./ExtensionContext";
import formBindingData from '../@ohos.application.formBindingData';
/**
* The context of form extension. It allows access to
* formExtension-specific resources.
*
* @since 8
* @sysCap AAFwk
* @devices phone, tablet, tv, wearable, car
* @permission N/A
*/
export default class FormExtensionContext extends ExtensionContext {
/**
* update the given form.
*
* <p>You can use this method to update the given form</p>
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @permission ohos.permission.REQUIRE_FORM.
* @param formId Indicates the given form.
* @param formBindingData Indicates the form data.
* @return -
*/
updateForm(formId: string, formBindingData: formBindingData.FormBindingData, callback: AsyncCallback<void>): void;
updateForm(formId: string, formBindingData: formBindingData.FormBindingData): Promise<void>;
}

83
api/application/MissionInfo.d.ts vendored Normal file
View File

@ -0,0 +1,83 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"),
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Want from "../@ohos.application.Want";
/**
* Mission information corresponding to ability.
*
* @since 8
* @sysCap AAFwk
* @devices phone, tablet, tv, wearable, car
* @permission N/A
* @systemapi hide for inner use.
*/
export interface MissionInfo {
/**
* Indicates mission id.
*
* @since 8
* @sysCap AAFwk
*/
missionId: number;
/**
* Indicates running state.
*
* @since 8
* @sysCap AAFwk
*/
runningState: number;
/**
* Indicates locked state.
*
* @since 8
* @sysCap AAFwk
*/
lockedState: number;
/**
* Indicates the recent create or update time of the mission.
*
* @since 8
* @sysCap AAFwk
*/
timestamp: string;
/**
* Indicates want of the mission.
*
* @since 8
* @sysCap AAFwk
*/
want: Want;
/**
* Indicates label of the mission.
*
* @since 8
* @sysCap AAFwk
*/
label: string;
/**
* Indicates icon path of the mission.
*
* @since 8
* @sysCap AAFwk
*/
iconPath: string;
}

66
api/application/MissionListener.d.ts vendored Normal file
View File

@ -0,0 +1,66 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"),
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* MissionListener registered by app.
*
* @name MissionListener
* @since 8
* @sysCap AAFwk
* @devices phone, tablet
* @permission N/A
* @systemapi hide for inner use.
*/
export interface MissionListener {
/**
* Called by system when mission created.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @return -
*/
onMissionCreated(mission: number): void;
/**
* Called by system when mission destroyed.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @return -
*/
onMissionDestroyed(mission: number): void;
/**
* Called by system when mission shapshot changed.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @return -
*/
onMissionSnapshotChanged(mission: number): void;
/**
* Called by system when mission moved to fornt.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @return -
*/
onMissionMovedToFront(mission: number): void;
}

44
api/application/MissionSnapshot.d.ts vendored Normal file
View File

@ -0,0 +1,44 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"),
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { ElementName } from '../bundle/elementName';
import { image } from '../@ohos.multimedia.image';
/**
* Mission snapshot corresponding to mission.
*
* @since 8
* @sysCap AAFwk
* @devices phone, tablet, tv, wearable, car
* @permission N/A
* @systemapi hide for inner use.
*/
export interface MissionSnapshot {
/**
* Indicates the ability elementName of the mission.
*
* @since 8
* @sysCap AAFwk
*/
ability: ElementName;
/**
* Indicates mission snapshot.
*
* @since 8
* @sysCap AAFwk
*/
snapshot: image.PixelMap;
}

55
api/application/ProcessData.d.ts vendored Normal file
View File

@ -0,0 +1,55 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"),
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* The process data.
*
* @since 8
* @sysCap appexecfwk
* @devices phone, tablet, tv, wearable, car
* @systemapi hide for inner use.
* @permission N/A
*/
export default class ProcessData {
/**
* The bundle name.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap appexecfwk
* @systemapi hide for inner use.
*/
bundleName: string;
/**
* The pid.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap appexecfwk
* @systemapi hide for inner use.
*/
pid: number;
/**
* The uid.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap appexecfwk
* @systemapi hide for inner use.
*/
uid: number;
}

View File

@ -0,0 +1,88 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"),
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { AsyncCallback } from "../basic";
import { ConnectOptions } from "../ability/connectOptions";
import ExtensionContext from "./ExtensionContext";
import Want from "../@ohos.application.Want";
import StartOptions from "../@ohos.application.StartOptions";
/**
* The context of service extension. It allows access to
* serviceExtension-specific resources.
*
* @since 8
* @sysCap AAFwk
* @devices phone, tablet, tv, wearable, car
* @systemapi hide for inner use.
* @permission N/A
*/
export default class ServiceExtensionContext extends ExtensionContext {
/**
* Service extension uses this method to start a specific ability.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @param parameter Indicates the ability to start.
* @systemapi hide for inner use.
* @return -
*/
startAbility(want: Want, callback: AsyncCallback<void>): void;
startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void>): void;
startAbility(want: Want, options?: StartOptions): Promise<void>;
/**
* Destroys this service extension.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @systemapi hide for inner use.
* @return -
*/
terminateSelf(callback: AsyncCallback<void>): void;
terminateSelf(): Promise<void>;
/**
* Connects an ability to a Service extension.
*
* <p>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.</p>
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @param request Indicates the service extension to connect.
* @systemapi hide for inner use.
* @return connection id, int value.
*/
connectAbility(want: Want, options: ConnectOptions): number;
/**
* Disconnects an ability to a service extension, in contrast to
* {@link connectAbility}.
*
* @devices phone, tablet, tv, wearable, car
* @since 8
* @sysCap AAFwk
* @param connection the connection id returned from connectAbility api.
* @systemapi hide for inner use.
* @return -
*/
disconnectAbility(connection: number, callback:AsyncCallback<void>): void;
disconnectAbility(connection: number): Promise<void>;
}

View File

@ -18,6 +18,7 @@ import image from '../@ohos.multimedia.image';
import { WantAgent } from '../@ohos.wantAgent';
import { NotificationContent } from './notificationContent';
import { NotificationActionButton } from './notificationActionButton';
import { NotificationTemplate } from './notificationTemplate';
/**
* Defines a NotificationRequest instance.
@ -189,4 +190,11 @@ export interface NotificationRequest {
* @systemapi Hide this for inner system use.
*/
readonly source?: number;
/**
* Obtains the template of this notification.
*
* @since 8
*/
template?: NotificationTemplate;
}

View File

@ -0,0 +1,35 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"),
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Describes a NotificationTemplate instance.
*
* @name NotificationTemplate
* @since 8
* @devices phone, tablet, tv, wearable, car
* @permission N/A
* @sysCap SystemCapability.Notification.ANS
*/
export interface NotificationTemplate {
/**
* Obtains the type of a notification template.
*/
name: string;
/**
* Obtains the data of a notification template.
*/
data: {[key: string]: Object};
}