Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions mobly/controllers/android_device_lib/services/logcat.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ def _start(self):
# Add spaces at beginning and at last to fix this issue.
if self._last_connection_time is not None:
t_argument_value = self._last_connection_time
self._last_connection_time = None
else:
t_argument_value = '1'
cmd = ' "%s" -s %s logcat -v threadtime -T "%s" %s >> "%s" ' % (
Expand Down Expand Up @@ -287,11 +288,11 @@ def pause(self):
"""
self._stop()
try:
response = self._ad.adb.shell(['date', '-Is', r'+%Y-%m-%d\ %H:%M:%S.%N'])
response = self._ad.adb.shell(['date', r'+%Y-%m-%d\ %H:%M:%S.%3N'])
if response:
self._last_connection_time = response.decode('utf-8').strip()
except adb.AdbError as e:
self._ad.log.exception('Failed to get host time.')
except adb.AdbError:
self._ad.log.exception('Failed to get device time.')

def resume(self):
"""Resumes a paused logcat service."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
0,
)

_DATE_COMMAND = ['date', '-Is', r'+%Y-%m-%d\ %H:%M:%S.%N']
_DATE_COMMAND = ['date', r'+%Y-%m-%d\ %H:%M:%S.%3N']


class LogcatTest(unittest.TestCase):
Expand Down Expand Up @@ -287,6 +287,7 @@ def _pause_and_resume_logcat_service(
start_proc_mock.assert_called_with(
adb_cmd % (ad_serial, '"%s" ' % expected_log_path), shell=True
)
self.assertIsNone(logcat_service._last_connection_time)

@mock.patch(
'mobly.controllers.android_device_lib.adb.AdbProxy',
Expand Down
Loading