@oniroproject/oniro-app 0.12.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +101 -26
- package/dist/oniro-app.js +444 -42
- package/dist/oniro-app.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -45,8 +45,8 @@ Once a device or emulator is connected you can inspect and drive it:
|
|
|
45
45
|
```bash
|
|
46
46
|
oniro-app devices --json
|
|
47
47
|
oniro-app screenshot -o shot.jpeg
|
|
48
|
-
oniro-app dump layout --
|
|
49
|
-
oniro-app input --type click --
|
|
48
|
+
oniro-app dump layout --flat
|
|
49
|
+
oniro-app input --type click --target "Sign in"
|
|
50
50
|
oniro-app watch --log 'error|fault' --for 5000 --json
|
|
51
51
|
```
|
|
52
52
|
|
|
@@ -69,7 +69,7 @@ Install commands are idempotent (they skip when already present); pass `--force`
|
|
|
69
69
|
| Command | Description |
|
|
70
70
|
| --- | --- |
|
|
71
71
|
| `cmdtools install [--from-zip <path>] [--force] [--tmp-dir <path>]` | Install the tools. `--from-zip` installs from a local archive instead of downloading (required on Windows/macOS — see [Configuration](#configuration)); `--tmp-dir` overrides where download/extract temporaries go (see [Temporary space](#temporary-space)). |
|
|
72
|
-
| `cmdtools status [--json]` | Report whether the tools are installed
|
|
72
|
+
| `cmdtools status [--json]` | Report whether the tools are installed, their version, their flavour (`HarmonyOS` when they bundle `sdk/default/hms`, as the Huawei developer-portal download does, else `OpenHarmony`), and the `hdc` binary every device command uses. Exits non-zero when not installed. |
|
|
73
73
|
| `cmdtools remove` | Delete the configured command-line-tools directory. |
|
|
74
74
|
|
|
75
75
|
#### `emulator` — manage the Oniro emulator (QEMU-based)
|
|
@@ -78,6 +78,7 @@ Install commands are idempotent (they skip when already present); pass `--force`
|
|
|
78
78
|
| --- | --- |
|
|
79
79
|
| `emulator install [--force] [--tmp-dir <path>]` | Download and install the emulator. `--tmp-dir` overrides where the downloaded ZIP goes (see [Temporary space](#temporary-space)). |
|
|
80
80
|
| `emulator start [options]` | Start the emulator via the bundled launcher and detach, so the CLI can exit while it keeps running. |
|
|
81
|
+
| `emulator status [--address <host:port>] [--json]` | Report whether the emulator is installed, running, and connected to `hdc`, without starting it. Exits non-zero when not installed. DevEco Studio's HarmonyOS emulator is not covered; it shows up in `devices`. |
|
|
81
82
|
| `emulator stop` | Kill running emulator processes. |
|
|
82
83
|
| `emulator connect [--address <host:port>]` | Attempt an `hdc` connection (default `127.0.0.1:55555`). |
|
|
83
84
|
| `emulator remove` | Delete the configured emulator directory. |
|
|
@@ -126,13 +127,14 @@ Only needed for HarmonyOS signing; see [HarmonyOS apps](#harmonyos-apps).
|
|
|
126
127
|
|
|
127
128
|
#### `sign` — generate signing keys, certs, and `signingConfigs`
|
|
128
129
|
|
|
129
|
-
`sign [project-dir]` (defaults to the current directory). Requires `java` on `PATH`. Rewrites
|
|
130
|
+
`sign [project-dir]` (defaults to the current directory). Requires `java` on `PATH`. Rewrites the `signingConfigs` block of `build-profile.json5`, and points any product that names no `signingConfig` at the generated one (other keys are preserved). The generated profile uses the SDK's built-in development cert (`issuer=pki_internal`) and its validity window — **dev/local builds only, not distribution.** See [Signing apps that need system permissions](#signing-apps-that-need-system-permissions) for `--apl` / `--acls`.
|
|
130
131
|
|
|
131
132
|
| Flag | Description |
|
|
132
133
|
| --- | --- |
|
|
133
134
|
| `--apl <level>` | Ability Privilege Level: `normal` (default), `system_basic`, or `system_core`. |
|
|
134
135
|
| `--app-feature <feature>` | `hos_normal_app` or `hos_system_app`. Defaults follow `--apl`. |
|
|
135
136
|
| `--acls <list>` | Comma-separated permissions to write into the profile's `acls.allowed-acls`. |
|
|
137
|
+
| `--app-privilege-capabilities <list>` | Comma-separated privileges to write into the profile's `app-privilege-capabilities`, e.g. `AllowAppUsePrivilegeExtension` for an app with a privileged extension ability (without it, install fails with `9568344 not allow use privilege extension`). |
|
|
136
138
|
| `--bootstrap` | No-op if signing material is already present; otherwise generate it. |
|
|
137
139
|
| `--harmonyos` | Sign a HarmonyOS project via AppGallery Connect instead of the offline flow. See [HarmonyOS apps](#harmonyos-apps). |
|
|
138
140
|
| `--team-id <id>` | With `--harmonyos`: AGC team to sign under. |
|
|
@@ -142,7 +144,7 @@ Only needed for HarmonyOS signing; see [HarmonyOS apps](#harmonyos-apps).
|
|
|
142
144
|
|
|
143
145
|
#### `build` — build the app via `hvigorw`
|
|
144
146
|
|
|
145
|
-
`build [project-dir]` (defaults to the current directory). Modules build in parallel by default.
|
|
147
|
+
`build [project-dir]` (defaults to the current directory). Modules build in parallel by default. An OpenHarmony project whose `compileSdkVersion` SDK is not installed fails before anything runs, naming the release to install. When the compiler output shows system-API errors (`'…' is not exported from Kit '…'`), the error adds a hint about the full SDK.
|
|
146
148
|
|
|
147
149
|
| Flag | Description |
|
|
148
150
|
| --- | --- |
|
|
@@ -152,34 +154,35 @@ Only needed for HarmonyOS signing; see [HarmonyOS apps](#harmonyos-apps).
|
|
|
152
154
|
| `--task <task>` | hvigor task to run (default `assembleHap`). |
|
|
153
155
|
| `--no-deps` | Skip the automatic `ohpm install --all` when `oh_modules/` is missing. |
|
|
154
156
|
| `--no-parallel` | Build modules serially. |
|
|
157
|
+
| `--install-sdk` | Install the missing OpenHarmony SDK the project compiles against, then build. |
|
|
155
158
|
| `--json` | Emit the result (discovered HAPs grouped by module, warnings) as JSON. |
|
|
156
159
|
|
|
157
160
|
#### `lint` — run the OpenHarmony codelinter
|
|
158
161
|
|
|
159
|
-
`lint [project-dir]` (defaults to the current directory). Exits
|
|
162
|
+
`lint [project-dir]` (defaults to the current directory). Prints each finding as `file:line:col severity message [rule]`, then the totals (`N defects: E errors, W warnings, S suggestions.`). Exits 1 on error-severity findings or when codelinter fails to produce a report; warnings alone exit 0, although codelinter itself exits 1 for them. When codelinter says its report is incomplete, for example because the command-line tools' flavour (see `cmdtools status`) does not match the project's `runtimeOS`, a warning on stderr explains it: treat the counts as a lower bound.
|
|
160
163
|
|
|
161
164
|
| Flag | Description |
|
|
162
165
|
| --- | --- |
|
|
163
166
|
| `--files <globs...>` | Specific files/globs to lint (default: the whole project). |
|
|
164
|
-
| `--json` | Emit
|
|
167
|
+
| `--json` | Emit the report as JSON: `findings`, `summary` (codelinter's totals), `notices`, `incomplete`, `code`, and the cleaned `raw` output. |
|
|
165
168
|
|
|
166
169
|
### Device & app
|
|
167
170
|
|
|
168
|
-
These commands target a connected device or emulator over `hdc`. Most accept `--device <serial>` to address a specific target
|
|
171
|
+
These commands target a connected device or emulator over `hdc`. Most accept `--device <serial>` to address a specific target. Without it they use `ONIRO_DEVICE_SERIAL`, then the single connected device. A TCP serial such as `127.0.0.1:5555` works like a USB one. hdc exits 0 even when it fails (`[Fail]ExecuteCommand need connect-key?` when several targets are connected and none was named); every command here reports that as an error.
|
|
169
172
|
|
|
170
173
|
#### `devices` — list connected hdc devices
|
|
171
174
|
|
|
172
175
|
| Command | Description |
|
|
173
176
|
| --- | --- |
|
|
174
|
-
| `devices [--json]` | List connected targets (`serial`, connection, status). |
|
|
177
|
+
| `devices [--long] [--json]` | List connected targets (`serial`, connection, status). `--long` also asks each connected one for its OS family and version (`os=HarmonyOS 6.1.0` / `os=OpenHarmony`), API level, CPU ABI, device type, model, and `const.ohos.fullname`. |
|
|
175
178
|
|
|
176
179
|
#### `app` — install, launch, and manage built apps
|
|
177
180
|
|
|
178
181
|
| Command | Description |
|
|
179
182
|
| --- | --- |
|
|
180
|
-
| `app install [project-dir] [--hap <path>] [--device <serial>]` | Install
|
|
183
|
+
| `app install [project-dir \| file.hap] [--hap <path>] [--device <serial>]` | Install a `.hap` via `hdc`: a given file, else the project's newest signed HAP, else its unsigned one (a `*-signed.hap` path that does not exist falls back to its `*-unsigned.hap`). Fails when the bundle manager rejects the HAP; when a target refuses an unsigned HAP, the error gives the bundle manager's reason and the `sign` command to run. |
|
|
181
184
|
| `app launch [project-dir] [--module <m>] [--ability <name>] [--device <serial>]` | Launch the app. `--ability` defaults to the module's `mainElement` / first visible ability. |
|
|
182
|
-
| `app apply [project-dir] --bundle <b> [options]` | Install a HAP **and verify the
|
|
185
|
+
| `app apply [project-dir] --bundle <b> [options]` | Install a HAP **and verify it took**: fails when the bundle manager rejects it or `bm dump` does not then list the bundle, and handles sign-info mismatch, asset-cache invalidation, and persistent-bundle restart. Uses the newest signed HAP, else the unsigned one, and explains a target's refusal of an unsigned HAP like `app install`. |
|
|
183
186
|
| `app uninstall <bundle> [--device <serial>]` | Uninstall an app by bundle name. |
|
|
184
187
|
| `app stop <bundle> [--device <serial>]` | Force-stop an app by bundle name. |
|
|
185
188
|
|
|
@@ -200,9 +203,33 @@ These commands target a connected device or emulator over `hdc`. Most accept `--
|
|
|
200
203
|
|
|
201
204
|
| Command | Description |
|
|
202
205
|
| --- | --- |
|
|
203
|
-
| `file send <local> <remote> [--device <serial>]` | Push a local file to the device. |
|
|
206
|
+
| `file send <local> <remote> [--bundle <b>] [--device <serial>]` | Push a local file to the device and print the device path. With `--bundle`, `<remote>` may be relative to that app's sandbox (`files/x` is its application-level `filesDir`, `haps/entry/files/x` the entry module's), and the file is chowned to the app, which cannot read root-owned files. |
|
|
204
207
|
| `file recv <remote> <local> [--device <serial>]` | Pull a file from the device. |
|
|
205
208
|
|
|
209
|
+
Local paths may be relative, or absolute with either slash. A device path that a Windows shell already rewrote (Git Bash turns `/data/local/tmp/x` into `C:/Program Files/Git/data/local/tmp/x`) is rejected: run the command with `MSYS_NO_PATHCONV=1`.
|
|
210
|
+
|
|
211
|
+
#### `logs` — capture hilog to a file for a whole session
|
|
212
|
+
|
|
213
|
+
`logs -o <file>` streams hilog into `<file>` until `--for` elapses or the process is interrupted, so start it in the background. The device's log buffer is small (256 KB per type by default) and chatty components such as ArkWeb wrap it within seconds, so a dump at the end of a session loses its start. Every line is written as it arrives, and the stream reconnects after a reboot.
|
|
214
|
+
|
|
215
|
+
| Flag | Description |
|
|
216
|
+
| --- | --- |
|
|
217
|
+
| `-o, --output <file>` | **Required.** File to append to. |
|
|
218
|
+
| `--for <ms>` | Stop after this long (default: until interrupted). |
|
|
219
|
+
| `--grep <regex>` | Keep only matching lines (default: all). |
|
|
220
|
+
| `--clear` | Clear the device log buffer first (`hilog -r`), so the file covers only this session. |
|
|
221
|
+
| `--domain <domain>` | hilog domain filter (e.g. `0xD003900`). |
|
|
222
|
+
| `--device <serial>` | Target device serial. |
|
|
223
|
+
|
|
224
|
+
#### `hdc` — run the bundled hdc
|
|
225
|
+
|
|
226
|
+
`hdc [args...]` runs the `hdc` binary oniro-app itself uses (the one `cmdtools status` shows), with stdio passed through, so it needs nothing on `PATH`. Device commands are addressed at `--device` or `ONIRO_DEVICE_SERIAL` unless the arguments start with `-t`. `hdc --path` prints the binary's location. The exit code is hdc's own, which is 0 even for a `[Fail]` line.
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
oniro-app hdc shell param get const.ohos.apiversion
|
|
230
|
+
oniro-app hdc --device 127.0.0.1:5555 shell aa dump -l
|
|
231
|
+
```
|
|
232
|
+
|
|
206
233
|
#### `reboot` — reboot the device
|
|
207
234
|
|
|
208
235
|
| Flag | Description |
|
|
@@ -214,7 +241,7 @@ These commands target a connected device or emulator over `hdc`. Most accept `--
|
|
|
214
241
|
|
|
215
242
|
#### `wait` — wait for a device condition
|
|
216
243
|
|
|
217
|
-
Specify exactly one of `--log`, `--boot`, or `--
|
|
244
|
+
Specify exactly one of `--log`, `--boot`, `--bundle`, or an element selector (`--target` / `--target-id` / `--target-type`).
|
|
218
245
|
|
|
219
246
|
| Flag | Description |
|
|
220
247
|
| --- | --- |
|
|
@@ -223,9 +250,13 @@ Specify exactly one of `--log`, `--boot`, or `--bundle`.
|
|
|
223
250
|
| `--bundle <bundle>` | With `--log`: filter to this bundle. Alone: wait until this bundle is running. |
|
|
224
251
|
| `--pid-of <name>` | With `--boot`: also require this process to have a pid. |
|
|
225
252
|
| `--domain <domain>` | With `--log`: hilog domain filter (e.g. `0xD003900`). |
|
|
253
|
+
| `--target <text>` | Resolve when an uncovered element whose text, description, or placeholder matches is on screen (case-insensitive; exact matches win, else substring). |
|
|
254
|
+
| `--target-id <id>` / `--target-type <type>` | Match the element by id/key, or restrict it to a component type (e.g. `Button`). |
|
|
255
|
+
| `--gone` | With a selector: resolve when no uncovered element matches any more. |
|
|
256
|
+
| `--interval <ms>` | With a selector: poll interval (default `500`; each poll is a layout dump). |
|
|
226
257
|
| `--timeout <ms>` | Max wait (default `30000`). |
|
|
227
258
|
| `--device <serial>` | Target device serial. |
|
|
228
|
-
| `--json` | With `--log
|
|
259
|
+
| `--json` | With `--log` or a selector: emit the matched entry or element as JSON. |
|
|
229
260
|
|
|
230
261
|
#### `watch` — collect matching hilog lines for a fixed duration
|
|
231
262
|
|
|
@@ -241,50 +272,82 @@ Specify exactly one of `--log`, `--boot`, or `--bundle`.
|
|
|
241
272
|
|
|
242
273
|
#### `screenshot` — capture the screen as a JPEG
|
|
243
274
|
|
|
244
|
-
Default: writes the full-resolution raw JPEG. `--grid` reproduces the old MCP screenshot (downscaled + grid overlay). `--contact-sheet` captures a burst (default 8 frames) into one tiled sheet and prints per-frame diffs (0..1) on stdout — one image instead of N, pointing you at the frame where something changed.
|
|
275
|
+
Default: writes the full-resolution raw JPEG. `--grid` reproduces the old MCP screenshot (downscaled + grid overlay). `--crop` / `--target` write a full-resolution crop of one region or element — detail where it is needed without the cost of a full-resolution screenshot. `--contact-sheet` captures a burst (default 8 frames) into one tiled sheet and prints per-frame diffs (0..1) on stdout — one image instead of N, pointing you at the frame where something changed.
|
|
245
276
|
|
|
246
277
|
| Flag | Description |
|
|
247
278
|
| --- | --- |
|
|
248
279
|
| `-o, --output <file>` | Output path (default `screenshot.jpeg`). |
|
|
249
280
|
| `--grid` | Downscale to `--max-dim` and overlay a 10x10 grid (axes 0.0–1.0) for picking tap coordinates. |
|
|
250
|
-
| `--max-dim <px>` | Longest-side cap for `--grid` / `--contact-sheet` (256–4096, default `1024`). On its own, downscales without a grid. |
|
|
281
|
+
| `--max-dim <px>` | Longest-side cap for `--grid` / `--crop` / `--target` / `--contact-sheet` (256–4096, default `1024`). On its own, downscales without a grid. |
|
|
282
|
+
| `--crop <x1,y1,x2,y2>` | Crop to this region, given as 0–1 fractions of the screen (as in `dump layout` and the grid). |
|
|
283
|
+
| `--target <text>` | Crop to the element whose text, description, or placeholder matches, plus a small margin. Also `--target-id`, `--target-type`, `--target-index`. |
|
|
251
284
|
| `--contact-sheet` | Capture a burst and composite it into one tiled image with per-frame change diffs. |
|
|
252
285
|
| `--burst <count>` | Capture N frames; writes `<base>-<i><ext>` (or sets the `--contact-sheet` frame count). |
|
|
253
286
|
| `--interval <ms>` | Delay between burst frames (default `50`). |
|
|
254
287
|
| `--json` | With `--contact-sheet`, emit the full result object as JSON on stdout. |
|
|
255
288
|
| `--device <serial>` | Target device serial. |
|
|
256
289
|
|
|
257
|
-
#### `dump` — dump device state
|
|
290
|
+
#### `dump` — dump device state
|
|
258
291
|
|
|
259
292
|
| Command | Description |
|
|
260
293
|
| --- | --- |
|
|
261
|
-
| `dump [layout]` | Dump the on-screen UI layout (the default and currently only target)
|
|
294
|
+
| `dump [layout]` | Dump the on-screen UI layout (the default and currently only target) to stdout: a pruned, 0–1-normalized JSON tree, or one line per element with `--flat`. |
|
|
262
295
|
|
|
263
296
|
| Flag | Description |
|
|
264
297
|
| --- | --- |
|
|
265
298
|
| `--bundle <bundle>` | Filter the layout to a single window/bundle. |
|
|
266
|
-
| `--
|
|
299
|
+
| `--flat` | One line per labelled or interactive element, grouped by window: type, label, `#id`, center `c=x,y` (0–1 fractions), and flags (`click`, `focus`, `disabled`, `covered`, …). The soft keyboard collapses to one `[keyboard …]` line. |
|
|
300
|
+
| `--raw` | Return the unpruned tree (no keyboard detection; not combinable with `--flat`). |
|
|
267
301
|
| `--device <serial>` | Target device serial. |
|
|
268
302
|
|
|
303
|
+
The pruned output marks elements as `covered` when a later layer with a visible background (a dialog scrim, an overlay, the keyboard) paints over their center, so a tap there would land on that layer instead. A fully transparent layer that only intercepts touches is not detected. Placeholder text is reported as `hint`, and disabled components as `disabled`. The JSON result also carries `keyboard: { shown, bundle, b }`.
|
|
304
|
+
|
|
305
|
+
```text
|
|
306
|
+
$ oniro-app dump layout --flat
|
|
307
|
+
# display 1080x2400; c = element center as 0-1 fractions (input --fx/--fy), or act by label with input --target "<text>"
|
|
308
|
+
[window com.example.app]
|
|
309
|
+
Text "Sign in" c=0.500,0.180
|
|
310
|
+
TextInput hint="you@example.com" c=0.500,0.320 click focus
|
|
311
|
+
Button "Sign in" c=0.500,0.520 click
|
|
312
|
+
[keyboard dev.patrickgold.florisboard] up — dismiss with input --type hideKeyboard
|
|
313
|
+
```
|
|
314
|
+
|
|
269
315
|
#### `input` / `gesture` — inject UI input
|
|
270
316
|
|
|
271
|
-
`input` injects a single event
|
|
317
|
+
`input` injects a single event via `uitest uiInput`. Give the start point one way: an on-screen element (`--target`), 0–1 fractions of the display (`--fx`/`--fy`, as read from `dump layout` or the screenshot grid), or pixels (`--x`/`--y`).
|
|
272
318
|
|
|
273
319
|
| Flag | Description |
|
|
274
320
|
| --- | --- |
|
|
275
|
-
| `--type <type>` | **Required.** One of `click`, `doubleClick`, `longClick`, `swipe`, `drag`, `fling`, `keyEvent`, `inputText`. |
|
|
276
|
-
| `--
|
|
277
|
-
| `--
|
|
321
|
+
| `--type <type>` | **Required.** One of `click`, `doubleClick`, `longClick`, `swipe`, `drag`, `fling`, `keyEvent`, `inputText`, `clearText`, `hideKeyboard`. |
|
|
322
|
+
| `--target <text>` | Act on the center of the element whose text, description, or placeholder matches (case-insensitive; exact matches win, else substring). Covered elements and soft-keyboard keys are skipped and clickable ones preferred; if the keyboard hides the element, it is dismissed first. |
|
|
323
|
+
| `--target-id <id>` / `--target-type <type>` | Match by id/key, or restrict to a component type (e.g. `Button`, `TextInput`). |
|
|
324
|
+
| `--target-index <n>` | Pick the n-th (0-based) of several matching elements; without it, an ambiguous match fails and lists the candidates. |
|
|
325
|
+
| `--fx <fraction>` / `--fy <fraction>` | Start point as 0–1 fractions of the display. |
|
|
326
|
+
| `--fx2 <fraction>` / `--fy2 <fraction>` | End point as fractions (swipe / drag / fling). |
|
|
327
|
+
| `--x <px>` / `--y <px>` | Start point in pixels. |
|
|
328
|
+
| `--x2 <px>` / `--y2 <px>` | End point in pixels (swipe / drag / fling). |
|
|
278
329
|
| `--speed <px-per-s>` | Velocity for swipe / drag / fling. |
|
|
279
|
-
| `--key <key>` |
|
|
330
|
+
| `--key <key>` | For `keyEvent`: `Back` / `Home` / `Power`, a name (`Delete`, `Enter`, `Tab`, `Escape`, `MoveHome`, `MoveEnd`, `ForwardDelete`, …), a letter, a KeyCode id, or a combo of up to three keys like `Ctrl+A`. |
|
|
280
331
|
| `--text <text>` | Text for `inputText`. |
|
|
332
|
+
| `--clear` | `inputText`: clear the field (Ctrl+A, Delete) before typing. |
|
|
333
|
+
| `--hide-keyboard` | Dismiss the soft keyboard afterwards, if it is up. |
|
|
281
334
|
| `--device <serial>` | Target device serial. |
|
|
282
335
|
|
|
336
|
+
`clearText` taps the field, then sends Ctrl+A and Delete. `hideKeyboard` presses Back only when the soft keyboard is on screen, so it never navigates away.
|
|
337
|
+
|
|
338
|
+
```bash
|
|
339
|
+
oniro-app input --type inputText --target "you@example.com" --text 'me@example.com'
|
|
340
|
+
oniro-app input --type inputText --target-id password --clear --text 'secret' --hide-keyboard
|
|
341
|
+
oniro-app input --type click --target "Sign in" --target-type Button
|
|
342
|
+
oniro-app input --type swipe --fx 0.5 --fy 0.8 --fx2 0.5 --fy2 0.3
|
|
343
|
+
```
|
|
344
|
+
|
|
283
345
|
`gesture` injects a multi-waypoint path:
|
|
284
346
|
|
|
285
347
|
| Flag | Description |
|
|
286
348
|
| --- | --- |
|
|
287
349
|
| `--waypoints <json>` | **Required.** JSON array of pixel waypoints `[{"x":..,"y":..,"t":..}]` (`t` = ms from start). |
|
|
350
|
+
| `--fractions` | Waypoint `x`/`y` are 0–1 fractions of the display instead of pixels. |
|
|
288
351
|
| `--hold-start <ms>` / `--hold-end <ms>` | Hold at the first/last point before moving/lifting (routes via `uinput`). |
|
|
289
352
|
| `--device <serial>` | Target device serial. |
|
|
290
353
|
|
|
@@ -294,9 +357,10 @@ oniro-app gesture --waypoints '[{"x":200,"y":600,"t":0},{"x":200,"y":200,"t":400
|
|
|
294
357
|
|
|
295
358
|
## Output & exit codes
|
|
296
359
|
|
|
297
|
-
- **Results → stdout.** Plain text by default; `--json` (where supported) writes `JSON.stringify(..., null, 2)`. Read/observe commands (`sdk list`, `cmdtools status`, `templates list`, `devices`, `wait --log`, `watch`, `lint`, `app apply`, `build`) accept `--json` (and `screenshot` with `--contact-sheet`); `dump`
|
|
360
|
+
- **Results → stdout.** Plain text by default; `--json` (where supported) writes `JSON.stringify(..., null, 2)`. Read/observe commands (`sdk list`, `cmdtools status`, `templates list`, `devices`, `wait --log` / `--target`, `watch`, `lint`, `app apply`, `build`) accept `--json` (and `screenshot` with `--contact-sheet`); `dump` emits JSON unless `--flat`; action-only commands do not.
|
|
298
361
|
- **Progress & logs → stderr.** stdout stays clean for machine consumers, so `oniro-app create … > path.txt` or `oniro-app devices --json | jq` work cleanly.
|
|
299
362
|
- **Exit code.** `0` on success, non-zero on failure (the error message is written to stderr). Set `ONIRO_DEBUG=1` to also print full stack traces.
|
|
363
|
+
- **Global options go before the command** (`oniro-app --version`), so `hdc` can pass its arguments through untouched.
|
|
300
364
|
|
|
301
365
|
## Configuration
|
|
302
366
|
|
|
@@ -308,6 +372,8 @@ The CLI reads paths and URLs from environment variables. All are optional; defau
|
|
|
308
372
|
| `ONIRO_CMD_TOOLS_PATH` | `~/command-line-tools` | Command-line tools install root |
|
|
309
373
|
| `ONIRO_EMULATOR_DIR` | `~/oniro-emulator` | Emulator install root |
|
|
310
374
|
| `ONIRO_HAP_PATH` | `entry/build/.../entry-default-signed.hap` | Default `.hap` used by `app install` (relative to the project) |
|
|
375
|
+
| `ONIRO_DEVICE_SERIAL` | (unset) | Device every device command addresses when `--device` is not given (also read as `DEVICE_SERIAL`) |
|
|
376
|
+
| `ONIRO_HDC` | the cmd-tools `hdc` | `hdc` binary to use instead, e.g. a wrapper for a remote device |
|
|
311
377
|
| `ONIRO_SDK_URL_BASE` | `https://repo.huaweicloud.com/openharmony/os` | Base URL for SDK downloads (point at a private/CI mirror) |
|
|
312
378
|
| `ONIRO_CMD_TOOLS_URL_LINUX` | Huawei mirror, x64 5.1.0.840 | Override the Linux cmd-tools URL |
|
|
313
379
|
| `ONIRO_CMD_TOOLS_URL_WINDOWS` | (unset) | Self-hosted Windows cmd-tools URL |
|
|
@@ -466,7 +532,16 @@ oniro-app sign --apl system_core \
|
|
|
466
532
|
--acls ohos.permission.REBOOT,ohos.permission.INJECT_INPUT_EVENT
|
|
467
533
|
```
|
|
468
534
|
|
|
469
|
-
|
|
535
|
+
An app that declares a privileged extension ability, such as an `AccessibilityExtensionAbility`, also needs `AllowAppUsePrivilegeExtension` in the profile's `app-privilege-capabilities`; without it the install fails with `9568344 not allow use privilege extension`. Pass it, and any other privilege (`AllowAppMultiProcess`, `AllowAppDesktopIconHide`, …), via `--app-privilege-capabilities`:
|
|
536
|
+
|
|
537
|
+
```bash
|
|
538
|
+
oniro-app sign --apl system_core --acls ohos.permission.ACCESSIBILITY_EXTENSION_ABILITY \
|
|
539
|
+
--app-privilege-capabilities AllowAppUsePrivilegeExtension
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
Apps like these usually also call system APIs (`@systemapi`), which the public SDK that `sdk install` downloads leaves out: the build fails with errors such as `'config' is not exported from Kit '@kit.AccessibilityKit'`. Build them against the full OpenHarmony SDK by unpacking its components into `<root>/<os>/<api>` of a separate SDK root and pointing `ONIRO_SDK_ROOT_DIR` at that root.
|
|
543
|
+
|
|
544
|
+
The `signingConfigs` block written to `build-profile.json5` mirrors the names used by the project's `products[*].signingConfig` (e.g. `applications/standard/systemui` uses `release`, `launcher` uses `default`). If the project has no products section, `default` is used, and a product that names no `signingConfig` is pointed at it.
|
|
470
545
|
|
|
471
546
|
## Programmatic use
|
|
472
547
|
|