(params: {
device: DeviceInfo;
appBundleId?: string;
appLogPath: string;
appLogState?: AppLogState;
})
| 300 | } |
| 301 | |
| 302 | async function resolveAndroidNetworkRecoveryContext(params: { |
| 303 | device: DeviceInfo; |
| 304 | appBundleId?: string; |
| 305 | appLogPath: string; |
| 306 | appLogState?: AppLogState; |
| 307 | }): Promise<AndroidNetworkRecoveryContext | null> { |
| 308 | const { device, appBundleId, appLogPath, appLogState } = params; |
| 309 | if (device.platform !== 'android' || !appBundleId) { |
| 310 | return null; |
| 311 | } |
| 312 | if (appLogState !== undefined && appLogState !== 'active') { |
| 313 | return { reason: 'inactive' }; |
| 314 | } |
| 315 | if (appLogState !== 'active') { |
| 316 | return null; |
| 317 | } |
| 318 | |
| 319 | const trackedPid = readTrackedAndroidLogcatPid( |
| 320 | path.join(path.dirname(appLogPath), APP_LOG_PID_FILENAME), |
| 321 | ); |
| 322 | if (!trackedPid) { |
| 323 | return null; |
| 324 | } |
| 325 | const currentPid = await resolveAndroidPid(device.id, appBundleId); |
| 326 | if (!currentPid || currentPid === trackedPid) { |
| 327 | return null; |
| 328 | } |
| 329 | return { reason: 'stale-active', trackedPid }; |
| 330 | } |
| 331 | |
| 332 | function buildAndroidRecoveryNote( |
| 333 | context: AndroidNetworkRecoveryContext, |
no test coverage detected