From 63f0bd73a3775714f5645f6a38f493e18e64c79a Mon Sep 17 00:00:00 2001 From: AIsouler Date: Mon, 4 Nov 2024 14:57:53 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=BA=94=E7=94=A8=E5=8C=85=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/appDeprecatedKeys.ts | 5 + src/apps/com.miui.packageinstaller.ts | 304 +++----------------------- 2 files changed, 41 insertions(+), 268 deletions(-) diff --git a/src/appDeprecatedKeys.ts b/src/appDeprecatedKeys.ts index 4a40c706..a18e9a61 100644 --- a/src/appDeprecatedKeys.ts +++ b/src/appDeprecatedKeys.ts @@ -583,6 +583,11 @@ const appDeprecatedKeys: RawDeprecatedKeysSetting[] = [ name: '米游社', deprecatedKeys: [4, 5], }, + { + id: 'com.miui.packageinstaller', + name: '应用包管理组件', + deprecatedKeys: [8, 9, 10, 11, 12], + }, ]; const map: Map = new Map(); diff --git a/src/apps/com.miui.packageinstaller.ts b/src/apps/com.miui.packageinstaller.ts index cbbf6d02..d97993a1 100644 --- a/src/apps/com.miui.packageinstaller.ts +++ b/src/apps/com.miui.packageinstaller.ts @@ -27,284 +27,24 @@ export default defineGkdApp({ ], }, { - key: 8, - name: '功能类-安装来源不可信', - desc: '点击[授权本次安装]', - fastQuery: true, - activityIds: [ - 'com.miui.packageInstaller.ui.InstallPrepareAlertActivity', - 'com.miui.packageInstaller.NewPackageInstallerActivity', - ], - rules: [ - { - key: 0, - position: { - left: 'width * 0.8743', - top: 'width * 0.1202', - }, - matches: 'LinearLayoutCompat > [text*="授权本次安装"]', - exampleUrls: - 'https://m.gkd.li/57941037/e30144c7-c895-4950-a91d-9ce56a8570c8', - snapshotUrls: 'https://i.gkd.li/i/14456398', - }, - { - key: 1, - position: { - left: 'width * 0.6663', - top: 'width * 0.1012', - }, - matches: 'ViewGroup > [text*="授权本次安装"]', - exampleUrls: - 'https://m.gkd.li/57941037/4bcc94e7-17cb-4887-9e1d-067cf823b109', - snapshotUrls: 'https://i.gkd.li/i/14925748', - }, - ], - }, - { - key: 9, - name: '功能类-自动第三方安装应用', - desc: '自动允许第三方应用调用安装,安装应用', + key: 13, + name: '功能类-自动安装/更新应用', fastQuery: true, rules: [ { key: 0, - activityIds: [], - matches: - 'TextView[text*="尝试安装应用"] < LinearLayout +2n LinearLayout > Button[text="继续"]', - snapshotUrls: 'https://i.gkd.li/i/12874746', - }, - { - key: 1, - activityIds: [ - 'com.miui.packageInstaller.ui.InstallPrepareAlertActivity', - 'com.miui.packageInstaller.NewInstallerPrepareActivity', - ], - matches: '@[text="允许"] + [text="禁止"]', - snapshotUrls: [ - 'https://i.gkd.li/i/13054478', - 'https://i.gkd.li/i/13399425', - ], - }, - ], - }, - { - key: 10, - name: '功能类-自动安装应用', - desc: '启用后安装高风险应用将自动完成,请自行评估风险决定是否启用', - fastQuery: true, - rules: [ - // 正常安装 - { - key: 0, - name: '点击"继续安装"', - activityIds: [ - 'com.miui.packageInstaller.ui.InstallPrepareAlertActivity', - 'com.miui.packageInstaller.NewInstallerPrepareActivity', - ], - matches: '[text="继续安装"]', - snapshotUrls: [ - 'https://i.gkd.li/i/12818034', - 'https://i.gkd.li/i/12818054', - 'https://i.gkd.li/i/12889120', - 'https://i.gkd.li/i/16322775', - ], - }, - { - key: 1, - name: '点击"继续"', - activityIds: 'com.miui.packageInstaller.NewInstallerPrepareActivity', - matches: '[text="取消"] - @*[clickable=true] >2 [text="继续"]', - snapshotUrls: 'https://i.gkd.li/i/14392314', - }, - - // 需勾选"已了解此应用未经安全检测"才能继续安装 - { - key: 2, - name: '勾选"已了解此应用未经安全检测"', + name: '点击[安装]/[更新]', activityIds: 'com.miui.packageInstaller.NewInstallerPrepareActivity', matches: - '[id="com.miui.packageinstaller:id/install_checked"][checked=false]', + '@FrameLayout[clickable=true] > LinearLayout[childCount=1] > [text^="继续"][text.length=4]', + exampleUrls: 'https://e.gkd.li/bd3e2764-4978-44ed-93d3-f176c23c3ec4', snapshotUrls: [ - 'https://i.gkd.li/i/12888410', // 未勾选 - 'https://i.gkd.li/i/12889120', // 已勾选 - ], - }, - - // 需勾选"已了解此应用存在高风险"才能继续安装 - { - key: 3, - name: '点击"了解风险"', - activityIds: 'com.miui.packageInstaller.NewInstallerPrepareActivity', - matches: '@[text="了解风险"] + [text="取消安装"]', - snapshotUrls: 'https://i.gkd.li/i/12889135', - }, - { - key: 4, - name: '勾选"已了解此应用存在高风险"', - activityIds: 'com.miui.packageInstaller.NewInstallerPrepareActivity', - matches: '[text^="已了解此"][checked=false]', - snapshotUrls: [ - 'https://i.gkd.li/i/12889137', // 未勾选 - 'https://i.gkd.li/i/12889148', // 已勾选 - 'https://i.gkd.li/i/16171390', + 'https://i.gkd.li/i/16487278', + 'https://i.gkd.li/i/16487282', ], }, { - key: 5, - name: '点击"仍然安装"', - activityIds: [ - 'com.miui.packageInstaller.NewInstallerPrepareActivity', - 'com.miui.packageInstaller.ui.InstallPrepareAlertActivity', - ], - matches: '[text="仍然安装"]', - snapshotUrls: [ - 'https://i.gkd.li/i/12889148', - 'https://i.gkd.li/i/16187625', - ], - }, - - // 安装完成 - { - key: 6, - name: '点击"完成"', - forcedTime: 30000, // 安装/更新时间过长会导致后续规则不触发 - activityIds: [ - 'com.miui.packageInstaller.ui.normalmode.InstallProgressActivity', - 'com.miui.packageInstaller.InstallProgressActivity', - 'com.miui.packageInstaller.ui.securemode.PureInstallProgressActivity', - ], - matches: - '[id="com.miui.packageinstaller:id/done_layout"] > [text="完成"]', - snapshotUrls: [ - 'https://i.gkd.li/i/12818044', - 'https://i.gkd.li/i/13229404', - 'https://i.gkd.li/i/13501872', - ], - }, - ], - }, - { - key: 11, - name: '功能类-自动更新应用', - fastQuery: true, - rules: [ - // 正常更新 - { - key: 0, - name: '点击"继续更新"-1', - activityIds: [ - 'com.miui.packageInstaller.ui.InstallPrepareAlertActivity', - 'com.miui.packageInstaller.NewInstallerPrepareActivity', - ], - matches: ['[text="取消更新"]', '[text="继续更新"]'], - snapshotUrls: [ - 'https://i.gkd.li/i/12817988', - 'https://i.gkd.li/i/12910080', - 'https://i.gkd.li/i/14392274', - ], - }, - { - key: 1, - name: '点击"继续更新"-2', - activityIds: 'com.miui.packageInstaller.NewInstallerPrepareActivity', - matches: '@[text="继续更新"] + [text="取消更新"]', - snapshotUrls: [ - 'https://i.gkd.li/i/13024731', - 'https://i.gkd.li/i/13038465', - ], - }, - - // 需勾选"已了解此安装包未经安全检测"才能继续更新 - { - key: 2, - name: '勾选"已了解此安装包未经安全检测"', - activityIds: [ - 'com.miui.packageInstaller.ui.InstallPrepareAlertActivity', - 'com.miui.packageInstaller.NewInstallerPrepareActivity', - ], - matches: '[text="已了解此安装包未经安全检测"][checked=false]', - snapshotUrls: [ - 'https://i.gkd.li/i/13024730', // 未勾选 - 'https://i.gkd.li/i/13024731', // 已勾选 - ], - }, - - // 更新完成 - { - key: 3, - name: '点击"完成"', - forcedTime: 30000, // 安装/更新时间过长会导致后续规则不触发 - activityIds: [ - 'com.miui.packageInstaller.ui.normalmode.InstallProgressActivity', - 'com.miui.packageInstaller.InstallProgressActivity', - ], - matches: - '[id="com.miui.packageinstaller:id/done_layout"] > [text="完成"]', - snapshotUrls: [ - 'https://i.gkd.li/i/12817999', - 'https://i.gkd.li/i/13255733', - ], - }, - ], - }, - { - key: 12, - name: '功能类-澎湃-自动安装/更新', - desc: '启用后安装高风险应用将自动完成,请自行评估风险决定是否启用', - fastQuery: true, - rules: [ - // 正常安装 - { - key: 0, - name: '点击【继续更新】/【继续】', - activityIds: - 'com.miui.packageInstaller.ui.InstallPrepareAlertActivity', - matches: '@FrameLayout > LinearLayout > [text*="继续"]', - snapshotUrls: [ - 'https://i.gkd.li/i/14083552', //继续更新, - 'https://i.gkd.li/i/14083554', //继续 - ], - }, - - // 需授权安装 - { - key: 1, - name: '点击【无视风险安装】', - activityIds: - 'com.miui.packageInstaller.ui.InstallPrepareAlertActivity', - matches: '[text="无视风险安装"]', - snapshotUrls: 'https://i.gkd.li/i/14653062', - }, - { - key: 2, - preKeys: 1, - activityIds: - 'com.miui.packageInstaller.ui.InstallPrepareAlertActivity', - name: '点击【继续】', - matches: '[text="继续"]', - snapshotUrls: 'https://i.gkd.li/i/14653087', - }, - { - key: 3, - preKeys: 2, - name: '点击右上角三点展开菜单', - activityIds: - 'com.miui.packageInstaller.ui.InstallPrepareAlertActivity', - matches: - '@LinearLayout[index=0] > [vid="action_menu_item_child_icon"]', - snapshotUrls: 'https://i.gkd.li/i/14654045', - }, - { - key: 4, - preKeys: 3, - name: '授权本次安装', - activityIds: 'com.miui.packageInstaller.NewInstallerPrepareActivity', - matches: '@[clickable=true] > [text="单次授权安装"]', - snapshotUrls: 'https://i.gkd.li/i/14653096', - }, - // 完成 - { - key: 5, + // preKeys: [0], 有概率不触发 name: '点击[完成]', activityIds: 'com.miui.packageInstaller.ui.normalmode.InstallProgressActivity', @@ -314,5 +54,33 @@ export default defineGkdApp({ }, ], }, + { + key: 14, + name: '功能类-自动允许应用安装软件', + fastQuery: true, + activityIds: 'com.miui.packageInstaller.ui.InstallPrepareAlertActivity', + rules: [ + { + key: 0, + name: '点击[记住我的选择]', + matches: [ + '[text$="安装应用?"]', + 'CheckBox[text="记住我的选择"][checked=false]', + ], + exampleUrls: 'https://e.gkd.li/af834ca4-744a-485f-bec6-9802979fe949', + snapshotUrls: [ + 'https://i.gkd.li/i/16487366', + 'https://i.gkd.li/i/16487389', + ], + }, + { + preKeys: [0], + name: '点击[允许]', + matches: '[text="允许"]', + exampleUrls: 'https://e.gkd.li/4f4ce827-6b74-4b55-8fed-5e009acd4bbd', + snapshotUrls: 'https://i.gkd.li/i/16487365', + }, + ], + }, ], });