Feat: TV remote control via D-pad focus navigation using AccessibilityService

This commit is contained in:
yuanyuanxiang
2026-06-22 17:57:51 +02:00
parent 45553ec5b6
commit 218ee4f43d
22 changed files with 631 additions and 67 deletions

17
common/logger.cpp Normal file
View File

@@ -0,0 +1,17 @@
#include "logger.h"
#if defined(__ANDROID__)
static void (*androidLog)(const char*) = nullptr;
void UseAndroidLog(void (*cb)(const char*)) {
androidLog = cb;
}
__attribute__((format(printf, 1, 2)))
void android_log(const char* fmt, ...) {
char buf[256];
va_list ap; va_start(ap, fmt); vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap);
__android_log_print(ANDROID_LOG_DEBUG, "YAMA_NET", "%s", buf);
if (androidLog) androidLog(buf);
}
#endif

View File

@@ -336,6 +336,15 @@ inline const char* getFileName(const char* path)
#else
#define Mprintf(format, ...) printf(format, ##__VA_ARGS__)
#endif
#elif defined(__ANDROID__)
#include <android/log.h>
#include <cstdarg>
#ifdef Mprintf
#undef Mprintf
#endif
void UseAndroidLog(void (*cb)(const char*));
void android_log(const char* fmt, ...);
#define Mprintf android_log
#else
// Linux: 覆盖 commands.h 中的 printf 回退定义,改用 Logger 写文件
#ifdef Mprintf

View File

@@ -47,4 +47,4 @@ struct RttEstimator {
// 进程级全局:所有翻译单元共享同一份估算器与心跳间隔
inline RttEstimator g_rttEstimator;
inline int g_heartbeatInterval = 5; // 默认心跳间隔(秒),可被服务端 CMD_MASTERSETTING 更新
inline int g_heartbeatInterval = 30; // 默认心跳间隔(秒),可被服务端 CMD_MASTERSETTING 更新