ohos.app.ability.ability_delegator_registry
Note:
Currently in the beta phase.
The AbilityDelegatorRegistry module provides the capability to store registered AbilityDelegator and AbilityDelegatorArgs objects in a global registry, including obtaining the application's AbilityDelegator object and unit test parameter objects. The interfaces in this module can only be used within test frameworks.
Import Module
import kit.TestKit.*
Usage Instructions
API sample code usage instructions:
- If the first line of sample code contains a "// index.cj" comment, it indicates that the example can be compiled and run in the "index.cj" file of the Cangjie template project.
- If the sample requires obtaining the Context application context, it needs to be configured in the "main_ability.cj" file of the Cangjie template project.
For the above sample project and configuration template details, refer to Cangjie Sample Code Instructions.
class AbilityDelegator
public class AbilityDelegator {}
Description: AbilityDelegator is used to create and manage an AbilityMonitor object (which monitors lifecycle state changes of a specified UIAbility), including adding and removing AbilityMonitor instances, waiting for UIAbility to reach the OnCreate lifecycle, setting wait time, obtaining the lifecycle state of a specified Ability, obtaining the top UIAbility of the current application, and starting a specified UIAbility.
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
func addAbilityMonitor(AbilityMonitor)
public func addAbilityMonitor(monitor: AbilityMonitor): Unit
Description: Adds an AbilityMonitor instance. Concurrent calls from multiple threads are not supported.
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
Parameters:
| Name | Type | Mandatory | Default Value | Description |
|---|---|---|---|---|
| monitor | AbilityMonitor | Yes | - | AbilityMonitor instance. |
Exceptions:
For detailed error codes, refer to Ability Subsystem Error Codes.
| Error Code ID | Error Message |
|---|---|
| 16000100 | AddAbilityMonitor failed. |
Example:
// index.cj
import kit.AbilityKit.*
import kit.TestKit.*
let delegator = AbilityDelegatorRegistry.getAbilityDelegator()
let monitor = AbilityMonitor(
"EntryAbility", moduleName: "entry",
onAbilityCreate: {ability => delegator.print("onAbilityCreate called, abilityName: ${ability.launchWant.abilityName}")}
)
delegator.addAbilityMonitor(monitor)
func addAbilityStageMonitor(AbilityStageMonitor)
public func addAbilityStageMonitor(monitor: AbilityStageMonitor): Unit
Description: Adds an AbilityStageMonitor object to monitor lifecycle state changes of a specified AbilityStage.
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
Parameters:
| Name | Type | Mandatory | Default Value | Description |
|---|---|---|---|---|
| monitor | AbilityStageMonitor | Yes | - | AbilityStageMonitor instance. |
Exceptions:
For detailed error codes, refer to Ability Subsystem Error Codes.
| Error Code ID | Error Message |
|---|---|
| 16000100 | AddAbilityStageMonitor failed. |
Example:
// index.cj
import kit.AbilityKit.*
import kit.TestKit.*
let delegator = AbilityDelegatorRegistry.getAbilityDelegator()
let monitor = AbilityStageMonitor("entry", "ohos_app_cangjie_entry.MyAbilityStage")
delegator.addAbilityStageMonitor(monitor)
func doAbilityBackground(UIAbility)
public func doAbilityBackground(ability: UIAbility): Unit
Description: Schedules the lifecycle state of a specified UIAbility to the Background state.
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
Parameters:
| Name | Type | Mandatory | Default Value | Description |
|---|---|---|---|---|
| ability | UIAbility | Yes | - | UIAbility object. |
Exceptions:
For detailed error codes, refer to Ability Subsystem Error Codes.
| Error Code ID | Error Message |
|---|---|
| 16000100 | DoAbilityBackground failed. |
Example:
// index.cj
import kit.AbilityKit.*
import kit.TestKit.*
let delegator = AbilityDelegatorRegistry.getAbilityDelegator()
let ability = delegator.getCurrentTopAbility()
delegator.doAbilityBackground(ability)
func doAbilityForeground(UIAbility)
public func doAbilityForeground(ability: UIAbility): Unit
Description: Schedules the lifecycle state of a specified UIAbility to the Foreground state.
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
Parameters:
| Name | Type | Mandatory | Default Value | Description |
|---|---|---|---|---|
| ability | UIAbility | Yes | - | UIAbility object. |
Exceptions:
For detailed error codes, refer to Ability Subsystem Error Codes.
| Error Code ID | Error Message |
|---|---|
| 16000100 | DoAbilityForeground failed. |
Example:
// index.cj
import kit.AbilityKit.*
import kit.TestKit.*
let delegator = AbilityDelegatorRegistry.getAbilityDelegator()
let ability = delegator.getCurrentTopAbility()
delegator.doAbilityForeground(ability)
func executeShellCommand(String, Int64)
public func executeShellCommand(ccmd: String, timeoutSecs!: Int64 = 0): ShellCmdResult
Description: Executes the specified Shell command.
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
Parameters:
| Name | Type | Mandatory | Default Value | Description |
|---|---|---|---|---|
| cmd | String | Yes | - | Shell command string. |
| timeoutSecs | Int64 | No | 0 | Sets the command timeout period in seconds (s). |
Return Value:
| Type | Description |
|---|---|
| ShellCmdResult | Returns the Shell command execution result as a ShellCmdResult object. |
Example:
// index.cj
import kit.AbilityKit.*
import kit.TestKit.*
let delegator = AbilityDelegatorRegistry.getAbilityDelegator()
let cmd = "cmd"
delegator.executeShellCommand(cmd, timeoutSecs: 2)
func finishTest(String, Int64)
public func finishTest(msg: String, code: Int64): Unit
Description: Ends the test and prints log information to the unit test terminal console.
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
Parameters:
| Name | Type | Mandatory | Default Value | Description |
|---|---|---|---|---|
| msg | String | Yes | - | Log string. |
| code | Int64 | Yes | - | Log code. |
Example:
// index.cj
import kit.AbilityKit.*
import kit.TestKit.*
let delegator = AbilityDelegatorRegistry.getAbilityDelegator()
let msg = "msg"
delegator.finishTest(msg, 0)
func getAbilityState(UIAbility)
public func getAbilityState(ability: UIAbility): AbilityLifecycleState
Description: Gets the lifecycle state of the specified ability.
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
Parameters:
| Name | Type | Mandatory | Default Value | Description |
|---|---|---|---|---|
| ability | UIAbility | Yes | - | Specified UIAbility object. |
Return Value:
| Type | Description |
|---|---|
| AbilityLifecycleState | Lifecycle state of the specified ability. |
Exceptions:
For detailed error codes, refer to Universal Error Codes.
| Error Code ID | Error Message |
|---|---|
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
Example:
// index.cj
import kit.AbilityKit.*
import kit.TestKit.*
let delegator = AbilityDelegatorRegistry.getAbilityDelegator()
let ability = delegator.getCurrentTopAbility()
delegator.getAbilityState(ability)
func getAppContext()
public func getAppContext(): Context
Description: Gets the application Context.
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
Return Value:
| Type | Description |
|---|---|
| Context | Application Context. |
Example:
// index.cj
import kit.AbilityKit.*
import kit.TestKit.*
let delegator = AbilityDelegatorRegistry.getAbilityDelegator()
let context = delegator.getAppContext()
func getCurrentTopAbility()
public func getCurrentTopAbility(): UIAbility
Description: Gets the top UIAbility of the current application.
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
Return Value:
| Type | Description |
|---|---|
| UIAbility | Returns the UIAbility instance. |
Exceptions:
For detailed error codes, refer to Ability Subsystem Error Codes.
| Error Code ID | Error Message |
|---|---|
| 16000100 | GetCurrentTopAbility failed. |
Example:
// index.cj
import kit.AbilityKit.*
import kit.TestKit.*
let delegator = AbilityDelegatorRegistry.getAbilityDelegator()
let ability = delegator.getCurrentTopAbility()
delegator.getAbilityState(ability)
func print(String)
public func print(msg: String): Unit
Description: Prints log information to the unit test terminal console.
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
Parameters:
| Name | Type | Mandatory | Default Value | Description |
|---|---|---|---|---|
| msg | String | Yes | - | Log string. |
Exceptions:
For detailed error codes, refer to Universal Error Codes.
| Error Code ID | Error Message |
|---|---|
| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. |
Example:
// index.cj
import kit.AbilityKit.*
import kit.TestKit.*
let delegator = AbilityDelegatorRegistry.getAbilityDelegator()
let msg = "msg"
delegator.print(msg)
func removeAbilityMonitor(AbilityMonitor)
public func removeAbilityMonitor(monitor: AbilityMonitor): Unit
Description: Removes an added AbilityMonitor object.
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
Parameters:
| Name | Type | Mandatory | Default Value | Description |
|---|---|---|---|---|
| monitor | AbilityMonitor | Yes | - | AbilityMonitor instance. |
Exceptions:
For detailed error codes, refer to Ability Subsystem Error Codes.
| Error Code ID | Error Message |
|---|---|
| 16000100 | RemoveAbilityMonitor failed. |
Example:
// index.cj
import kit.AbilityKit.*
import kit.TestKit.*
let delegator = AbilityDelegatorRegistry.getAbilityDelegator()
let monitor = AbilityMonitor(
"EntryAbility", moduleName: "entry",
onAbilityCreate: {ability => delegator.print("onAbilityCreate called, abilityName: ${ability.launchWant.abilityName}")}
)
delegator.removeAbilityMonitor(monitor)
func removeAbilityStageMonitor(AbilityStageMonitor)
public func removeAbilityStageMonitor(monitor: AbilityStageMonitor): Unit
Description: Removes an added AbilityStageMonitor object.
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
Parameters:
| Name | Type | Mandatory | Default Value | Description |
|---|---|---|---|---|
| monitor | AbilityStageMonitor | Yes | - | AbilityStageMonitor instance. |
Exceptions:
For detailed error codes, refer to Ability Subsystem Error Codes.
| Error Code ID | Error Message |
|---|---|
| 16000100 | RemoveAbilityStageMonitor failed. |
Example:
// index.cj
import kit.AbilityKit.*
import kit.TestKit.*
let delegator = AbilityDelegatorRegistry.getAbilityDelegator()
let monitor = AbilityStageMonitor("entry", "ohos_app_cangjie_entry.MyAbilityStage")
delegator.removeAbilityStageMonitor(monitor)
func startAbility(Want)
public func startAbility(want: Want): Unit
Description: Starts the specified UIAbility.
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
Parameters:
| Name | Type | Mandatory | Default Value | Description |
|---|---|---|---|---|
| want | Want | Yes | - | Parameters for starting the UIAbility. |
Example:
// index.cj
import kit.AbilityKit.*
import kit.TestKit.*
let delegator = AbilityDelegatorRegistry.getAbilityDelegator()
let want = Want(bundleName: "com.example.myapplication", abilityName: "EntryAbility")
delegator.startAbility(want)
func waitAbilityMonitor(AbilityMonitor, Int64)
public func waitAbilityMonitor(monitor: AbilityMonitor, timeout!: Int64 = 5000): UIAbility
Description: Sets the wait time and waits for the UIAbility matching the AbilityMonitor instance to reach the onCreate lifecycle, then returns the UIAbility instance.
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
Parameters:
| Name | Type | Mandatory | Default Value | Description |
|---|---|---|---|---|
| monitor | AbilityMonitor | Yes | - | [Ability```markdown |
class AbilityDelegatorArgs
public class AbilityDelegatorArgs {}
Description: Test parameter information.
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
prop bundleName
public mut prop bundleName: String
Description: Package name of the current application under test.
Type: String
Access: Read-Write
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
prop parameters
public mut prop parameters: HashMap<String,String>
Description: Parameters for launching the current unit test.
Type: HashMap<String,String>
Access: Read-Write
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
prop testCaseNames
public mut prop testCaseNames: String
Description: Test case names.
Type: String
Access: Read-Write
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
prop testRunnerClassName
public mut prop testRunnerClassName: String
Description: Name of the test runner that executes the test cases.
Type: String
Access: Read-Write
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
class AbilityDelegatorRegistry
public class AbilityDelegatorRegistry {}
Description: AbilityDelegatorRegistry provides the capability of a global registry for storing registered AbilityDelegator and AbilityDelegatorArgs objects.
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
static func getAbilityDelegator()
public static func getAbilityDelegator(): AbilityDelegator
Description: Obtains the AbilityDelegator object of the application, which can be used to dispatch test framework-related functionalities.
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
Return Value:
| Type | Description |
|---|---|
| AbilityDelegator | The AbilityDelegator object, which can be used to dispatch test framework-related functionalities. |
static func getArguments()
public static func getArguments(): AbilityDelegatorArgs
Description: Obtains the unit test parameter AbilityDelegatorArgs object.
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
Return Value:
| Type | Description |
|---|---|
| AbilityDelegatorArgs | The AbilityDelegatorArgs object, which can be used to obtain test parameters. |
Example:
// index.cj
import kit.TestKit.*
import kit.PerformanceAnalysisKit.*
let args = AbilityDelegatorRegistry.getArguments()
Hilog.info(0, "test", "args is ${args.bundleName}")
Hilog.info(0, "test", "args is ${args.testCaseNames}")
Hilog.info(0, "test", "args is ${args.testRunnerClassName}")
Hilog.info(0, "test", "args is ${args.parameters}")
class AbilityMonitor
public class AbilityMonitor {
public var abilityName: String
public var moduleName: String
public var onAbilityCreate:?(UIAbility) -> Unit
public var onAbilityForeground:?(UIAbility) -> Unit
public var onAbilityBackground:?(UIAbility) -> Unit
public var onAbilityDestroy:?(UIAbility) -> Unit
public var onWindowStageCreate:?(UIAbility) -> Unit
public var onWindowStageRestore:?(UIAbility) -> Unit
public var onWindowStageDestroy:?(UIAbility) -> Unit
public init(
abilityName: String,
moduleName!: String = "",
onAbilityCreate!: ?(UIAbility) -> Unit = None,
onAbilityForeground!: ?(UIAbility) -> Unit = None,
onAbilityBackground!: ?(UIAbility) -> Unit = None,
onAbilityDestroy!: ?(UIAbility) -> Unit = None,
onWindowStageCreate!: ?(UIAbility) -> Unit = None,
onWindowStageRestore!: ?(UIAbility) -> Unit = None,
onWindowStageDestroy!: ?(UIAbility) -> Unit = None
)
}
Description: The AbilityMonitor module provides the capability to match ability objects that meet specified conditions. The most recently matched ability object will be stored in AbilityMonitor.
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
var abilityName
public var abilityName: String
Description: Name of the ability bound to the current AbilityMonitor.
Type: String
Access: Read-Write
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
var moduleName
public var moduleName: String
Description: Name of the module bound to the current AbilityMonitor.
Type: String
Access: Read-Write
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
var onAbilityBackground
public var onAbilityBackground:?(UIAbility) -> Unit
Description: Callback function when the ability state changes to background. If this property is not set, the lifecycle callback will not be received.
Type: ?(UIAbility)->Unit
Access: Read-Write
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
var onAbilityCreate
public var onAbilityCreate:?(UIAbility) -> Unit
Description: Callback function when the ability is initialized. If this property is not set, the lifecycle callback will not be received.
Type: ?(UIAbility)->Unit
Access: Read-Write
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
var onAbilityDestroy
public var onAbilityDestroy:?(UIAbility) -> Unit
Description: Callback function before the ability is destroyed. If this property is not set, the lifecycle callback will not be received.
Type: ?(UIAbility)->Unit
Access: Read-Write
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
var onAbilityForeground
public var onAbilityForeground:?(UIAbility) -> Unit
Description: Callback function when the ability state changes to foreground. If this property is not set, the lifecycle callback will not be received.
Type: ?(UIAbility)->Unit
Access: Read-Write
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
var onWindowStageCreate
public var onWindowStageCreate:?(UIAbility) -> Unit
Description: Callback function when the window stage is created. If this property is not set, the lifecycle callback will not be received.
Type: ?(UIAbility)->Unit
Access: Read-Write
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
var onWindowStageDestroy
public var onWindowStageDestroy:?(UIAbility) -> Unit
Description: Callback function before the window stage is destroyed. If this property is not set, the lifecycle callback will not be received.
Type: ?(UIAbility)->Unit
Access: Read-Write
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
var onWindowStageRestore
public var onWindowStageRestore:?(UIAbility) -> Unit
Description: Callback function when the window stage is restored. If this property is not set, the lifecycle callback will not be received.
Type: ?(UIAbility)->Unit
Access: Read-Write
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
init(String, String, ?(UIAbility) -> Unit, ?(UIAbility) -> Unit, ?(UIAbility) -> Unit, ?(UIAbility) -> Unit, ?(UIAbility) -> Unit, ?(UIAbility) -> Unit, ?(UIAbility) -> Unit)
public init(
abilityName: String,
moduleName!: String = "",
onAbilityCreate!: ?(UIAbility) -> Unit = None,
onAbilityForeground!: ?(UIAbility) -> Unit = None,
onAbilityBackground!: ?(UIAbility) -> Unit = None,
onAbilityDestroy!: ?(UIAbility) -> Unit = None,
onWindowStageCreate!: ?(UIAbility) -> Unit = None,
onWindowStageRestore!: ?(UIAbility) -> Unit = None,
onWindowStageDestroy!: ?(UIAbility) -> Unit = None
)
Description: Constructs an AbilityMonitor object.
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
Parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| abilityName | String | Yes | - | Name of the ability bound to the current AbilityMonitor. |
| moduleName | String | No | "" | Named parameter. Name of the module bound to the current AbilityMonitor. |
| onAbilityCreate | ?(UIAbility) -> Unit | No | None | Named parameter. Callback function when the ability is initialized. None means this property is not set, and the lifecycle callback will not be received. |
| onAbilityForeground | ?(UIAbility) -> Unit | No | None | Named parameter. Callback function when the ability state changes to foreground. None means this property is not set, and the lifecycle callback will not be received. |
| onAbilityBackground | ?(UIAbility) -> Unit | No | None | Named parameter. Callback function when the ability state changes to background. None means this property is not set, and the lifecycle callback will not be received. |
| onAbilityDestroy | ?(UIAbility) -> Unit | No | None | Named parameter. Callback function before the ability is destroyed. None means this property is not set, and the lifecycle callback will not be received. |
| onWindowStageCreate | ?(UIAbility) -> Unit | No | None | Named parameter. Callback function when the window stage is created. None means this property is not set, and the lifecycle callback will not be received. |
| onWindowStageRestore | ?(UIAbility) -> Unit | No | None | Named parameter. Callback function when the window stage is restored. None means this property is not set, and the lifecycle callback will not be received. |
| onWindowStageDestroy | ?(UIAbility) -> Unit | No | None | Named parameter. Callback function before the window stage is destroyed. None means this property is not set, and the lifecycle callback will not be received. |
Example:
// index.cj
import kit.TestKit.*
let delegator = AbilityDelegatorRegistry.getAbilityDelegator()
let monitor = AbilityMonitor(
"EntryAbility", moduleName: "entry",
onAbilityCreate: {ability => delegator.print("onAbilityCreate called, abilityName: ${ability.launchWant.abilityName}")}
)
class AbilityStageMonitor
public class AbilityStageMonitor <: FFIData {
public var moduleName: String
public var srcEntrance: String
public init(
moduleName: String,
srcEntrance: String
)
}
Description: The AbilityStageMonitor module provides the capability to match AbilityStage objects that meet specified conditions. The most recently matched AbilityStage object will be stored in AbilityStageMonitor.
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
Parent Type:
- FFIData
var moduleName
public var moduleName: String
Description: Module name of the abilityStage to be monitored.
Type: String
Access: Read-Write
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
var srcEntrance
public var srcEntrance: String
Description: Source path of the abilityStage to be monitored.
Type: String
Access: Read-Write
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
init(String, String)
public init(
moduleName: String,
srcEntrance: String
)
Description: Constructs an AbilityStageMonitor object.
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
Parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| moduleName | String | Yes | - | Module name of the abilityStage to be monitored. |
| srcEntrance | String | Yes | - | Source path of the abilityStage to be monitored. |
Example:
// index.cj
import kit.AbilityKit.*
import kit.TestKit.*
let delegator = AbilityDelegatorRegistry.getAbilityDelegator()
let monitor = AbilityStageMonitor("entry", "ohos_app_cangjie_entry.MyAbilityStage")
delegator.addAbilityStageMonitor(monitor)
```## class ShellCmdResult
```cangjie
public class ShellCmdResult {}
Description: Shell command execution result.
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
prop exitCode
public mut prop exitCode: Int32
Description: Result code.
Type: Int32
Access: Read-write
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
prop stdResult
public mut prop stdResult: String
Description: Standard output content.
Type: String
Access: Read-write
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
enum AbilityLifecycleState
public enum AbilityLifecycleState <: Equatable<AbilityLifecycleState> & ToString {
| Uninitialized
| Create
| Foreground
| Background
| Destroy
| ...
}
Description: UIAbility lifecycle state. This enumeration type can be used with the getAbilityState method of AbilityDelegator to return different ability lifecycle states.
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
Parent Types:
- Equatable<AbilityLifecycleState>
- ToString
Background
Background
Description: Indicates the UIAbility is in background state.
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
Create
Create
Description: Indicates the UIAbility is in created state.
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
Destroy
Destroy
Description: Indicates the UIAbility is in destroyed state.
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
Foreground
Foreground
Description: Indicates the UIAbility is in foreground state.
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
Uninitialized
Uninitialized
Description: Indicates the UIAbility is in invalid state.
System Capability: SystemCapability.Ability.AbilityRuntime.Core
Since: 22
func !=(AbilityLifecycleState)
public operator func !=(other: AbilityLifecycleState): Bool
Description: Determines whether two enumeration values are unequal.
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| other | AbilityLifecycleState | Yes | - | Another enumeration value. |
Return Value:
| Type | Description |
|---|---|
| Bool | Returns true if the two enumeration values are unequal, otherwise returns false. |
func ==(AbilityLifecycleState)
public operator func ==(other: AbilityLifecycleState): Bool
Description: Determines whether two enumeration values are equal.
Parameters:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| other | AbilityLifecycleState | Yes | - | Another enumeration value. |
Return Value:
| Type | Description |
|---|---|
| Bool | Returns true if the two enumeration values are equal, otherwise returns false. |
func toString()
public func toString(): String
Description: Gets the string representation of the current enumeration.
Return Value:
| Type | Description |
|---|---|
| String | String representation of the current enumeration. |