(
State(state): State<AppState>,
Path(udid): Path<String>,
Query(query): Query<ScreenshotPngQuery>,
)
| 2463 | } |
| 2464 | |
| 2465 | async fn screenshot_png( |
| 2466 | State(state): State<AppState>, |
| 2467 | Path(udid): Path<String>, |
| 2468 | Query(query): Query<ScreenshotPngQuery>, |
| 2469 | ) -> Result<(StatusCode, HeaderMap, Vec<u8>), AppError> { |
| 2470 | let include_bezel = query |
| 2471 | .bezel |
| 2472 | .as_deref() |
| 2473 | .map(parse_asset_bool) |
| 2474 | .unwrap_or(false); |
| 2475 | let png = if android::is_android_id(&udid) { |
| 2476 | if include_bezel { |
| 2477 | return Err(AppError::bad_request( |
| 2478 | "Android emulators do not support bezeled screenshots.", |
| 2479 | )); |
| 2480 | } |
| 2481 | run_android_action(state, move |android| android.screenshot_png(&udid)).await? |
| 2482 | } else { |
| 2483 | run_bridge_action(state, move |bridge| { |
| 2484 | bridge.screenshot_png(&udid, include_bezel) |
| 2485 | }) |
| 2486 | .await? |
| 2487 | }; |
| 2488 | let mut headers = HeaderMap::new(); |
| 2489 | headers.insert(header::CONTENT_TYPE, "image/png".parse().unwrap()); |
| 2490 | headers.insert( |
| 2491 | header::CACHE_CONTROL, |
| 2492 | "no-cache, no-store, must-revalidate".parse().unwrap(), |
| 2493 | ); |
| 2494 | Ok((StatusCode::OK, headers, png)) |
| 2495 | } |
| 2496 | |
| 2497 | async fn screen_recording( |
| 2498 | State(state): State<AppState>, |
nothing calls this directly
no test coverage detected