1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

utils/android: Use separate tmp dirs when extracting apk methods

Create a new temporary directory to use when extracting apk methods,
as when running multiple processes in parallel the extracted files could
be overwritten by each other.
This commit is contained in:
Marc Bonnici 2020-07-09 15:26:40 +01:00 committed by setrofim
parent 80bddf38a2
commit 2129d85422

View File

@ -214,8 +214,9 @@ class ApkInfo(object):
@property @property
def methods(self): def methods(self):
if self._methods is None: if self._methods is None:
with tempfile.TemporaryDirectory() as tmp_dir:
with zipfile.ZipFile(self._apk_path, 'r') as z: with zipfile.ZipFile(self._apk_path, 'r') as z:
extracted = z.extract('classes.dex', tempfile.gettempdir()) extracted = z.extract('classes.dex', tmp_dir)
dexdump = os.path.join(os.path.dirname(aapt), 'dexdump') dexdump = os.path.join(os.path.dirname(aapt), 'dexdump')
command = [dexdump, '-l', 'xml', extracted] command = [dexdump, '-l', 'xml', extracted]