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

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

Issue 3019573002: Add support for getting real instrumentation value in incremental build
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 | no next file » | 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..16daefd1970a9f90b2eb9b68905cc2c3195ef8af 100644
--- a/devil/devil/android/apk_helper.py
+++ b/devil/devil/android/apk_helper.py
@@ -157,7 +157,13 @@ class ApkHelper(object):
self, default='android.test.InstrumentationTestRunner'):
"""Returns a list of all Instrumentations in the apk."""
try:
- return self._GetManifest()['manifest'][0]['instrumentation']
+ manifest = self._GetManifest()['manifest'][0]
+ real_instrumentation_values = self._GetRealInstrumentationValue()
+ if real_instrumentation_values:
+ for index, instr in enumerate(manifest['instrumentation']):
+ key = 'incremental-install-real-instrumentation-' + str(index)
+ instr['android:name'] = real_instrumentation_values[key]
+ return manifest['instrumentation']
except KeyError:
return [{'android:name': default}]
@@ -197,6 +203,17 @@ class ApkHelper(object):
except KeyError:
return False
+ def _GetRealInstrumentationValue(self):
+ manifest = self._GetManifest()['manifest'][0]
+ real_instrumentation_values = {}
+ if (manifest.get('application') and
+ manifest['application'][0].get('meta-data')):
+ meta_data = manifest.get('application')[0]['meta-data']
+ for i in meta_data:
+ if 'incremental-install-real-instrumentation' in i['android:name']:
+ real_instrumentation_values[i['android:name']] = i['android:value']
+ return real_instrumentation_values
+
def _GetManifest(self):
if not self._manifest:
self._manifest = _ParseManifestFromApk(self._apk_path)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698