Index: build/android/devil/android/apk_helper.py |
diff --git a/build/android/devil/android/apk_helper.py b/build/android/devil/android/apk_helper.py |
index 539fbe1a3ea7e7251ed67da0ce2d5d16bb15e259..81c49cf7596035a2201e5c7456d054ad95d44fc4 100644 |
--- a/build/android/devil/android/apk_helper.py |
+++ b/build/android/devil/android/apk_helper.py |
@@ -27,6 +27,13 @@ def GetInstrumentationName(apk_path): |
return ApkHelper(apk_path).GetInstrumentationName() |
+def ToHelper(path_or_helper): |
+ """Creates an ApkHelper unless one is already given.""" |
+ if isinstance(path_or_helper, basestring): |
+ return ApkHelper(path_or_helper) |
+ return path_or_helper |
+ |
+ |
def _ParseManifestFromApk(apk_path): |
aapt_output = aapt.Dump('xmltree', apk_path, 'AndroidManifest.xml') |
@@ -63,10 +70,14 @@ def _ParseManifestFromApk(apk_path): |
class ApkHelper(object): |
- def __init__(self, apk_path): |
- self._apk_path = apk_path |
+ def __init__(self, path): |
+ self._apk_path = path |
self._manifest = None |
+ @property |
+ def path(self): |
+ return self._apk_path |
+ |
def GetActivityName(self): |
"""Returns the name of the Activity in the apk.""" |
manifest_info = self._GetManifest() |