Unverified Commit c79de782 authored by duzenko's avatar duzenko Committed by GitHub

LG debugging/logcat fixed (#58670)

parent c21b3233
...@@ -1024,7 +1024,11 @@ class AdbLogReader extends DeviceLogReader { ...@@ -1024,7 +1024,11 @@ class AdbLogReader extends DeviceLogReader {
}(await device.apiVersion); }(await device.apiVersion);
// Start the adb logcat process and filter the most recent logs since `lastTimestamp`. // Start the adb logcat process and filter the most recent logs since `lastTimestamp`.
// Some devices (notably LG) will only output logcat via shell
// https://github.com/flutter/flutter/issues/51853
final List<String> args = <String>[ final List<String> args = <String>[
'shell',
'-x',
'logcat', 'logcat',
'-v', '-v',
'time', 'time',
...@@ -1034,9 +1038,9 @@ class AdbLogReader extends DeviceLogReader { ...@@ -1034,9 +1038,9 @@ class AdbLogReader extends DeviceLogReader {
'flutter', 'flutter',
] else if (apiVersion != null && apiVersion >= kLollipopVersionCode) ...<String>[ ] else if (apiVersion != null && apiVersion >= kLollipopVersionCode) ...<String>[
// Otherwise, filter for logs appearing past the present. // Otherwise, filter for logs appearing past the present.
// Empty `-T` means the timestamp of the logcat command invocation. // '-T 0` means the timestamp of the logcat command invocation.
'-T', '-T',
device.lastLogcatTimestamp ?? '', if (device.lastLogcatTimestamp != null) '\'${device.lastLogcatTimestamp}\'' else '0',
], ],
]; ];
final Process process = await processManager.start(device.adbCommandForDevice(args)); final Process process = await processManager.start(device.adbCommandForDevice(args));
......
...@@ -26,11 +26,13 @@ void main() { ...@@ -26,11 +26,13 @@ void main() {
'adb', 'adb',
'-s', '-s',
'1234', '1234',
'shell',
'-x',
'logcat', 'logcat',
'-v', '-v',
'time', 'time',
'-T', '-T',
kLastLogcatTimestamp, '\'$kLastLogcatTimestamp\'',
], ],
) )
]); ]);
...@@ -49,6 +51,8 @@ void main() { ...@@ -49,6 +51,8 @@ void main() {
'adb', 'adb',
'-s', '-s',
'1234', '1234',
'shell',
'-x',
'logcat', 'logcat',
'-v', '-v',
'time', 'time',
...@@ -70,6 +74,8 @@ void main() { ...@@ -70,6 +74,8 @@ void main() {
'adb', 'adb',
'-s', '-s',
'1234', '1234',
'shell',
'-x',
'logcat', 'logcat',
'-v', '-v',
'time', 'time',
...@@ -91,6 +97,8 @@ void main() { ...@@ -91,6 +97,8 @@ void main() {
'adb', 'adb',
'-s', '-s',
'1234', '1234',
'shell',
'-x',
'logcat', 'logcat',
'-v', '-v',
'time', 'time',
...@@ -115,6 +123,8 @@ void main() { ...@@ -115,6 +123,8 @@ void main() {
'adb', 'adb',
'-s', '-s',
'1234', '1234',
'shell',
'-x',
'logcat', 'logcat',
'-v', '-v',
'time', 'time',
...@@ -141,6 +151,8 @@ void main() { ...@@ -141,6 +151,8 @@ void main() {
'adb', 'adb',
'-s', '-s',
'1234', '1234',
'shell',
'-x',
'logcat', 'logcat',
'-v', '-v',
'time', 'time',
......
...@@ -217,6 +217,8 @@ void main() { ...@@ -217,6 +217,8 @@ void main() {
'adb', 'adb',
'-s', '-s',
'1234', '1234',
'shell',
'-x',
'logcat', 'logcat',
'-v', '-v',
'time', 'time',
......
...@@ -370,10 +370,10 @@ flutter: ...@@ -370,10 +370,10 @@ flutter:
exitCode: 1, exitCode: 1,
), ),
const FakeCommand( const FakeCommand(
command: <String>['adb', '-s', '1234', 'logcat', '-v', 'time', '-s', 'flutter'], command: <String>['adb', '-s', '1234', 'shell', '-x', 'logcat', '-v', 'time', '-s', 'flutter'],
), ),
const FakeCommand( const FakeCommand(
command: <String>['adb', '-s', '1234', 'logcat', '-v', 'time'], command: <String>['adb', '-s', '1234', 'shell', '-x', 'logcat', '-v', 'time'],
) )
]) ])
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment