MCPcopy Index your code
hub / github.com/callstack/agent-device / scrollAndroid

Function scrollAndroid

src/platforms/android/input-actions.ts:204–234  ·  view source on GitHub ↗
(
  device: DeviceInfo,
  direction: ScrollDirection,
  options?: { amount?: number; pixels?: number; durationMs?: number },
)

Source from the content-addressed store, hash-verified

202}
203
204export async function scrollAndroid(
205 device: DeviceInfo,
206 direction: ScrollDirection,
207 options?: { amount?: number; pixels?: number; durationMs?: number },
208): Promise<Record<string, unknown>> {
209 const size = await getAndroidScreenSize(device);
210 const plan = buildScrollGesturePlan({
211 direction,
212 amount: options?.amount,
213 pixels: options?.pixels,
214 referenceWidth: size.width,
215 referenceHeight: size.height,
216 });
217 const durationMs = options?.durationMs ?? 300;
218
219 await runAndroidAdb(device, [
220 'shell',
221 'input',
222 'swipe',
223 String(plan.x1),
224 String(plan.y1),
225 String(plan.x2),
226 String(plan.y2),
227 String(durationMs),
228 ]);
229
230 return {
231 ...plan,
232 ...(options?.durationMs !== undefined ? { durationMs: options.durationMs } : {}),
233 };
234}
235
236function resolveAndroidUserRotation(orientation: DeviceRotation): string {
237 switch (orientation) {

Callers 2

createAndroidInteractorFunction · 0.90
index.test.tsFile · 0.90

Calls 3

buildScrollGesturePlanFunction · 0.90
runAndroidAdbFunction · 0.90
getAndroidScreenSizeFunction · 0.85

Tested by

no test coverage detected