Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Unified Diff: devil/devil/android/apk_helper.py

Issue 3014693002: Expose <meta-data> in apk_helper.py (Closed)
Patch Set: Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | devil/devil/android/apk_helper_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « no previous file | devil/devil/android/apk_helper_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698