Skip to content

Commit 57c47dd

Browse files
author
gb112211
committed
update function get_focused_package_and_activity
1 parent 32d41d5 commit 57c47dd

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

python/scriptUtils/utils.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,11 @@ def kill_process(pkg_name):
143143

144144
#获取设备上当前应用的包名与activity
145145
def get_focused_package_and_activity():
146-
pattern = re.compile(r"[a-zA-Z0-9\.]+/.[a-zA-Z0-9\.]+")
147-
out = shell("dumpsys window w | %s \/ | %s name=" %(find_util, find_util)).stdout.read()
146+
#pattern = re.compile(r"[a-zA-Z0-9\.]+/.[a-zA-Z0-9\.]+")
147+
#out = shell("dumpsys window w | %s \/ | %s name=" %(find_util, find_util)).stdout.read()
148148

149-
return pattern.findall(out)[0]
149+
#return pattern.findall(out)[0]
150+
return shell("dumpsys activity | findstr mFocusedActivity").stdout.read().split()[-1][:-1]
150151

151152
#获取当前应用的包名
152153
def get_current_package_name():

0 commit comments

Comments
 (0)