mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
This reverts commit d962c8f2a2c9a1ec7d0b87adf9d4bd92bad1c525.
This commit is contained in:
parent
2321b72dfb
commit
27936e9f22
@ -683,7 +683,6 @@ class AndroidDevice extends Device {
|
||||
return LaunchResult.failed();
|
||||
}
|
||||
}
|
||||
resetLogReaders();
|
||||
return LaunchResult.succeeded(observatoryUri: observatoryUri);
|
||||
} on Exception catch (error) {
|
||||
_logger.printError('Error waiting for a debug connection: $error');
|
||||
@ -743,14 +742,6 @@ class AndroidDevice extends Device {
|
||||
_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
|
||||
FutureOr<DeviceLogReader> getLogReader({
|
||||
AndroidApk app,
|
||||
|
||||
@ -490,6 +490,12 @@ Future<LaunchResult> _startApp(
|
||||
|
||||
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(
|
||||
package,
|
||||
mainPath: mainPath,
|
||||
@ -511,15 +517,10 @@ Future<LaunchResult> _startApp(
|
||||
);
|
||||
|
||||
if (!result.started) {
|
||||
await command._deviceLogSubscription.cancel();
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@ -30,20 +30,6 @@ void main() {
|
||||
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', () {
|
||||
final Map<String, String> properties = parseAdbDeviceProperties(kAdbShellGetprop);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user