Skip to content

Commit 96aa405

Browse files
committed
Merge pull request dtmilano#17 from mattismyname/master
Update window regex for latest dumpsys format
2 parents fbcf3f0 + 8b31113 commit 96aa405

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

AndroidViewClient/src/com/dtmilano/android/viewclient.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ def __dumpWindowsInformation(self):
571571
dww = self.device.shell('dumpsys window windows')
572572
if DEBUG_WINDOWS: print >> sys.stderr, dww
573573
lines = dww.split('\n')
574-
widRE = re.compile('^ *Window #%s Window{%s %s.*}:' %
574+
widRE = re.compile('^ *Window #%s Window{%s (u\d+ )?%s.*}:' %
575575
(__nd('num'), __nh('winId'), __ns('activity', greedy=True)))
576576
currentFocusRE = re.compile('^ mCurrentFocus=Window{%s .*' % __nh('winId'))
577577
viewVisibilityRE = re.compile(' mViewVisibility=0x%s ' % __nh('visibility'))
@@ -1076,7 +1076,7 @@ def connectToDeviceOrExit(timeout=60, verbose=False, ignoresecuredevice=False, s
10761076
if secure == '1' and debuggable == '0' and not ignoresecuredevice and version < 16:
10771077
print >> sys.stderr, "%s: ERROR: Device is secure, AndroidViewClient won't work." % progname
10781078
sys.exit(2)
1079-
if re.search("[.*()+]", serialno):
1079+
if re.search("[.*()+]", serialno) and not re.search("(\d{1,3}\.){3}\d{1,3}"):
10801080
# if a regex was used we have to determine the serialno used
10811081
serialno = ViewClient.__obtainDeviceSerialNumber(device)
10821082
return device, serialno

0 commit comments

Comments
 (0)