Skip to content

Commit 6c2efd8

Browse files
committed
refactor: tighten Android gesture review fixes
1 parent a40b8f6 commit 6c2efd8

3 files changed

Lines changed: 11 additions & 17 deletions

File tree

‎src/core/command-descriptor/registry.ts‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { resolveWaitBudgetMs } from '../wait-positionals.ts';
44
import {
55
DEFAULT_TIMEOUT_POLICY,
66
INSTALL_REQUEST_TIMEOUT_MS,
7-
LONG_PRESS_REQUEST_TIMEOUT_MS,
87
PREPARE_REQUEST_TIMEOUT_MS,
98
} from './timeout-policy.ts';
109
import { resolvePostActionObservationSupport } from './post-action-observation.ts';
@@ -163,11 +162,6 @@ const SETTLE_FLAG_PRESERVE_DAEMON_TIMEOUT_POLICY: CommandTimeoutPolicy = {
163162
onTimeout: 'preserve-daemon',
164163
};
165164

166-
const LONG_PRESS_TIMEOUT_POLICY: CommandTimeoutPolicy = {
167-
...SETTLE_FLAG_PRESERVE_DAEMON_TIMEOUT_POLICY,
168-
envelopeMs: LONG_PRESS_REQUEST_TIMEOUT_MS,
169-
};
170-
171165
const TOUCH_INTERACTION_RESPONSE_DATA_TRANSFORM = {
172166
fields: {
173167
count: { defaultValue: 1, omitDefault: true },
@@ -709,7 +703,12 @@ export const RAW_COMMAND_DESCRIPTORS = [
709703
daemon: { route: 'interaction', replayScopedAction: true, androidBlockingDialogGuard: true },
710704
dispatch: {},
711705
capability: { apple: APPLE_SIM_AND_DEVICE, android: ANDROID_ALL, linux: LINUX_DEVICE },
712-
timeoutPolicy: LONG_PRESS_TIMEOUT_POLICY,
706+
timeoutPolicy: {
707+
...SETTLE_FLAG_PRESERVE_DAEMON_TIMEOUT_POLICY,
708+
// A valid hold may last 120 seconds; leave the helper's 15-second
709+
// completion overhead inside the outer request envelope too.
710+
envelopeMs: 150_000,
711+
},
713712
postActionObservation: postActionObservation('longpress'),
714713
batchable: true,
715714
},

‎src/core/command-descriptor/timeout-policy.ts‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ import type { CommandTimeoutPolicy } from './types.ts';
77
const DAEMON_REQUEST_TIMEOUT_MS = 90_000;
88
export const PREPARE_REQUEST_TIMEOUT_MS = 240_000;
99

10-
// A valid longpress may hold for 120 seconds. Keep the outer request alive
11-
// beyond both that command budget and the helper's 15-second completion
12-
// overhead so the platform result, rather than the client envelope, wins.
13-
export const LONG_PRESS_REQUEST_TIMEOUT_MS = 150_000;
14-
1510
// Keep this above the longest platform install subprocess timeout so the client
1611
// envelope does not abort a still-progressing device install first.
1712
export const INSTALL_REQUEST_TIMEOUT_MS = 180_000;

‎src/platforms/android/multitouch-helper.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,10 @@ export async function readAndroidMultiTouchHelperViewport(device: DeviceInfo): P
129129
{ allowFailure: true, timeoutMs: HELPER_GESTURE_TIMEOUT_MS },
130130
);
131131
const records = parseInstrumentationRecords(`${result.stdout}\n${result.stderr}`);
132-
const helperResult = records.results.find(
133-
(record) => record.agentDeviceProtocol === HELPER_PROTOCOL,
134-
);
135-
if (result.exitCode !== 0 && !helperResult) {
132+
if (
133+
result.exitCode !== 0 &&
134+
!records.results.some((record) => record.agentDeviceProtocol === HELPER_PROTOCOL)
135+
) {
136136
throw new AppError(
137137
'COMMAND_FAILED',
138138
'Android gesture viewport is unavailable',
@@ -144,7 +144,7 @@ export async function readAndroidMultiTouchHelperViewport(device: DeviceInfo): P
144144
throw new AppError(
145145
'COMMAND_FAILED',
146146
'Android gesture viewport is unavailable',
147-
execFailureDetails(result, { helper: helperResult }),
147+
execFailureDetails(result),
148148
);
149149
}
150150
return viewport;

0 commit comments

Comments
 (0)