Make Android log reader read any recent logs (#45743)

This commit is contained in:
Emmanuel Garcia
2019-11-27 17:52:36 -08:00
committed by GitHub
parent e2642fd6c0
commit 475ee89879
2 changed files with 33 additions and 3 deletions

View File

@@ -688,7 +688,7 @@ class AndroidDevice extends Device {
String output;
try {
output = runAdbCheckedSync(<String>[
'shell', '-x', 'logcat', '-v', 'time', '-t', '1',
'shell', '-x', 'logcat', '-v', 'time', '-t', '1'
]);
} catch (error) {
printError('Failed to extract the most recent timestamp from the Android log: $error.');
@@ -1007,8 +1007,9 @@ class _AdbLogReader extends DeviceLogReader {
String get name => device.name;
void _start() {
// Start the adb logcat process and filter logs by the "flutter" tag.
final List<String> args = <String>['shell', '-x', 'logcat', '-v', 'time', '-s', 'flutter'];
final String lastTimestamp = device.lastLogcatTimestamp;
// Start the adb logcat process and filter the most recent logs since `lastTimestamp`.
final List<String> args = <String>['logcat', '-v', 'time', '-T', lastTimestamp];
processUtils.start(device.adbCommandForDevice(args)).then<void>((Process process) {
_process = process;
// We expect logcat streams to occasionally contain invalid utf-8,