Unverified Commit 27936e9f authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

Revert "[flutter_tools] ensure android log reader works in flutter drive (#68131)" (#68222)

This reverts commit d962c8f2.
parent 2321b72d
...@@ -683,7 +683,6 @@ class AndroidDevice extends Device { ...@@ -683,7 +683,6 @@ class AndroidDevice extends Device {
return LaunchResult.failed(); return LaunchResult.failed();
} }
} }
resetLogReaders();
return LaunchResult.succeeded(observatoryUri: observatoryUri); return LaunchResult.succeeded(observatoryUri: observatoryUri);
} on Exception catch (error) { } on Exception catch (error) {
_logger.printError('Error waiting for a debug connection: $error'); _logger.printError('Error waiting for a debug connection: $error');
...@@ -743,14 +742,6 @@ class AndroidDevice extends Device { ...@@ -743,14 +742,6 @@ class AndroidDevice extends Device {
_processUtils.runSync(adbCommandForDevice(<String>['logcat', '-c'])); _processUtils.runSync(adbCommandForDevice(<String>['logcat', '-c']));
} }
/// Android device log readers are singletons. if they are closed by the
/// protocol discovery, the same kind of reader cannot be recreated.
@visibleForTesting
void resetLogReaders() {
_pastLogReader = null;
_logReader = null;
}
@override @override
FutureOr<DeviceLogReader> getLogReader({ FutureOr<DeviceLogReader> getLogReader({
AndroidApk app, AndroidApk app,
......
...@@ -490,6 +490,12 @@ Future<LaunchResult> _startApp( ...@@ -490,6 +490,12 @@ Future<LaunchResult> _startApp(
globals.printTrace('Starting application.'); globals.printTrace('Starting application.');
// Forward device log messages to the terminal window running the "drive" command.
final DeviceLogReader logReader = await command.device.getLogReader(app: package);
command._deviceLogSubscription = logReader
.logLines
.listen(globals.printStatus);
final LaunchResult result = await command.device.startApp( final LaunchResult result = await command.device.startApp(
package, package,
mainPath: mainPath, mainPath: mainPath,
...@@ -511,15 +517,10 @@ Future<LaunchResult> _startApp( ...@@ -511,15 +517,10 @@ Future<LaunchResult> _startApp(
); );
if (!result.started) { if (!result.started) {
await command._deviceLogSubscription.cancel();
return null; return null;
} }
// Forward device log messages to the terminal window running the "drive" command.
final DeviceLogReader logReader = await command.device.getLogReader(app: package);
command._deviceLogSubscription = logReader
.logLines
.listen(globals.printStatus);
return result; return result;
} }
......
...@@ -30,20 +30,6 @@ void main() { ...@@ -30,20 +30,6 @@ void main() {
expect(device.id, '1234'); expect(device.id, '1234');
}); });
testWithoutContext('Can reset log reader singletons', () async {
final AndroidDevice device = setUpAndroidDevice();
final DeviceLogReader logReader = await device.getLogReader();
final DeviceLogReader logReader2 = await device.getLogReader();
expect(logReader, logReader2);
device.resetLogReaders();
final DeviceLogReader logReader3 = await device.getLogReader();
expect(logReader, isNot(logReader3));
});
testWithoutContext('parseAdbDeviceProperties parses adb shell output', () { testWithoutContext('parseAdbDeviceProperties parses adb shell output', () {
final Map<String, String> properties = parseAdbDeviceProperties(kAdbShellGetprop); final Map<String, String> properties = parseAdbDeviceProperties(kAdbShellGetprop);
......
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