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
7d4feaa7
Commit
7d4feaa7
authored
Dec 03, 2015
by
Eric Seidel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Workaround logcat -c not working
parent
93b1f100
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
3 deletions
+28
-3
device.dart
packages/flutter_tools/lib/src/device.dart
+28
-3
No files found.
packages/flutter_tools/lib/src/device.dart
View file @
7d4feaa7
...
...
@@ -853,8 +853,33 @@ class AndroidDevice extends Device {
]));
}
static
String
_threeDigits
(
int
n
)
{
if
(
n
>=
100
)
return
"
$n
"
;
if
(
n
>=
10
)
return
"0
$n
"
;
return
"00
$n
"
;
}
static
String
_twoDigits
(
int
n
)
{
if
(
n
>=
10
)
return
"
$n
"
;
return
"0
$n
"
;
}
static
String
_logcatDateFormat
(
DateTime
dt
)
{
// Doing this manually, instead of using package:intl for simplicity.
// adb logcat -T wants "%m-%d %H:%M:%S.%3q"
String
m
=
_twoDigits
(
dt
.
month
);
String
d
=
_twoDigits
(
dt
.
day
);
String
H
=
_twoDigits
(
dt
.
hour
);
String
M
=
_twoDigits
(
dt
.
minute
);
String
S
=
_twoDigits
(
dt
.
second
);
String
q
=
_threeDigits
(
dt
.
millisecond
);
return
"
$m
-
$d
$H
:
$M
:
$S
.
$q
"
;
}
String
stopTracing
(
AndroidApk
apk
,
{
String
outPath:
null
})
{
clearLogs
();
// Workaround for logcat -c not always working:
// http://stackoverflow.com/questions/25645012/logcat-on-android-l-not-clearing-after-unplugging-and-reconnecting
String
beforeStop
=
_logcatDateFormat
(
new
DateTime
.
now
());
runCheckedSync
(
adbCommandForDevice
([
'shell'
,
'am'
,
...
...
@@ -869,9 +894,9 @@ class AndroidDevice extends Device {
String
tracePath
=
null
;
bool
isComplete
=
false
;
while
(!
isComplete
)
{
String
logs
=
run
Sync
(
adbCommandForDevice
([
'logcat'
,
'-d'
]));
String
logs
=
run
CheckedSync
(
adbCommandForDevice
([
'logcat'
,
'-d'
,
'-T'
,
beforeStop
]));
Match
fileMatch
=
traceRegExp
.
firstMatch
(
logs
);
if
(
fileMatch
[
1
]
!=
null
)
{
if
(
fileMatch
!=
null
&&
fileMatch
[
1
]
!=
null
)
{
tracePath
=
fileMatch
[
1
];
}
isComplete
=
completeRegExp
.
hasMatch
(
logs
);
...
...
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