Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

基于fragment切换后无法拿到新显示内容 #33

Open
helloworld10010 opened this issue Jun 26, 2023 · 3 comments
Open

基于fragment切换后无法拿到新显示内容 #33

helloworld10010 opened this issue Jun 26, 2023 · 3 comments

Comments

@helloworld10010
Copy link

切换后找不到按钮,明明在。已经使用android:accessibilityEventTypes="typeAllMask"

@helloworld10010
Copy link
Author

helloworld10010 commented Jun 26, 2023

清除后台目标应用,从act.startActivity(act.packageManager.getLaunchIntentForPackage(TARGET_PROCESS))进去执行查找的找不到,手动打开目标应用home到后台,再执行自动程序就正常了。已经使用waitforApp act.startActivity(act.packageManager.getLaunchIntentForPackage(TARGET_PROCESS))
if(waitForApp(TARGET_PROCESS,5000).also { toast( if(it) "success" else "fail") })

@helloworld10010
Copy link
Author

helloworld10010 commented Jun 26, 2023

试来试去,应该跟rootNodesOfAllWindows方法有关,不知道什么原理,改代码让它走<=LOLLIPOP分支就好了
小米6 MIUI11.0.5 android版本9 api28
compileSdk33 targetSdk31

@dujianchi
Copy link

试来试去,应该跟rootNodesOfAllWindows方法有关,不知道什么原理,改代码让它走<=LOLLIPOP分支就好了 小米6 MIUI11.0.5 android版本9 api28 compileSdk33 targetSdk31

哥们,怎么操作的?直接把

fun rootNodesOfAllWindows(): ViewChildList =
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                ViewChildList().also { list ->
                    AutoApi.windows()?.sortedByDescending {
                        if (it.isActive) Int.MAX_VALUE else it.layer
                    }?.forEach { win ->
                        list.add(
                            win.root?.let { r -> ViewNode(r.also(AccessibilityNodeInfo::refresh)) }
                        )
                    } ?: list.add(activeWinNode())
                }
            } else {
                ViewChildList().also { list ->
                    list.add(activeWinNode())
                }
            }

改成

fun rootNodesOfAllWindows(): ViewChildList =
            ViewChildList().also { list ->
                AutoApi.windows()?.sortedByDescending {
                    if (it.isActive) Int.MAX_VALUE else it.layer
                }?.forEach { win ->
                    list.add(
                        win.root?.let { r -> ViewNode(r.also(AccessibilityNodeInfo::refresh)) }
                    )
                } ?: list.add(activeWinNode())
            }

吗?其他的不用动?还是继续用SF去查找控件吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants