Files
MeowOS-For-R3P2/patch_v2/sdk/test_meow_repaint.c
T
AskaEth 63b278e13e fix(watchdog+launcher+sdk): M40 电源键 time64 ABI + 锁屏/叠加残留链
- sdk/meow_time32: 抽出可独立链接的 o32 time32 取时/睡眠设施(不依赖 meow_ui.a,
  watchdog 等独立静态组件可直接链;可选 -DMEOW_TIME32_LIBC_OVERRIDES 接管 libc 入口)
- watchdog: now_ms/usleep 改走 time32(修复 held 变天文数字→每次单击都弹菜单);
  阈值读 power.longpress_menu_ms/forceoff_ms(缺省 3000/8000),删除
  PWR_TOGGLE_MS==PWR_MENU_MS;新增 wd_power.h 纯判定 + 宿主行为矩阵测试
- launcher: App 前台电源菜单补齐 §10.5(notif 全抑制 + 帧恢复 + SIGCONT 排空 +
  标记翻回前台);show_power_menu 恢复进入前背景帧(关闭后不再停留菜单画面);
  重绘挪到首轮按键采样之后;activity 标记排空窗 + 会话入口清理 + manual_off 去闩锁
- lock_screen: 电源改按下边沿 + 进场 300ms 才熄屏;电源熄屏退出也恢复底层帧;
  launcher 在 SIGCONT 前写 /tmp/meow_app_repaint,SDK present 消费并 dirty_full
- power_menu: 菜单内强关接 power.forceoff_ms(按 longpress 抵扣),日志不再谎称 8s
- 重编 meow_ui.a 并重链 meow_launcherd/ncm/files/hello/reader(picbrowser 无源码)
- fw_content.conf: 同步 launcherd/watchdog 新 md5;顺带修正 M35 遗留的 nyai 失效钉值

Host: test_wd_fw 66/66、test_overlay_gate 40/40、test_meow_time64/time/repaint PASS。
真机未验证(设备关机);未刷机、未写设备。
2026-11-10 22:51:00 +08:00

68 lines
2.2 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/* test_meow_repaint.c — M40 F5:解锁后「强制 App 整帧重画」请求文件的写/读/删除语义。
*
* 编译(patch_v2/sdk 下):
* gcc -Wall -Wextra -I. test_meow_repaint.c -o test_meow_repaint
* 运行:./test_meow_repaint (exit 0=PASS)
*
* 语义:launcher 写文件 → SDK present 调 meow_ui_repaint_requested() 读到即删并返回 1
* (dirty_full 一次);文件不存在返回 0。路径可用 MEOW_APP_REPAINT_FILE 覆盖(测试隔离)。
*/
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "meow_ui_repaint.h"
static int g_fail = 0;
static void check(const char *name, int ok)
{
if (ok) {
printf("ok %s\n", name);
} else {
printf("FAIL %s\n", name);
g_fail = 1;
}
}
static int write_file(const char *path)
{
int fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (fd < 0) return -1;
if (write(fd, "1", 1) != 1) { close(fd); return -1; }
close(fd);
return 0;
}
int main(void)
{
const char *tmp = getenv("TMPDIR");
char path[512];
snprintf(path, sizeof path, "%s/m40_repaint_XXXXXX", (tmp && tmp[0]) ? tmp : "/tmp");
int fd = mkstemp(path);
if (fd < 0) { perror("mkstemp"); return 2; }
close(fd);
unlink(path); /* 先清空,测试从「无请求」开始 */
setenv("MEOW_APP_REPAINT_FILE", path, 1);
check("path follows env", !strcmp(meow_ui_repaint_path(), path));
check("no request file -> 0", meow_ui_repaint_requested() == 0);
check("write request", write_file(path) == 0);
check("request present", access(path, F_OK) == 0);
check("first check consumes -> 1", meow_ui_repaint_requested() == 1);
check("file deleted after consume", access(path, F_OK) != 0);
check("second check -> 0 (one-shot)", meow_ui_repaint_requested() == 0);
/* 再写一次仍能消费(launcher 每次解锁/菜单关闭都会写) */
check("write again", write_file(path) == 0);
check("consume again -> 1", meow_ui_repaint_requested() == 1);
unlink(path);
printf("\n%s\n", g_fail ? "SOME TESTS FAILED" : "ALL PASS");
return g_fail ? 1 : 0;
}