(device: DeviceInfo, count: number)
| 396 | } |
| 397 | |
| 398 | async function clearFocusedText(device: DeviceInfo, count: number): Promise<void> { |
| 399 | const deletes = Math.max(0, count); |
| 400 | await runAndroidAdb(device, ['shell', 'input', 'keyevent', 'KEYCODE_MOVE_END'], { |
| 401 | allowFailure: true, |
| 402 | }); |
| 403 | const batchSize = 24; |
| 404 | for (let i = 0; i < deletes; i += batchSize) { |
| 405 | const size = Math.min(batchSize, deletes - i); |
| 406 | await runAndroidAdb( |
| 407 | device, |
| 408 | ['shell', 'input', 'keyevent', ...Array(size).fill('KEYCODE_DEL')], |
| 409 | { |
| 410 | allowFailure: true, |
| 411 | }, |
| 412 | ); |
| 413 | } |
| 414 | } |
| 415 | |
| 416 | function clampCount(value: number, min: number, max: number): number { |
| 417 | return Math.max(min, Math.min(max, value)); |
no test coverage detected