diff --git a/devlib/utils/android.py b/devlib/utils/android.py index d617528..7b0ae58 100755 --- a/devlib/utils/android.py +++ b/devlib/utils/android.py @@ -132,6 +132,7 @@ class ApkInfo(object): version_regex = re.compile(r"name='(?P[^']+)' versionCode='(?P[^']+)' versionName='(?P[^']+)'") name_regex = re.compile(r"name='(?P[^']+)'") permission_regex = re.compile(r"name='(?P[^']+)'") + activity_regex = re.compile(r'\s*A:\s*android:name\(0x\d+\)=".(?P\w+)"') def __init__(self, path=None): self.path = path @@ -180,6 +181,18 @@ class ApkInfo(object): else: pass # not interested + self._apk_path = apk_path + self._activities = None + + @property + def activities(self): + if self._activities is None: + cmd = [aapt, 'dump', 'xmltree', self._apk_path, + 'AndroidManifest.xml'] + matched_activities = self.activity_regex.finditer(self._run(cmd)) + self._activities = [m.group('name') for m in matched_activities] + return self._activities + def _run(self, command): logger.debug(' '.join(command)) try: