From 42e62aed57e73be7ba5ce323b5f3b740d589b478 Mon Sep 17 00:00:00 2001 From: Douglas Raillard <douglas.raillard@arm.com> Date: Wed, 18 May 2022 11:03:26 +0100 Subject: [PATCH] target: Fix AndroidTarget pickling Avoid pickling the "clear_logcat_lock". Instead, discard the attribute and re-initialize it anew. --- devlib/target.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/devlib/target.py b/devlib/target.py index 6f6063e..8fb5ce5 100644 --- a/devlib/target.py +++ b/devlib/target.py @@ -1572,8 +1572,23 @@ class AndroidTarget(Target): conn_cls=conn_cls, is_container=is_container) self.package_data_directory = package_data_directory + self._init_logcat_lock() + + def _init_logcat_lock(self): self.clear_logcat_lock = threading.Lock() + def __getstate__(self): + dct = super().__getstate__() + return { + k: v + for k, v in dct.items() + if k not in ('clear_logcat_lock',) + } + + def __setstate__(self, dct): + self.__dict__.update(dct) + self._init_logcat_lock() + def reset(self, fastboot=False): # pylint: disable=arguments-differ try: self.execute('reboot {}'.format(fastboot and 'fastboot' or ''),