Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android log reader reads any recent logs #45743

Merged
merged 1 commit into from
Nov 28, 2019

Conversation

blasten
Copy link

@blasten blasten commented Nov 28, 2019

Description

After #45307, the Android log reader doesn't filter older logs. Instead, it filters by tag and the protocol discovery class throttles the logs to discover the most recent observatory URI. The intention with this change was to allow flutter attach to attach to an app already running on the device. However, this implementation detail is used by the microbenchmarks test to extract the benchmark data.

This PR reverts to the old behavior. Going forward, we can have two factories for the Android log reader such the one that filters by tags is explicitly injected in the flutter attach flow and the other one is injected in flutter run/logs flows. cc @xster

Related Issues

Fixes #45732

Tests

I added the following tests: Unit test

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require Flutter developers to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (Please read Handling breaking changes). Replace this with a link to the e-mail where you asked for input on this proposed change.
  • No, this is not a breaking change.

@fluttergithubbot fluttergithubbot added the tool Affects the "flutter" command-line tool. See also t: labels. label Nov 28, 2019
@blasten blasten requested a review from Hixie November 28, 2019 00:25
ProcessManager: () => mockProcessManager,
});
});

test('Can parse adb shell dumpsys info', () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably also have a real devicelab test that verifies that we're not getting old logs when you run flutter run or flutter logs

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

definitely

@Hixie
Copy link
Contributor

Hixie commented Nov 28, 2019

LGTM

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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks a lot simpler than the code used to look; why was the old code more complicated?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure. I was trying to see in which version the -T flag was introduced.

@xster
Copy link
Member

xster commented Nov 28, 2019

Approach sounds reasonable to me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Some microbenchmarks stopped sending data
5 participants