Skip to content
This repository has been archived by the owner on Aug 14, 2020. It is now read-only.

Commit

Permalink
Bug 1401617 - Autophone - fix adb_android.py detection of bool extras…
Browse files Browse the repository at this point in the history
… in launch_application, r=self
  • Loading branch information
bclary committed Sep 23, 2017
1 parent 9289b0c commit dd74df3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions adb_android.py
Expand Up @@ -339,12 +339,16 @@ def launch_application(self, app_name, activity_name, intent, url=None,
if intent:
acmd.extend(["-a", intent])

# Note that isinstance(True, int) and isinstance(False, int)
# is True. This means we must test the type of the value
# against bool prior to testing it against int in order to
# prevent falsely identifying a bool value as an int.
if extras:
for (key, val) in extras.iteritems():
if isinstance(val, int):
extra_type_param = "--ei"
elif isinstance(val, bool):
if isinstance(val, bool):
extra_type_param = "--ez"
elif isinstance(val, int):
extra_type_param = "--ei"
else:
extra_type_param = "--es"
acmd.extend([extra_type_param, str(key), str(val)])
Expand All @@ -353,6 +357,7 @@ def launch_application(self, app_name, activity_name, intent, url=None,
acmd.extend(["-d", url])

cmd = self._escape_command_line(acmd)
self._logger.info('launch_application: %s' % cmd)
self.shell_output(cmd, timeout=timeout)

def launch_fennec(self, app_name, intent="android.intent.action.VIEW",
Expand Down

0 comments on commit dd74df3

Please sign in to comment.