from acts.context import get_current_context
from acts.controllers.adb import AdbProxy
from acts.controllers.adb import AdbError
+from acts.controllers.adb_lib.error import AdbCommandError
from google.protobuf import empty_pb2 as empty_proto
self.push_or_die(os.path.join(get_gd_root(), "target", "bluetooth_stack_with_facade"), "system/bin")
self.push_or_die(os.path.join(get_gd_root(), "target", "libbluetooth_gd.so"), "system/lib64")
self.push_or_die(os.path.join(get_gd_root(), "target", "libgrpc++_unsecure.so"), "system/lib64")
- self.adb.shell("rm /data/misc/bluetooth/logs/btsnoop_hci.log")
- self.adb.shell("rm /data/misc/bluedroid/bt_config.conf")
- self.adb.shell("rm /data/misc/bluedroid/bt_config.bak")
+
+ try:
+ self.adb.shell("rm /data/misc/bluetooth/logs/btsnoop_hci.log")
+ except AdbCommandError as error:
+ logging.error("Error during setup: " + str(error))
+
+ try:
+ self.adb.shell("rm /data/misc/bluedroid/bt_config.conf")
+ except AdbCommandError as error:
+ logging.error("Error during cleanup: " + str(error))
+
+ try:
+ self.adb.shell("rm /data/misc/bluedroid/bt_config.bak")
+ except AdbCommandError as error:
+ logging.error("Error during cleanup: " + str(error))
+
self.ensure_no_output(self.adb.shell("svc bluetooth disable"))
# Start logcat logging
"/data/misc/bluedroid/bt_config.bak %s" % os.path.join(self.log_path_base, "%s_bt_config.bak" % self.label))
def cleanup_port_forwarding(self):
- self.adb.remove_tcp_forward(self.grpc_port)
- self.adb.remove_tcp_forward(self.grpc_root_server_port)
- self.adb.reverse("--remove tcp:%d" % self.signal_port)
+ try:
+ self.adb.remove_tcp_forward(self.grpc_port)
+ except AdbError as error:
+ logging.error("Error during port forwarding cleanup: " + str(error))
+
+ try:
+ self.adb.remove_tcp_forward(self.grpc_root_server_port)
+ except AdbError as error:
+ logging.error("Error during port forwarding cleanup: " + str(error))
+
+ try:
+ self.adb.reverse("--remove tcp:%d" % self.signal_port)
+ except AdbError as error:
+ logging.error("Error during port forwarding cleanup: " + str(error))
@staticmethod
def ensure_no_output(result):