Skip to content

Commit

Permalink
Exclude TV leanback launcher activities from launchable activity dete…
Browse files Browse the repository at this point in the history
…ction (#376)

Co-authored-by: Martin Tschirsich <martin@martin-ThinkPad-X1-Carbon-3rd>
  • Loading branch information
mtschirs and Martin Tschirsich authored May 26, 2020
1 parent 25568d3 commit 78a9d31
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions objection/utils/patchers/android.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import tempfile
import xml.etree.ElementTree as ElementTree
from pkg_resources import parse_version
import re

import click
import delegator
Expand Down Expand Up @@ -325,20 +326,14 @@ def _get_launchable_activity(self) -> str:
:return:
"""

activity = ''
aapt = self._get_appt_output().split('\n')
activities = (match.groups()[0] for match in re.finditer(r"^launchable-activity: name='([^']+)'", self._get_appt_output(), re.MULTILINE))
activity = next(activities, None)

for line in aapt:
if 'launchable-activity' in line:
# ['launchable-activity: name=', 'com.app.activity', ' label=', 'bob']
activity = line.split('\'')[1]

# If we got the activity using aapt, great, return that.
if activity != '':
# If we got the activity using aapt, great, return that
if activity is not None:
return activity

# if we dont have the activity yet, check out activity aliases

click.secho(('Unable to determine the launchable activity using aapt, trying '
'to manually parse the AndroidManifest for activity aliases...'), dim=True, fg='yellow')

Expand Down

0 comments on commit 78a9d31

Please sign in to comment.