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

[BUG] 规则不触发 #824

Open
yanmuq opened this issue Dec 16, 2024 · 14 comments
Open

[BUG] 规则不触发 #824

yanmuq opened this issue Dec 16, 2024 · 14 comments

Comments

@yanmuq
Copy link

yanmuq commented Dec 16, 2024

日志文件

https://f.gkd.li/18155269

BUG描述(文字/截图/视频)

{
  id: 'com.android.permissioncontroller',
  name: '权限控制器',
  groups: [
    {
      name: '权限控制弹窗',
      key: 0,
      fastQuery: true,
      matchRoot: true,
      actionMaximum: 1,
      priorityTime: 10000,
      order: -10,
      matchDelay: 800,
      matchTime: 4000,
      resetMatch: 'app',
      rules: [
        {
          matches: [
            '[text$="访问相机?"] <<4 LinearLayout[vid="grant_dialog_container"] >3 Button[index=1]'
          ],
          snapshotUrls: [
            'https://i.gkd.li/i/18154250'
          ]
        }
      ]
    }
  ]
}

此规则添加完成后,存在无法触发问题,需要反复打开关闭此规则后才能匹配

期望行为(文字/截图/视频)

添加规则后立即可以匹配触发

实际行为(文字/截图/视频)

添加规则后无法立即匹配触发

@lisonge
Copy link
Member

lisonge commented Dec 16, 2024

麻烦上传视频复现示例,我看日志中 16 号/17号 均显示匹配列表中存在当前规则

@yanmuq
Copy link
Author

yanmuq commented Dec 17, 2024

12.17.mp4

@yanmuq
Copy link
Author

yanmuq commented Dec 17, 2024

此条规则不触发问题在最近新版本出现,10月左右稳定使用

@lisonge
Copy link
Member

lisonge commented Dec 17, 2024

麻烦把刚刚的日志发出来一下

@yanmuq
Copy link
Author

yanmuq commented Dec 17, 2024

@lisonge
Copy link
Member

lisonge commented Dec 17, 2024

release.zip

试试这个本地编译的版本

@yanmuq
Copy link
Author

yanmuq commented Dec 17, 2024

目前正常,我使用观察一下

@lisonge
Copy link
Member

lisonge commented Dec 17, 2024

你上面的规则里面的 fastQuery 是不起作用的,可以优化如下

matches:[
'[vid="permission_message"][text$="访问相机?"]',
'[vid="permission_allow_one_time_button"]'
]
{
  id: 'com.android.permissioncontroller',
  name: '权限控制器',
  groups: [
    {
      name: '权限控制弹窗',
      key: 0,
      fastQuery: true,
      matchRoot: true,
      actionMaximum: 1,
      priorityTime: 10000,
      order: -10,
      matchDelay: 800,
      matchTime: 4000,
      resetMatch: 'app',
      rules: [
        {
          matches: [
            '[vid="permission_message"][text$="访问相机?"]',
            '[vid="permission_allow_one_time_button"]',
          ],
          snapshotUrls: ['https://i.gkd.li/i/18154250'],
        },
      ],
    },
  ],
}

@yanmuq
Copy link
Author

yanmuq commented Dec 17, 2024

这是新的方法吗,我去看一下文档,

lisonge added a commit that referenced this issue Dec 17, 2024
@afyygh
Copy link

afyygh commented Dec 18, 2024

你上面的规则里面的 fastQuery 是不起作用的,可以优化如下

matches:[
'[vid="permission_message"][text$="访问相机?"]',
'[vid="permission_allow_one_time_button"]'
]
{
  id: 'com.android.permissioncontroller',
  name: '权限控制器',
  groups: [
    {
      name: '权限控制弹窗',
      key: 0,
      fastQuery: true,
      matchRoot: true,
      actionMaximum: 1,
      priorityTime: 10000,
      order: -10,
      matchDelay: 800,
      matchTime: 4000,
      resetMatch: 'app',
      rules: [
        {
          matches: [
            '[vid="permission_message"][text$="访问相机?"]',
            '[vid="permission_allow_one_time_button"]',
          ],
          snapshotUrls: ['https://i.gkd.li/i/18154250'],
        },
      ],
    },
  ],
}

你好,想问一下
matches: ['[vid="permission_message"][text$="访问相机?"]', '[vid="permission_allow_one_time_button"]' ]

matches: ['[text$="访问相机?"] <<4 LinearLayout[vid="grant_dialog_container"] >3 [vid="permission_allow_one_time_button"]' ]
这两种写法,在匹配效率和匹配耗时有什么区别吗,那种写法更好呢

@lisonge
Copy link
Member

lisonge commented Dec 18, 2024

这两种写法,在匹配效率和匹配耗时有什么区别吗,那种写法更好呢

前者只需要界面上有两个按钮就行了,不关心它们的关系,查询速度更快

后者不仅要求两个按钮存在,还描述了两个按钮的关系


查询速度看获取新节点的次数,次数越多,查询越慢,前者是 1+1,后者是 1+3+(4 或其他)

这个界面是申请权限的界面,属于简单不会变化的那种,使用前者就足够


后者适用在各种广告SDK,这种界面没有 text/id/vid/desc,只能通过 name 和 节点结构查询

@afyygh
Copy link

afyygh commented Dec 18, 2024

感谢解答🙏🙏

xanderwang pushed a commit to xanderwang/gkd that referenced this issue Dec 20, 2024
@gyj2008
Copy link

gyj2008 commented Dec 21, 2024

Screenrecorder-2024-12-21-18-51-29-994.mp4

这是什么情况?

@lisonge
Copy link
Member

lisonge commented Dec 21, 2024

这是什么情况?

我猜是因为有符合选择器的节点,所以触发点击了,只是从用户角度看,这个节点在开始不可见而已,优化一下选择器就行了

另外你说的这个问题和本 issue 无关

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

4 participants