Ability Assistant

The ability assistant enables you to start applications and test cases. It provides basic application debugging and testing capabilities, for example, starting application components, forcibly stopping processes, and printing application component information.

NOTE

Before using this tool, you must obtain the hdc tool and run the hdc shell command.

  • help

    Displays help information for the Ability Assistant.

    Return value

    Returns the help information.

    Method

    aa help
    
  • start

    Starts an application component. The target component can be the PageAbility and ServiceAbility components of the FA model or the UIAbility and ServiceExtensionAbility components of the Stage model. The exported tag in the configuration file of the target component cannot be set to false.

Name Description
-h/--help Help information.
-d Device ID. Optional.
-a Ability name. Optional.
-b Bundle name. Optional.
-U URI. Optional.
-A Action. Optional.
-e Entity. Optional.
-t Type. Optional.
--pi Key-value pair of the integer type. Optional.
--pb Key-value pair of the Boolean type. Optional.
--ps Key-value pair of the string type. Optional.
--psn Keyword of an empty string. Optional.
-D Debugging mode. Optional.

Return value

Returns "start ability successfully." if the ability is started; returns "error: failed to start ability." and the corresponding error information otherwise.

Method

# Display the ability displayed.
aa start [-d <deviceId>] -a <abilityName> -b <bundleName> [-D] [--pi <key> <integer-value>] [--pb <key> <bool-value: true/false/t/f, case insensitive] [--ps <key> <value>] [--psn <key>]

# Implicitly start an ability. If none of the parameters in the command is set, the startup fails.
aa start [-d <deviceId>] [-U <URI>] [-t <type>] [-A <action>] [-e <entity>] [-D] [--pi <key> <integer-value>] [--pb <key> <bool-value: true/false/t/f, case insensitive] [--ps <key> <value>] [--psn <key>]
  • stop-service

    Stops a ServiceAbility.

Name Description
-h/--help Help information.
-d Device ID. Optional.
-a Ability name. Mandatory.
-b Bundle name. Mandatory.

Return value

Returns "stop service ability successfully." if the ServiceAbility is stopped; returns "error: failed to stop service ability." otherwise.

Method

aa stop-service [-d <deviceId>] -a <abilityName> -b <bundleName>
  • dump

    Prints information about an application component.

Name Level-2 Parameter Description
-h/--help - Help information.
-a/--all - Application component information in all missions.
-l/--mission-list type (All logs are printed if this parameter is left unspecified.) For better management, the service side maintains four types of MissionLists, as described below:
- NORMAL: MissionList that is started normally. For example, if A starts B and C, the corresponding MissionList is A->B->C.
- DEFAULT_STANDARD: If a MissionList is damaged, missions with the launch type set to multiton are removed to this MissionList. The Missions in it are not associated with each other.
- DEFAULT_SINGLE: If a MissionList is damaged, missions with the launch type set to singleton are removed to this MissionList. The Missions in it are not associated with each other.
- LAUNCHER: MissionList for launcher abilities.
-e/--extension elementName Extended component information.
-u/--userId UserId Mission stack information of a specified user ID. This parameter must be used together with other parameters. Example commands: aa dump -a -u 100 and aa dump -d -u 100.
-d/--data - DataAbility information.
-i/--ability AbilityRecord ID Detailed information about an application component.
-c/--client - Detailed information about an application component. This parameter must be used together with other parameters. Example commands: aa dump -a -c and aa dump -i 21 -c.

Method

aa dump -a

aa-dump-a

aa dump -l

aa-dump-l

aa dump -i 12

aa-dump-i

  • force-stop

    Forcibly stops a process based on the bundle name.

    Return value

    Returns "force stop process successfully." if the process is forcibly stopped; returns "error: failed to force stop process." otherwise.

    Method

    aa force-stop <bundleName>