mirror of
https://gitee.com/openharmony/interface_sdk-js
synced 2025-02-26 12:08:20 +00:00
add dfx recovery api
Signed-off-by: zhancaijin <zhancaijin1@huawei.com>
This commit is contained in:
parent
dab492d508
commit
3964aa91a7
12
api/@ohos.application.Ability.d.ts
vendored
Executable file → Normal file
12
api/@ohos.application.Ability.d.ts
vendored
Executable file → Normal file
@ -314,4 +314,16 @@ export default class Ability {
|
||||
* @StageModelOnly
|
||||
*/
|
||||
onMemoryLevel(level: AbilityConstant.MemoryLevel): void;
|
||||
|
||||
/**
|
||||
* Called back when an ability prepares to save.
|
||||
*
|
||||
* @since 9
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
|
||||
* @param reason state type when save.
|
||||
* @param wantParam Indicates the want parameter.
|
||||
* @return 0 if ability agrees to save data successfully, otherwise errcode.
|
||||
* @StageModelOnly
|
||||
*/
|
||||
onSaveState(reason: AbilityConstant.StateType, wantParam : {[key: string]: any}): AbilityConstant.OnSaveResult;
|
||||
}
|
||||
|
29
api/@ohos.application.AbilityConstant.d.ts
vendored
29
api/@ohos.application.AbilityConstant.d.ts
vendored
@ -61,6 +61,7 @@ declare namespace AbilityConstant {
|
||||
START_ABILITY = 1,
|
||||
CALL = 2,
|
||||
CONTINUATION = 3,
|
||||
APP_RECOVERY = 4,
|
||||
}
|
||||
|
||||
/**
|
||||
@ -116,6 +117,34 @@ declare namespace AbilityConstant {
|
||||
WINDOW_MODE_SPLIT_SECONDARY = 101,
|
||||
WINDOW_MODE_FLOATING = 102,
|
||||
}
|
||||
|
||||
/**
|
||||
* Type of onSave result.
|
||||
*
|
||||
* @since 9
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @StageModelOnly
|
||||
*/
|
||||
export enum OnSaveResult {
|
||||
ALL_AGREE = 0,
|
||||
CONTINUATION_REJECT = 1,
|
||||
CONTINUATION_MISMATCH = 2,
|
||||
RECOVERY_AGREE = 3,
|
||||
RECOVERY_REJECT = 4,
|
||||
ALL_REJECT,
|
||||
}
|
||||
|
||||
/**
|
||||
* Type of save state.
|
||||
*
|
||||
* @since 9
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.Core
|
||||
* @StageModelOnly
|
||||
*/
|
||||
export enum StateType {
|
||||
CONTINUATION = 0,
|
||||
APP_RECOVERY = 1,
|
||||
}
|
||||
}
|
||||
|
||||
export default AbilityConstant
|
||||
|
124
api/@ohos.application.appRecovery.d.ts
vendored
Normal file
124
api/@ohos.application.appRecovery.d.ts
vendored
Normal file
@ -0,0 +1,124 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* This module provides the capability to app receovery.
|
||||
*
|
||||
* @since 9
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.AppReceovery
|
||||
* @import appReceovery from '@ohos.appReceovery'
|
||||
*/
|
||||
declare namespace appReceovery {
|
||||
/**
|
||||
* The type of no restart mode.
|
||||
*
|
||||
* @since 9
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.AppReceovery
|
||||
*/
|
||||
enum RestartFlag {
|
||||
/**
|
||||
* NONE: no restart restrictions
|
||||
*/
|
||||
ALWAYS_RESTART = 0,
|
||||
|
||||
/**
|
||||
* CPP_CRASH_NO_RESTART: Do not restart if process terminates due to cpp exception
|
||||
*/
|
||||
CPP_CRASH_NO_RESTART = 0x0001,
|
||||
|
||||
/**
|
||||
* JS_CRASH_NO_RESTART: Do not restart if process terminates due to js/ts/ets exception
|
||||
*/
|
||||
JS_CRASH_NO_RESTART = 0x0002,
|
||||
|
||||
/**
|
||||
* APP_FREEZE_NO_RESTART: Do not restart if process terminates due to appliction not respondong
|
||||
*/
|
||||
APP_FREEZE_NO_RESTART = 0x0004,
|
||||
|
||||
/**
|
||||
* NO_RESTART: Do not restart
|
||||
*/
|
||||
NO_RESTART = 0xFFFF,
|
||||
}
|
||||
|
||||
/**
|
||||
* The type of when to save.
|
||||
*
|
||||
* @since 9
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.AppReceovery
|
||||
*/
|
||||
enum SaveOccasionFlag {
|
||||
/**
|
||||
* SAVE_WHEN_ERROR is saving when an error occurs.
|
||||
*/
|
||||
SAVE_WHEN_ERROR = 0x0001,
|
||||
|
||||
/**
|
||||
* SAVE_WHEN_CREATE is saving on background.
|
||||
*/
|
||||
SAVE_WHEN_BACKGROUND = 0x0002,
|
||||
}
|
||||
|
||||
/**
|
||||
* The type of where to save.
|
||||
*
|
||||
* @since 9
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.AppReceovery
|
||||
*/
|
||||
enum SaveModeFlag {
|
||||
/**
|
||||
* SAVE_WITH_FILE is saving to file.
|
||||
*/
|
||||
SAVE_WITH_FILE = 0x0001,
|
||||
|
||||
/**
|
||||
* SAVE_WITH_SHARED_MEMORY is saving to shared memory.
|
||||
*/
|
||||
SAVE_WITH_SHARED_MEMORY = 0x0002,
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable appRecovery and app supports save and restore
|
||||
*
|
||||
* @since 9
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.AppReceovery
|
||||
* @param restart no restart mode
|
||||
* @param saveOccasion The type of When to save
|
||||
* @param saveMode The type of where to save
|
||||
* @StageModelOnly
|
||||
*/
|
||||
function enableAppRecovery(restart?: RestartFlag, saveOccasion?: SaveOccasionFlag, saveMode?: SaveModeFlag) : void;
|
||||
|
||||
/**
|
||||
* Restart App when called
|
||||
*
|
||||
* @since 9
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.AppReceovery
|
||||
*/
|
||||
function restartApp(): void;
|
||||
|
||||
/**
|
||||
* Save App state data when called
|
||||
*
|
||||
* @since 9
|
||||
* @syscap SystemCapability.Ability.AbilityRuntime.AppReceovery
|
||||
* @return true if save data successfully, otherwise false
|
||||
* @StageModelOnly
|
||||
*/
|
||||
function saveAppState(): boolean;
|
||||
}
|
||||
|
||||
export default appReceovery;
|
Loading…
x
Reference in New Issue
Block a user