Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
475ee898
Unverified
Commit
475ee898
authored
Nov 28, 2019
by
Emmanuel Garcia
Committed by
GitHub
Nov 28, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make Android log reader read any recent logs (#45743)
parent
e2642fd6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
3 deletions
+33
-3
android_device.dart
packages/flutter_tools/lib/src/android/android_device.dart
+4
-3
android_device_test.dart
...tools/test/general.shard/android/android_device_test.dart
+29
-0
No files found.
packages/flutter_tools/lib/src/android/android_device.dart
View file @
475ee898
...
...
@@ -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,
...
...
packages/flutter_tools/test/general.shard/android/android_device_test.dart
View file @
475ee898
...
...
@@ -680,6 +680,35 @@ flutter:
});
});
group
(
'logReader'
,
()
{
ProcessManager
mockProcessManager
;
AndroidSdk
mockAndroidSdk
;
setUp
(()
{
mockAndroidSdk
=
MockAndroidSdk
();
mockProcessManager
=
MockProcessManager
();
});
testUsingContext
(
'calls adb logcat with expected flags'
,
()
async
{
const
String
klastLocatcatTimestamp
=
'11-27 15:39:04.506'
;
when
(
mockAndroidSdk
.
adbPath
).
thenReturn
(
'adb'
);
when
(
mockProcessManager
.
runSync
(<
String
>[
'adb'
,
'-s'
,
'1234'
,
'shell'
,
'-x'
,
'logcat'
,
'-v'
,
'time'
,
'-t'
,
'1'
]))
.
thenReturn
(
ProcessResult
(
0
,
0
,
'
$klastLocatcatTimestamp
I/flutter: irrelevant'
,
''
));
when
(
mockProcessManager
.
start
(
argThat
(
contains
(
'logcat'
))))
.
thenAnswer
((
_
)
=>
Future
<
Process
>.
value
(
createMockProcess
()));
final
AndroidDevice
device
=
AndroidDevice
(
'1234'
);
final
DeviceLogReader
logReader
=
device
.
getLogReader
();
logReader
.
logLines
.
listen
((
_
)
{});
verify
(
mockProcessManager
.
start
(
const
<
String
>[
'adb'
,
'-s'
,
'1234'
,
'logcat'
,
'-v'
,
'time'
,
'-T'
,
klastLocatcatTimestamp
]))
.
called
(
1
);
},
overrides:
<
Type
,
Generator
>{
AndroidSdk:
()
=>
mockAndroidSdk
,
ProcessManager:
()
=>
mockProcessManager
,
});
});
test
(
'Can parse adb shell dumpsys info'
,
()
{
const
String
exampleOutput
=
r''
'
Applications Memory Usage (in Kilobytes):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment