feat: Telegram 双通道抓取、PC 调试台与 Hook 后台转发修复
v2.2.1 更新说明: - 新增 xposed-module(Telegram/微信/SQLite Hook),双 APK + LSPosed 作用域 - HookMessageReceiver 后台直接 DebugForwarder + goAsync,修复 notiMessage 退后台丢消息 - MessageLogStore 日志持久化;AppConfig 调试/上传开关;PC 调试台 debug-server - 健康检查去掉联网限制;通知/Hook 通道增加诊断日志 - 安装脚本 install-full/configure-lsposed/start-debug-server;文档 CHANGELOG + HOOK_GUIDE
This commit is contained in:
@@ -4,16 +4,22 @@ import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.miraclegarden.smsmessage.Activity.NotificationActivity;
|
||||
import com.miraclegarden.smsmessage.App;
|
||||
import com.miraclegarden.smsmessage.AppConfig;
|
||||
import com.miraclegarden.smsmessage.MessageInfo;
|
||||
import com.miraclegarden.smsmessage.network.DebugForwarder;
|
||||
|
||||
/**
|
||||
* 接收 Xposed 模块转发的消息(前台 Hook 通道)。
|
||||
* 接收 Xposed 模块转发的消息(Hook 通道)。
|
||||
* 在 Receiver 内直接转发到 PC,避免依赖 startService(后台易被系统拦截)。
|
||||
*/
|
||||
public class HookMessageReceiver extends BroadcastReceiver {
|
||||
|
||||
private static final String TAG = "HookMessageReceiver";
|
||||
|
||||
public static final String ACTION_HOOK_MESSAGE = "com.miraclegarden.smsmessage.action.HOOK_MESSAGE";
|
||||
public static final String EXTRA_PACKAGE_NAME = "packageName";
|
||||
public static final String EXTRA_TITLE = "title";
|
||||
@@ -34,11 +40,13 @@ public class HookMessageReceiver extends BroadcastReceiver {
|
||||
String source = intent.getStringExtra(EXTRA_SOURCE);
|
||||
|
||||
if (TextUtils.isEmpty(packageName) || TextUtils.isEmpty(content)) {
|
||||
Log.w(TAG, "ignore hook: empty package or content");
|
||||
return;
|
||||
}
|
||||
|
||||
MessageInfo messageInfo = App.getMessageByNotiList(context, packageName);
|
||||
if (messageInfo == null) {
|
||||
Log.w(TAG, "ignore hook: not in monitor list, pkg=" + packageName);
|
||||
NotificationActivity.sendMessage("[Hook] 未配置监听: " + packageName);
|
||||
return;
|
||||
}
|
||||
@@ -47,7 +55,26 @@ public class HookMessageReceiver extends BroadcastReceiver {
|
||||
title = messageInfo.getAppName();
|
||||
}
|
||||
|
||||
NotificationActivity.sendMessage("[Hook/" + source + "] " + title + " " + content);
|
||||
NotificationService.submitFromHook(context, messageInfo, title, content, timestamp);
|
||||
Log.i(TAG, "hook received: pkg=" + packageName + " source=" + source + " title=" + title);
|
||||
|
||||
final String finalTitle = title;
|
||||
NotificationActivity.sendMessage("[Hook/" + source + "] " + finalTitle + " " + content);
|
||||
|
||||
Context appContext = context.getApplicationContext();
|
||||
PendingResult pendingResult = goAsync();
|
||||
|
||||
Runnable finish = pendingResult::finish;
|
||||
Runnable afterForward = () -> {
|
||||
if (AppConfig.ENABLE_SERVER_UPLOAD) {
|
||||
NotificationService.submitFromHook(appContext, messageInfo, finalTitle, content, timestamp, source);
|
||||
}
|
||||
finish.run();
|
||||
};
|
||||
|
||||
if (AppConfig.ENABLE_DEBUG_FORWARD) {
|
||||
DebugForwarder.forward(appContext, messageInfo, finalTitle, content, timestamp, source, afterForward);
|
||||
} else {
|
||||
afterForward.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user