Index: devil/devil/android/apk_helper.py |
diff --git a/devil/devil/android/apk_helper.py b/devil/devil/android/apk_helper.py |
index c0d4ee95724ac4bb1162de93cde7c8fb51c5eb07..c23f2c85b3ec9a19507c0c81967144d50b70ea9a 100644 |
--- a/devil/devil/android/apk_helper.py |
+++ b/devil/devil/android/apk_helper.py |
@@ -4,7 +4,6 @@ |
"""Module containing utilities for apk packages.""" |
-import itertools |
import re |
from devil import base_error |
@@ -189,14 +188,23 @@ class ApkHelper(object): |
"""Returns whether any services exist that use isolatedProcess=true.""" |
manifest_info = self._GetManifest() |
try: |
- applications = manifest_info['manifest'][0].get('application', []) |
- services = itertools.chain( |
- *(application.get('service', []) for application in applications)) |
+ application = manifest_info['manifest'][0]['application'][0] |
+ services = application['service'] |
perezju
2017/09/28 10:24:38
what's the reason for this change from all applica
agrieve
2017/09/28 11:54:34
Just wanted to make it consistent with how GetAllM
|
return any( |
_ParseNumericKey(s, 'android:isolatedProcess') for s in services) |
except KeyError: |
return False |
+ def GetAllMetadata(self): |
+ """Returns a list meta-data tags as (name, value) tuples.""" |
+ manifest_info = self._GetManifest() |
+ try: |
+ application = manifest_info['manifest'][0]['application'][0] |
+ metadata = application['meta-data'] |
+ return [(x.get('android:name'), x.get('android:value')) for x in metadata] |
+ except KeyError: |
+ return [] |
+ |
def _GetManifest(self): |
if not self._manifest: |
self._manifest = _ParseManifestFromApk(self._apk_path) |