Merge "Change the default sl4a RPC call from 1 to 3."
diff --git a/acts/framework/acts/controllers/sl4a_lib/event_dispatcher.py b/acts/framework/acts/controllers/sl4a_lib/event_dispatcher.py
index 9c6402c..b1a3ae6 100644
--- a/acts/framework/acts/controllers/sl4a_lib/event_dispatcher.py
+++ b/acts/framework/acts/controllers/sl4a_lib/event_dispatcher.py
@@ -80,7 +80,8 @@
"""
while self._started:
try:
- event_obj = self._rpc_client.eventWait(50000)
+ # 60000 in ms, timeout in second
+ event_obj = self._rpc_client.eventWait(60000, timeout=120)
except rpc_client.Sl4aConnectionError as e:
if self._rpc_client.is_alive:
self.log.warning('Closing due to closed session.')
diff --git a/acts/framework/acts/controllers/sl4a_lib/rpc_client.py b/acts/framework/acts/controllers/sl4a_lib/rpc_client.py
index ee12cef..7737162 100644
--- a/acts/framework/acts/controllers/sl4a_lib/rpc_client.py
+++ b/acts/framework/acts/controllers/sl4a_lib/rpc_client.py
@@ -180,7 +180,7 @@
self._working_connections.remove(connection)
self._free_connections.append(connection)
- def rpc(self, method, *args, timeout=None, retries=1):
+ def rpc(self, method, *args, timeout=None, retries=3):
"""Sends an rpc to sl4a.
Sends an rpc call to sl4a over this RpcClient's corresponding session.
@@ -220,6 +220,9 @@
method, i)
continue
else:
+ self._log.exception(
+ 'No response for RPC method %s on iteration %s',
+ method, i)
self.on_error(connection)
raise Sl4aProtocolError(
Sl4aProtocolError.NO_RESPONSE_FROM_SERVER)
@@ -227,8 +230,8 @@
break
except BrokenPipeError as e:
if self.is_alive:
- self._log.error('Exception %s happened while communicating to '
- 'SL4A.', e)
+ self._log.exception('Exception %s happened for sl4a call %s',
+ e, method)
self.on_error(connection)
else:
self._log.warning('The connection was killed during cleanup:')
diff --git a/acts/framework/acts/tracelogger.py b/acts/framework/acts/tracelogger.py
index a8c66b6..ef978f9 100644
--- a/acts/framework/acts/tracelogger.py
+++ b/acts/framework/acts/tracelogger.py
@@ -38,6 +38,10 @@
break
return trace_info
+ def exception(self, msg, *args, **kwargs):
+ trace_info = TraceLogger._get_trace_info(level=5)
+ self._logger.exception("%s %s" % (msg, trace_info), *args, **kwargs)
+
def debug(self, msg, *args, **kwargs):
trace_info = TraceLogger._get_trace_info(level=3)
self._logger.debug("%s %s" % (msg, trace_info), *args, **kwargs)