androidCrashes function

Future<List<NativeCrash>> androidCrashes({
  1. required String serial,
  2. required String adbPath,
  3. required String package,
  4. required DateTime since,
  5. ProcessRunner run = boundedRun,
})

Crashes of package in the device's crash log buffer since since, newest first.

Implementation

Future<List<NativeCrash>> androidCrashes({
  required String serial,
  required String adbPath,
  required String package,
  required DateTime since,
  ProcessRunner run = boundedRun,
}) async {
  try {
    final r = await runCapped(
      run,
      adbPath,
      ['-s', serial, 'logcat', '-b', 'crash', '-d', '-v', 'year'],
      timeout: const Duration(seconds: 10),
      phase: 'adb logcat crash buffer',
    );
    if (r.exitCode != 0) return const [];
    return parseAndroidCrashes(r.stdout as String, package: package).where((c) => !c.time.isBefore(since)).toList()
      ..sort((a, b) => b.time.compareTo(a.time));
  } on Object {
    return const [];
  }
}