From 895187db011cb6dc0c597ed0bba8204b25976d37 Mon Sep 17 00:00:00 2001 From: mgceshuang Date: Tue, 26 Jul 2022 10:32:42 +0800 Subject: [PATCH] AppReceovery Signed-off-by: mgceshuang --- api/@ohos.appRecovery.d.ts | 134 +++++ api/@ohos.application.Ability.d.ts | 651 +++++++++++---------- api/@ohos.application.AbilityConstant.d.ts | 211 ++++--- 3 files changed, 598 insertions(+), 398 deletions(-) create mode 100644 api/@ohos.appRecovery.d.ts diff --git a/api/@ohos.appRecovery.d.ts b/api/@ohos.appRecovery.d.ts new file mode 100644 index 0000000000..56e7a9fa76 --- /dev/null +++ b/api/@ohos.appRecovery.d.ts @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2022-2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * This module provides the capability to app receovery. + * + * @since 9 + * @syscap SystemCapability.HiviewDFX.Hiview.AppReceovery + * @import import sensor from '@ohos.appReceovery' + */ +declare namespace AppReceovery { + /** + * The type of no restart mode. + * @since 9 + * @syscap SystemCapability.HiviewDFX.Hiview.AppReceovery + */ + enum RestartFlags { + /** + * NONE: no restart restrictions + * @since 9 + */ + NONE = 0, + + /** + * CPP_CRASH_NO_RESTART: Do not restart if process terminates due to cpp exception + * @since 9 + */ + CPP_CRASH_NO_RESTART = 1, + + /** + * JS_CRASH_NO_RESTART: Do not restart if process terminates due to js/ts/ets exception + * @since 9 + */ + JS_CRASH_NO_RESTART = 2, + + /** + * APP_FREEZE_NO_RESTART: Do not restart if process terminates due to appliction not respondong + * @since 9 + */ + APP_FREEZE_NO_RESTART = 4, + + /** + * NO_RESTART: Do not restart + * @since 9 + */ + NO_RESTART = 0xFFFF, + } + + /** + * The type of when to save. + * @since 9 + * @syscap SystemCapability.HiviewDFX.Hiview.AppReceovery + */ + enum SaveFlags { + /** + * SAVE_DEFAULT is saving with default. + * @since 9 + */ + SAVE_DEFAULT = 0, + + /** + * SAVE_WHEN_ERROR is saving when an error occurs. + * @since 9 + */ + SAVE_WHEN_ERROR = 1, + + /** + * SAVE_WHEN_CREATE is saving on create. + * @since 9 + */ + SAVE_WHEN_CREATE = 2, + + /** + * SAVE_WHEN_CREATE is saving on background. + * @since 9 + */ + SAVE_WHEN_BACKGROUND = 4, + } + + /** + * The type of where to save. + * @since 9 + * @syscap SystemCapability.HiviewDFX.Hiview.AppReceovery + */ + enum SaveMode { + /** + * SAVE_DEFAULT is saving with default. + * @since 9 + */ + SAVE_DEFAULT = 0, + + /** + * SAVE_WITH_DB is saving to db. + * @since 9 + */ + SAVE_WITH_DB = 1, + + /** + * SAVE_WITH_FILE is saving to file. + * @since 9 + */ + SAVE_WITH_FILE = 2, + + /** + * SAVE_WITH_SHARED_MEMORY is saving to shared memory. + * @since 9 + */ + SAVE_WITH_SHARED_MEMORY = 4, + } + + /** + * Is app supports save and restore + * @since 9 + * @syscap SystemCapability.HiviewDFX.Hiview.AppReceovery + * @param restartFlags no restart mode + * @param saveFlags The type of When to save + * @param saveMode The type of where to save + */ + function enableAppRecovery(restartFlags: RestartFlags, saveFlags: SaveFlags, saveMode: SaveMode) : boolean; +} + +export default AppReceovery; diff --git a/api/@ohos.application.Ability.d.ts b/api/@ohos.application.Ability.d.ts index 4642593dcd..085225e91a 100755 --- a/api/@ohos.application.Ability.d.ts +++ b/api/@ohos.application.Ability.d.ts @@ -1,305 +1,346 @@ -/* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"), - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import AbilityConstant from "./@ohos.application.AbilityConstant"; -import AbilityContext from "./application/AbilityContext"; -import Want from './@ohos.application.Want'; -import window from './@ohos.window'; -import { Configuration } from './@ohos.application.Configuration'; -import rpc from './@ohos.rpc'; - -/** - * The prototype of the listener function interface registered by the Caller. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @permission N/A - * @param msg Monitor status notification information. - * @return - - * @StageModelOnly - */ -export interface OnReleaseCallBack { - (msg: string): void; -} - -/** - * The prototype of the message listener function interface registered by the Callee. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @permission N/A - * @param indata Notification data notified from the caller. - * @return rpc.Sequenceable - * @StageModelOnly - */ -export interface CalleeCallBack { - (indata: rpc.MessageParcel): rpc.Sequenceable; -} - -/** - * The interface of a Caller. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @permission N/A - * @StageModelOnly - */ -export interface Caller { - /** - * Notify the server of Sequenceable type data. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param method The notification event string listened to by the callee. - * @param data Notification data to the callee. - * @return - - * @StageModelOnly - */ - call(method: string, data: rpc.Sequenceable): Promise; - - /** - * Notify the server of Sequenceable type data and return the notification result. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param method The notification event string listened to by the callee. - * @param data Notification data to the callee. - * @return Returns the callee's notification result data on success, and returns undefined on failure. - * @StageModelOnly - */ - callWithResult(method: string, data: rpc.Sequenceable): Promise; - - /** - * Clear service records. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @return - - * @StageModelOnly - */ - release(): void; - - /** - * Register death listener notification callback. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param callback Register a callback function for listening for notifications. - * @return - - * @StageModelOnly - */ - onRelease(callback: OnReleaseCallBack): void; - } - - /** - * The interface of a Callee. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @permission N/A - * @StageModelOnly - */ -export interface Callee { - - /** - * Register data listener callback. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param method A string registered to listen for notification events. - * @param callback Register a callback function that listens for notification events. - * @return - - * @StageModelOnly - */ - on(method: string, callback: CalleeCallBack): void; - - /** - * Unregister data listener callback. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param method A string registered to listen for notification events. - * @return - - * @StageModelOnly - */ - off(method: string): void; - } - -/** - * The class of an ability. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @permission N/A - * @StageModelOnly - */ -export default class Ability { - /** - * Indicates configuration information about an ability context. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @StageModelOnly - */ - context: AbilityContext; - - /** - * Indicates ability launch want. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @StageModelOnly - */ - launchWant: Want; - - /** - * Indicates ability last request want. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @StageModelOnly - */ - lastRequestWant: Want; - - /** - * Call Service Stub Object. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @StageModelOnly - */ - callee: Callee; - - /** - * Called back when an ability is started for initialization. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param want Indicates the want info of the created ability. - * @param param Indicates the launch param. - * @return - - * @StageModelOnly - */ - onCreate(want: Want, param: AbilityConstant.LaunchParam): void; - - /** - * Called back when an ability window stage is created. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param windowStage Indicates the created WindowStage. - * @return - - * @StageModelOnly - */ - onWindowStageCreate(windowStage: window.WindowStage): void; - - /** - * Called back when an ability window stage is destroyed. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @return - - * @StageModelOnly - */ - onWindowStageDestroy(): void; - - /** - * Called back when an ability window stage is restored. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param windowStage window stage to restore - * @return - - * @StageModelOnly - */ - onWindowStageRestore(windowStage: window.WindowStage): void; - - /** - * Called back before an ability is destroyed. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @return - - * @StageModelOnly - */ - onDestroy(): void; - - /** - * Called back when the state of an ability changes to foreground. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @return - - * @StageModelOnly - */ - onForeground(): void; - - /** - * Called back when the state of an ability changes to background. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @return - - * @StageModelOnly - */ - onBackground(): void; - - /** - * Called back when an ability prepares to continue. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param wantParam Indicates the want parameter. - * @return 0 if ability agrees to continue and saves data successfully, otherwise errcode. - * @StageModelOnly - */ - 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. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param want Indicates the want info of ability. - * @param launchParams Indicates the launch parameters. - * @return - - * @StageModelOnly - */ - onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): void; - - /** - * Called when the system configuration is updated. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param config Indicates the updated configuration. - * @return - - * @StageModelOnly - */ - onConfigurationUpdated(config: Configuration): void; - - /** - * Called when dump client information is required. - * It is recommended that developers don't DUMP sensitive information. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore - * @param params Indicates the params from command. - * @return The dump info array. - * @StageModelOnly - */ - dump(params: Array): Array; -} +/* + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"), + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import AbilityConstant from "./@ohos.application.AbilityConstant"; +import AbilityContext from "./application/AbilityContext"; +import Want from './@ohos.application.Want'; +import window from './@ohos.window'; +import { Configuration } from './@ohos.application.Configuration'; +import rpc from './@ohos.rpc'; + +/** + * The prototype of the listener function interface registered by the Caller. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @permission N/A + * @param msg Monitor status notification information. + * @return - + * @StageModelOnly + */ +export interface OnReleaseCallBack { + (msg: string): void; +} + +/** + * The prototype of the message listener function interface registered by the Callee. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @permission N/A + * @param indata Notification data notified from the caller. + * @return rpc.Sequenceable + * @StageModelOnly + */ +export interface CalleeCallBack { + (indata: rpc.MessageParcel): rpc.Sequenceable; +} + +/** + * The interface of a Caller. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @permission N/A + * @StageModelOnly + */ +export interface Caller { + /** + * Notify the server of Sequenceable type data. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param method The notification event string listened to by the callee. + * @param data Notification data to the callee. + * @return - + * @StageModelOnly + */ + call(method: string, data: rpc.Sequenceable): Promise; + + /** + * Notify the server of Sequenceable type data and return the notification result. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param method The notification event string listened to by the callee. + * @param data Notification data to the callee. + * @return Returns the callee's notification result data on success, and returns undefined on failure. + * @StageModelOnly + */ + callWithResult(method: string, data: rpc.Sequenceable): Promise; + + /** + * Clear service records. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @return - + * @StageModelOnly + */ + release(): void; + + /** + * Register death listener notification callback. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param callback Register a callback function for listening for notifications. + * @return - + * @StageModelOnly + */ + onRelease(callback: OnReleaseCallBack): void; + } + + /** + * The interface of a Callee. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @permission N/A + * @StageModelOnly + */ +export interface Callee { + + /** + * Register data listener callback. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param method A string registered to listen for notification events. + * @param callback Register a callback function that listens for notification events. + * @return - + * @StageModelOnly + */ + on(method: string, callback: CalleeCallBack): void; + + /** + * Unregister data listener callback. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param method A string registered to listen for notification events. + * @return - + * @StageModelOnly + */ + off(method: string): void; + } + +/** + * The class of an ability. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @permission N/A + * @StageModelOnly + */ +export default class Ability { + /** + * Indicates configuration information about an ability context. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + */ + context: AbilityContext; + + /** + * Indicates ability launch want. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + */ + launchWant: Want; + + /** + * Indicates ability last request want. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + */ + lastRequestWant: Want; + + /** + * Call Service Stub Object. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + */ + callee: Callee; + + /** + * Called back when an ability is started for initialization. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param want Indicates the want info of the created ability. + * @param param Indicates the launch param. + * @return - + * @StageModelOnly + */ + onCreate(want: Want, param: AbilityConstant.LaunchParam): void; + + /** + * Called back when an ability window stage is created. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param windowStage Indicates the created WindowStage. + * @return - + * @StageModelOnly + */ + onWindowStageCreate(windowStage: window.WindowStage): void; + + /** + * Called back when an ability window stage is destroyed. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @return - + * @StageModelOnly + */ + onWindowStageDestroy(): void; + + /** + * Called back when an ability window stage is restored. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param windowStage window stage to restore + * @return - + * @StageModelOnly + */ + onWindowStageRestore(windowStage: window.WindowStage): void; + + /** + * Called back before an ability is destroyed. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @return - + * @StageModelOnly + */ + onDestroy(): void; + + /** + * Called back when the state of an ability changes to foreground. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @return - + * @StageModelOnly + */ + onForeground(): void; + + /** + * Called back when the state of an ability changes to background. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @return - + * @StageModelOnly + */ + onBackground(): void; + + /** + * Called back when an ability prepares to continue. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param wantParam Indicates the want parameter. + * @return 0 if ability agrees to continue and saves data successfully, otherwise errcode. + * @StageModelOnly + */ + 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. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param want Indicates the want info of ability. + * @param launchParams Indicates the launch parameters. + * @return - + * @StageModelOnly + */ + onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): void; + + /** + * Called when the system configuration is updated. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param config Indicates the updated configuration. + * @return - + * @StageModelOnly + */ + onConfigurationUpdated(config: Configuration): void; + + /** + * Called when dump client information is required. + * It is recommended that developers don't DUMP sensitive information. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param params Indicates the params from command. + * @return The dump info array. + * @StageModelOnly + */ + dump(params: Array): Array; + + /** + * Called back when an ability prepares to restore. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param reason state type when restore. + * @param wantParam Indicates the want parameter. + * @StageModelOnly + */ + onRestoreState(reason: AbilityConstant.StateType, wantParam : {[key: string]: any}): void; + + /** + * Called back when an ability prepares to save. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @param reason state type when restore. + * @param wantParam Indicates the want parameter. + * @return 0 if ability agrees to continue and saves data successfully, otherwise errcode. + * @StageModelOnly + */ + onSaveState(reason: AbilityConstant.StateType, wantParam : {[key: string]: any}): AbilityConstant.OnSaveResult; + + /** + * save data for manual storage. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + */ + SaveState(): void; + + /** + * restore data for manual storage. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore + * @StageModelOnly + */ + RestoreState(): void; +} diff --git a/api/@ohos.application.AbilityConstant.d.ts b/api/@ohos.application.AbilityConstant.d.ts index 518bac32dc..d26755bdbc 100644 --- a/api/@ohos.application.AbilityConstant.d.ts +++ b/api/@ohos.application.AbilityConstant.d.ts @@ -1,93 +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. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @permission N/A - * @StageModelOnly - */ -declare namespace AbilityConstant { - /** - * Interface of launch param. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly - */ - export interface LaunchParam { - /** - * Indicates launch reason. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly - */ - launchReason: LaunchReason; - - /** - * Indicates last exit reason. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly - */ - lastExitReason: LastExitReason; - } - - /** - * Type of launch reason. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly - */ - export enum LaunchReason { - UNKNOWN = 0, - START_ABILITY = 1, - CALL = 2, - CONTINUATION = 3, - } - - /** - * Type of last exit reason. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly - */ - export enum LastExitReason { - UNKNOWN = 0, - ABILITY_NOT_RESPONDING = 1, - NORMAL = 2, - } - - /** - * Type of onContinue result. - * - * @since 9 - * @syscap SystemCapability.Ability.AbilityRuntime.Core - * @StageModelOnly - */ - export enum OnContinueResult { - AGREE = 0, - REJECT = 1, - MISMATCH = 2, - } -} - -export default AbilityConstant +/* + * 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. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @permission N/A + * @StageModelOnly + */ +declare namespace AbilityConstant { + /** + * Interface of launch param. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ + export interface LaunchParam { + /** + * Indicates launch reason. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ + launchReason: LaunchReason; + + /** + * Indicates last exit reason. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ + lastExitReason: LastExitReason; + } + + /** + * Type of launch reason. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ + export enum LaunchReason { + UNKNOWN = 0, + START_ABILITY = 1, + CALL = 2, + CONTINUATION = 3, + } + + /** + * Type of last exit reason. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ + export enum LastExitReason { + UNKNOWN = 0, + ABILITY_NOT_RESPONDING = 1, + NORMAL = 2, + } + + /** + * Type of onContinue result. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ + export enum OnContinueResult { + AGREE = 0, + REJECT = 1, + MISMATCH = 2, + } + + /** + * Type of onSave result. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ + export enum OnSaveResult { + AGREE = 0, + REJECT = 1, + MISMATCH = 2, + } + + /** + * Type of state type. + * + * @since 9 + * @syscap SystemCapability.Ability.AbilityRuntime.Core + * @StageModelOnly + */ + export enum StateType { + MIGRATION = 0, + RECOVERY = 1, + } +} + +export default AbilityConstant -- Gitee