ability-assistant-guidelines.md 4.0 KB
Newer Older
W
wusongqing 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
# 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.

## Development Guidelines

The ability assistant is pre-installed in the device environment. You can directly invoke the tool using commands.

### Query-related Commands

- **help**

  Displays the help information about the ability assistant.

  **Return value**

  Returns the help information.

  **Method**

  ```
  aa help
  ```

### Ability-related Commands

- **start**

  Starts an ability.

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

  **Return value**

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

  **Method**

  ```
W
wusongqing 已提交
46
  aa start [-d <device-id>] -a <ability-name> -b <bundle-name> [-D]
W
wusongqing 已提交
47 48 49 50 51 52
  ```
  
- **stop-service**

  Stops a Service ability.

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

  **Return value**

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

  **Method**

  ```
W
wusongqing 已提交
67
  aa stop-service [-d <device-id>] -a <ability-name> -b <bundle-name>
W
wusongqing 已提交
68 69 70 71 72 73
  ```
  
- **dump**

  Prints ability related information.

W
wusongqing 已提交
74 75 76 77 78 79 80 81 82 83 84
  | Name             | Level-2 Parameter            | Description                                                    |
  | ----------------- | -------------------- | ------------------------------------------------------------ |
  | -h/--help         | -                    | Prints help information.                                                  |
  | -a/--all          | -                    | Prints ability information in all missions.                                |
  | -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 |
  | -e/--extension    | elementName          | Prints extended component information.                                          |
  | -u/--userId       | UserId               | Prints 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         |                      | 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. Example commands: **aa dump -a -c** and **aa dump -i 21 -c**.|
  
W
wusongqing 已提交
85
  **Method**
W
wusongqing 已提交
86
  
W
wusongqing 已提交
87 88 89
  ```
  aa dump -a
  ```
W
wusongqing 已提交
90 91 92 93 94 95 96 97 98
  ![aa-dump-a](figures/aa-dump-a.png)
  ```
  aa dump -l
  ```
  ![aa-dump-l](figures/aa-dump-l.png)
  ```
  aa dump -i 12
  ```
![aa-dump-i](figures/aa-dump-i.png)
W
wusongqing 已提交
99 100 101 102 103 104 105 106 107 108 109 110 111
- **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>
  ```