feat: M6.10–M6.19 批量收编 + M6.19 推卡验收

- M7 launcher 重写 5 期(虚拟化宫格/meow_theme 单一权威/横幅动画/自定义 PIN 键盘)
- OOM 通用化(cachegov 上收 SDK)、自动切歌根治、meowpanel jv_free 泄漏修复、Hello 滚动卡顿修复
- ncm 歌词 UI / 媒体通知封面 / 封面分辨率 640
- 5 bug 修复:ncm 后台化 UI 叠层+点击穿透、再进 ncm 桌面叠层、播放页新旧 UI 叠层抢刷脏区(meow_ui_gfx 恢复边沿整帧重画)、PIN 亮屏亮度跳(keys.c meow_panel_on 按 settings_brightness_clamped 恢复)、通知中心封面显歌单封面(cover.c save_cover_raw 加 is_song + 命中块守卫)
- 四 App 统一重链新 meow_ui.a 51caee4a;M6.19=0.8.19 固件 2d2331f2 推卡自刷验收全绿
This commit is contained in:
AskaEth committed 2026-09-03 12:16:01 +08:00
1 parent c2ee7626a4
commit 3d70a3dd2c
176 files changed
+15507 -597

No files matched your search

+171
View File
@@ -0,0 +1,171 @@
/* bench/vol_sync_sim.c — 任务1:开播前「系统当前音量 → audiod」下发宿主验证。
*
* 场景(0 真实请求/0 真实 audiod):fake audiod socket(AF_UNIX SOCK_STREAM)+ 临时 settings.conf
* (audio.volume = <V>,读改写单键同源同键)。调 audio_out_sync_volume(),断言 fake audiod 收到
* 一条 MSG_AUDIO_VOLUME 帧,且 pct == settings 的 audio.volume。这验证「打开音频会话时把系统
* 音量同步下发到 audiod」的根因修复(未播放时 DAC 停在默认/残留音量 → 动音量键才追设定值)。
*
* 另验证:音量语义只传 pct(0-100)——反转/真静音(255) 由 audiod dac_vol_set 负责,本层不碰。
*
* 编译(宿主,ncm_app 目录下):
* gcc -O1 -DJSMN_HEADER -I. -Icore -I../sdk -I../meow_launcherd \
* -c bench/vol_sync_sim.c -o /tmp/vs.o
* gcc -O1 -DJSMN_HEADER -I. -Icore -I../sdk -I../meow_launcherd \
* -c app/play/audio_out.c -o /tmp/vs_ao.o
* gcc -O1 -o vol_sync_sim /tmp/vs.o /tmp/vs_ao.o -lpthread
* 运行:./vol_sync_sim (0 网络;PASS/FAIL 退出码)
*/
#include "../app/ncm_app_internal.h"
#include "meow_ipc.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <sys/un.h>
ncm_app_state_t g_st;
ncm_play_run_t g_play;
volatile int g_app_quit = 0;
volatile int g_net_ready = 1;
int g_host_mock = 0;
size_t ncm_strlcpy(char *dst, const char *src, size_t sz)
{
size_t n = 0;
if (sz) { while (src[n] && n < sz - 1) { dst[n] = src[n]; n++; } dst[n] = 0; }
while (src[n]) n++;
return n;
}
void meow_log(meow_log_level lvl, const char *fmt, ...) { (void)lvl; (void)fmt; }
/* audio_out.c 引用但本 sim 不经 SDK 调用的符号:只链不跑就满足链接 */
int meow_audio_open(int rate, int ch, int fmt) { (void)rate;(void)ch;(void)fmt; return -1; }
int meow_audio_write(const void *pcm, int frames) { (void)pcm; return frames; }
int meow_audio_pause(int sid, int paused) { (void)sid;(void)paused; return 0; }
int meow_audio_close(int sid) { (void)sid; return 0; }
int meow_audio_query(meow_audio_state *out) { (void)out; return -1; }
/* ---- fake audiod ---- */
static const char *g_sock = "/tmp/vol_sync_audiod.sock";
static uint16_t g_got_type = 0;
static int32_t g_got_pct = -1;
static int g_got = 0;
static volatile int g_nconn = 0; /* 收到多少条连接 */
static volatile int g_nframe = 0; /* 收到多少条 VOLUME 帧 */
static volatile int g_stop = 0;
/* fake audiod:接受多条连接(上限 32,超过即停——失败才触发,正常不该超),每条只读一帧
* VOLUME 然后等对端 EOF(ncm 侧 close)。统计连接数与帧数,供「重复 sync 不新建连接」断言。 */
static void *server(void *arg)
{
(void)arg;
unlink(g_sock);
int lfd = socket(AF_UNIX, SOCK_STREAM, 0);
if (lfd < 0) return NULL;
struct sockaddr_un a;
memset(&a, 0, sizeof a);
a.sun_family = AF_UNIX;
strncpy(a.sun_path, g_sock, sizeof a.sun_path - 1);
if (bind(lfd, (struct sockaddr *)&a, sizeof a) != 0) { close(lfd); return NULL; }
listen(lfd, 16);
int lfl = fcntl(lfd, F_GETFL, 0);
if (lfl >= 0) fcntl(lfd, F_SETFL, lfl | O_NONBLOCK); /* 非阻塞:g_stop 能及时退出 */
while (!g_stop && g_nconn < 32) {
int fd = accept(lfd, NULL, NULL);
if (fd < 0) { usleep(20000); continue; } /* EAGAIN:无连接,短睡重试 */
g_nconn++;
/* 读满一帧(20B)或 EOF:stream socket read 可分段返回,须循环凑满再判。 */
uint8_t frame[MEOW_IPC_HDR_LEN + sizeof(int32_t)];
ssize_t n = 0;
while (n < (ssize_t)sizeof frame) {
ssize_t r = read(fd, frame + n, sizeof frame - (size_t)n);
if (r <= 0) break; /* EOF / 错 */
n += r;
}
if (n >= (ssize_t)(MEOW_IPC_HDR_LEN + sizeof(int32_t))) {
uint32_t magic, len;
uint16_t ver, type;
memcpy(&magic, frame, 4); memcpy(&ver, frame + 4, 2); memcpy(&type, frame + 6, 2);
memcpy(&len, frame + 12, 4);
if (magic == MEOW_IPC_MAGIC && ver == MEOW_IPC_VERSION && type == MSG_AUDIO_VOLUME) {
g_got_type = type;
memcpy(&g_got_pct, frame + 16, sizeof g_got_pct);
g_got = 1;
g_nframe++;
}
}
close(fd);
}
close(lfd);
return NULL;
}
int main(void)
{
int fail = 0;
/* 临时 settings.conf:audio.volume = 24(读改写单键同源键),另带 max 干扰键 */
const char *cfg = "/tmp/vol_sync_settings.conf";
FILE *f = fopen(cfg, "w");
if (!f) { printf("FAIL cannot write settings\n"); return 1; }
fprintf(f, "# meow-settings 1\naudio.volume = 24\naudio.volume_max = 50\ndisplay.brightness = 80\n");
fclose(f);
setenv("MEOW_SETTINGS_FILE", cfg, 1);
setenv("MEOW_AUDIO_SOCK", g_sock, 1);
pthread_t th;
if (pthread_create(&th, NULL, server, NULL) != 0) { printf("FAIL server thread\n"); return 1; }
usleep(50000); /* 等 fake audiod listen */
/* 第一次 sync(首次 open):应下发一帧 VOLUME,pct==settings */
audio_out_sync_volume();
usleep(50000); /* 等服务线程 accept+读帧(主/服务线程异步) */
if (!g_got) { printf("FAIL fake audiod received no frame\n"); fail = 1; }
else if (g_got_type != MSG_AUDIO_VOLUME) {
printf("FAIL expected MSG_AUDIO_VOLUME (0x%04x) got 0x%04x\n", MSG_AUDIO_VOLUME, g_got_type);
fail = 1;
} else if (g_got_pct != 24) {
printf("FAIL expected pct=24 (settings audio.volume) got %d\n", (int)g_got_pct);
fail = 1;
} else {
printf("PASS audiod sync volume: type=0x%04x pct=%d == settings.audio.volume\n",
g_got_type, (int)g_got_pct);
}
/* 连接风暴回归(§2026-09-02 fd=N accept 根因):音量未变时反复 sync 不得新建连接。
* 模拟边下边播/切歌期频繁 audio_out_open → audio_out_sync_volume(同值,不重发)。 */
for (int i = 0; i < 50; i++) audio_out_sync_volume(); /* 同值 50 次:应零新增连接 */
usleep(50000);
if (g_nconn != 1) {
printf("FAIL unchanged-volume re-sync created %d connections (expect 1)\n", (int)g_nconn);
fail = 1;
} else {
printf("PASS unchanged-volume re-sync: 50 calls -> 1 connection (storm eliminated)\n");
}
/* 值变才重发:settings 改成 50 → 下一次 sync 应新建第 2 条连接 */
FILE *g = fopen(cfg, "w");
if (!g) { printf("FAIL cannot rewrite settings\n"); fail = 1; }
else {
fprintf(g, "# meow-settings 1\naudio.volume = 50\naudio.volume_max = 50\ndisplay.brightness = 80\n");
fclose(g);
}
audio_out_sync_volume();
usleep(50000);
if (g_nconn != 2 || g_got_pct != 50) {
printf("FAIL changed-volume re-sync: conns=%d (expect 2) last_pct=%d (expect 50)\n",
(int)g_nconn, (int)g_got_pct);
fail = 1;
} else {
printf("PASS changed-volume re-sync: settings=50 -> 2nd connection pct=50\n");
}
g_stop = 1;
pthread_join(th, NULL);
unlink(g_sock);
unlink(cfg);
if (fail) { printf("vol_sync_sim FAIL\n"); return 1; }
printf("vol_sync_sim PASS\n");
return 0;
}