|
17 | 17 | @author: Diego Torres Milano |
18 | 18 | ''' |
19 | 19 |
|
20 | | -__version__ = '2.3.20' |
| 20 | +__version__ = '2.3.21' |
21 | 21 |
|
22 | 22 | import sys |
23 | 23 | import subprocess |
@@ -1101,7 +1101,10 @@ def __init__(self, device, serialno, adb=None, autodump=True, forceviewserveruse |
1101 | 1101 | self.ignoreUiAutomatorKilled = ignoreuiautomatorkilled |
1102 | 1102 | ''' On some devices (i.e. Nexus 7 running 4.2.2) uiautomator is killed just after generating |
1103 | 1103 | the dump file. In many cases the file is already complete so we can ask to ignore the 'Killed' |
1104 | | - message by setting L{ignoreuiautomatorkilled} to C{True} |
| 1104 | + message by setting L{ignoreuiautomatorkilled} to C{True}. |
| 1105 | + |
| 1106 | + Changes in 2.3.21 that uses C{/dev/tty} instead of a file may have turned this variable |
| 1107 | + unnnecessary, however it has been kept for backward compatibility. |
1105 | 1108 | ''' |
1106 | 1109 |
|
1107 | 1110 | if self.useUiAutomator: |
@@ -1701,26 +1704,12 @@ def dump(self, window=-1, sleep=1): |
1701 | 1704 | MonkeyRunner.sleep(sleep) |
1702 | 1705 |
|
1703 | 1706 | if self.useUiAutomator: |
1704 | | - # FIXME: this might not be the path on some devices |
1705 | | - windowDump = '/mnt/sdcard/window_dump.xml' |
1706 | | - output = self.device.shell('uiautomator dump %s' % windowDump) |
1707 | | - if not output: |
| 1707 | + # NOTICE: |
| 1708 | + # Using /dev/tty this works even on devices with no sdcard |
| 1709 | + received = self.device.shell('uiautomator dump /dev/tty >/dev/null') |
| 1710 | + if not received: |
1708 | 1711 | raise RuntimeError('ERROR: Getting UIAutomator dump') |
1709 | | - if not re.search('dumped', output): |
1710 | | - if re.search('Killed', output) and self.ignoreUiAutomatorKilled: |
1711 | | - pass |
1712 | | - else: |
1713 | | - raise RuntimeError("ERROR: UIAutomator dump output doesn't contain 'dumped' (%s)" % output) |
1714 | | - received = self.device.shell('cat %s 2>/dev/null' % windowDump) |
1715 | | - if received: |
1716 | | - received = received.encode('ascii', 'ignore') |
1717 | | - else: |
1718 | | - msg = '' |
1719 | | - output = self.device.shell('mount') |
1720 | | - if output: |
1721 | | - if not re.search('sdcard', output): |
1722 | | - msg = ", it seems there's no sdcard mounted and uiautomator creates dump there." |
1723 | | - raise RuntimeError("ERROR: Received empty UIAutomator dump" + msg) |
| 1712 | + received = received.encode('ascii', 'ignore') |
1724 | 1713 | if DEBUG: |
1725 | 1714 | self.received = received |
1726 | 1715 | if DEBUG_RECEIVED: |
|
0 commit comments