Feature: Report client run logs from the Android client
Before this change the Android client's run log went to logcat only: Logger's init tried to create a log directory, enable was true, and the in-memory ring that MCP's get_client_log reads was never fed, so the tool returned an empty log for APK hosts. Logger now has an Android branch that skips the directory and file writer and keeps only the ring, which is always written regardless of enable. Mprintf carries the source file and line as on Windows/Linux, and both android_log (Mprintf) and a new android_log_tag (platform LOGI/LOGE, LOGI_SH/LOGE_SH) print to logcat and append to the ring. A new ClientLogThread opens a sub-connection on COMMAND_QUERY_LOG and lets ClientLogHandler send TOKEN_REPORT_LOG plus the full ring as the first packet. It has to be a sub-connection: the server takes the first packet and calls CancelIO, which would drop the main connection. The server side allows get_client_log on kPlatApk and decodes the payload as UTF-8 like the other POSIX clients. Verified on the emulator against a local debug server: get_client_log returned 21 UTF-8 lines including [file:line] Mprintf output, LOGI lines, and the ClientLogThread handshake. Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
51747dc0ea
commit
d365a4f948
5 files changed
+99
-14
No files matched your search
@@ -2,6 +2,7 @@
|
||||
// Android 屏幕处理器:管理截屏子连接,接收 Java 侧 MediaCodec 输出的 H.264 NALU,
|
||||
// 按协议封装后通过子连接发送给服务端。
|
||||
#include "common/commands.h"
|
||||
#include "common/logger.h"
|
||||
#include "client/IOCPClient.h"
|
||||
#include <atomic>
|
||||
#include <mutex>
|
||||
@@ -13,8 +14,10 @@
|
||||
#include <cinttypes>
|
||||
#include <android/log.h>
|
||||
|
||||
#define LOGI_SH(...) __android_log_print(ANDROID_LOG_INFO, "YAMA_SCR", __VA_ARGS__)
|
||||
#define LOGE_SH(...) __android_log_print(ANDROID_LOG_ERROR, "YAMA_SCR", __VA_ARGS__)
|
||||
// 与 main.cpp 的 LOGI/LOGE 同理:进 logcat 的同时进 Logger 内存 ring(MCP get_client_log)。
|
||||
// 抓屏链路的问题(黑屏、码率)只能靠这些日志定位,必须能被主控取到。
|
||||
#define LOGI_SH(...) android_log_tag(ANDROID_LOG_INFO, "YAMA_SCR", __VA_ARGS__)
|
||||
#define LOGE_SH(...) android_log_tag(ANDROID_LOG_ERROR, "YAMA_SCR", __VA_ARGS__)
|
||||
|
||||
extern uint64_t g_myClientID;
|
||||
// 定义在 main.cpp,供子连接的 OnReceive 调用
|
||||
|
||||
Reference in new issue
Block a user