ability-assistant-guidelines.md 3.8 KB
Newer Older
W
wusongqing 已提交
1 2 3 4
# Ability Assistant Usage

The ability assistant enables you to start applications, atomic services, and test cases and debug applications. By using this tool, you can send commands in the hdc shell to perform various system operations, such as starting abilities, forcibly stopping processes, and printing ability information.

W
wusongqing 已提交
5
## Query-related Commands
W
wusongqing 已提交
6 7 8

- **help**

9
  Displays help information for the ability assistant.
W
wusongqing 已提交
10 11 12 13 14 15 16 17 18 19 20

  **Return value**

  Returns the help information.

  **Method**

  ```
  aa help
  ```

W
wusongqing 已提交
21
## Ability-related Commands
W
wusongqing 已提交
22 23 24 25 26

- **start**

  Starts an ability.

W
wusongqing 已提交
27 28 29
  | Name     | Description                  |
  | --------- | -------------------------- |
  | -h/--help | Help information.                |
W
wusongqing 已提交
30
  | -d        | Device ID. This parameter is optional.   |
W
wusongqing 已提交
31
  | -a        | Ability name. This parameter is mandatory.|
W
wusongqing 已提交
32
  | -b        | Bundle name. This parameter is mandatory. |
W
wusongqing 已提交
33
  | -D        | Debugging mode. This parameter is optional.      |
W
wusongqing 已提交
34 35 36 37 38 39 40 41

  **Return value**

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

  **Method**

  ```
W
wusongqing 已提交
42
  aa start [-d <device-id>] -a <ability-name> -b <bundle-name> [-D]
W
wusongqing 已提交
43 44 45 46 47 48
  ```
  
- **stop-service**

  Stops a Service ability.

W
wusongqing 已提交
49
  | Name     | Description                |
W
wusongqing 已提交
50
  | --------- | ------------------------ |
W
wusongqing 已提交
51 52
  | -h/--help | Help information.              |
  | -d        | Device ID. This parameter is optional.   |
W
wusongqing 已提交
53
  | -a        | Ability name. This parameter is mandatory.|
W
wusongqing 已提交
54
  | -b        | Bundle name. This parameter is mandatory. |
W
wusongqing 已提交
55 56 57 58 59 60 61 62

  **Return value**

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

  **Method**

  ```
W
wusongqing 已提交
63
  aa stop-service [-d <device-id>] -a <ability-name> -b <bundle-name>
W
wusongqing 已提交
64 65 66 67
  ```
  
- **dump**

W
wusongqing 已提交
68
  Prints ability-related information.
W
wusongqing 已提交
69

W
wusongqing 已提交
70 71 72 73
  | Name             | Level-2 Parameter            | Description                                                    |
  | ----------------- | -------------------- | ------------------------------------------------------------ |
  | -h/--help         | -                    | Prints help information.                                                  |
  | -a/--all          | -                    | Prints ability information in all missions.                                |
W
wusongqing 已提交
74
  | -l/--mission-list | type (All logs are printed if this parameter is left unspecified.)| Prints mission stack information.<br>The following values are available for **type**:<br>- NORMAL <br>- DEFAULT_STANDARD<br>- DEFAULT_SINGLE<br>- LAUNCHER |
W
wusongqing 已提交
75
  | -e/--extension    | elementName          | Prints extended component information.                                          |
76 77 78 79
  | -u/--userId       | UserId               | Prints stack information of a specified user ID. This parameter must be used together with other parameters. <br/>Example commands: aa **dump -a -u 100** and **aa dump -d -u 100**.|
  | -d/--data         | -                    | Prints Data ability information.                                          |
  | -i/--ability      | AbilityRecord ID     | Prints detailed information about a specified ability.                                   |
  | -c/--client       | -                    | Prints detailed ability information. This parameter must be used together with other parameters. <br/>Example commands: **aa dump -a -c** and **aa dump -i 21 -c**.|
W
wusongqing 已提交
80
  
W
wusongqing 已提交
81
  **Method**
W
wusongqing 已提交
82
  
W
wusongqing 已提交
83 84 85
  ```
  aa dump -a
  ```
W
wusongqing 已提交
86
  ![aa-dump-a](figures/aa-dump-a.PNG)
W
wusongqing 已提交
87 88 89
  ```
  aa dump -l
  ```
W
wusongqing 已提交
90
  ![aa-dump-l](figures/aa-dump-l.PNG)
W
wusongqing 已提交
91 92 93
  ```
  aa dump -i 12
  ```
W
wusongqing 已提交
94
  ![aa-dump-i](figures/aa-dump-i.PNG)
W
wusongqing 已提交
95 96 97 98 99 100 101 102 103 104 105 106 107
- **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 <bundle-name>
  ```