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
d7d4a46d
Commit
d7d4a46d
authored
Jan 06, 2016
by
Eric Seidel
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1091 from eseidelGoogle/device_time
Teach `flutter trace stop` to use time on the device.
parents
a271eb56
0d783718
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletion
+15
-1
device.dart
packages/flutter_tools/lib/src/device.dart
+15
-1
No files found.
packages/flutter_tools/lib/src/device.dart
View file @
d7d4a46d
...
...
@@ -887,10 +887,24 @@ class AndroidDevice extends Device {
return
"
$m
-
$d
$H
:
$M
:
$S
.
$q
"
;
}
// TODO(eseidel): This is fragile, there must be a better way!
DateTime
timeOnDevice
()
{
// Careful: Android's date command is super-lame, any arguments are taken as
// attempts to set the timezone and will screw your device.
String
output
=
runCheckedSync
(
adbCommandForDevice
([
'shell'
,
'date'
])).
trim
();
// format: Fri Dec 18 13:22:07 PST 2015
// intl doesn't handle timezones: https://github.com/dart-lang/intl/issues/93
// So we use the local date command to parse dates for us.
String
seconds
=
runSync
([
'date'
,
'--date'
,
output
,
'+%s'
]);
// Although '%s' is supposed to be UTC, date appears to be ignoring the
// timezone in the passed string, so using isUTC: false here.
return
new
DateTime
.
fromMillisecondsSinceEpoch
(
int
.
parse
(
seconds
)
*
1000
,
isUtc:
false
);
}
String
stopTracing
(
AndroidApk
apk
,
{
String
outPath:
null
})
{
// 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
());
String
beforeStop
=
_logcatDateFormat
(
timeOnDevice
());
runCheckedSync
(
adbCommandForDevice
([
'shell'
,
'am'
,
...
...
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