sync(SDK): 增量同步主仓 M6.37–M6.39 至公开 SDK 仓

sdk/:
- 同步 meow_ui_widget/input/gfx/lazygrid/audio/media/img 等源码与头
  (SDK 默认列表/容器控件默认 MD3 — meow_list_set_container 可回退;
   全局 App 内底部上滑回桌面 — meow_ui_input_is_home_swipe 系统保留手势;
   LazyGrid/LazyColumn/LazyRow MD3 化;叠加让位自抑改 app_id 判定;
   DSD 音频格式等)
- 新增独立模块源码 meow_img_color / meow_lyric / meow_lyric_view 及对应宿主 test_*.c
- 保留公开仓自包含适配:vendored meow_font.c/meow_font.h/meow_notif.h 不动;
  build_sdk.sh 自包含版本不动;meow_ui_gfx.c 仅改 meow_font.h include 路径;
  meow_ui_internal.h 去除 FreeType 内部声明
- meow_ipc.h 同步到主仓 launcher 版本(含 AUDIO_FMT_DOP/媒体歌词/蓝牙输出协议)
- 不含 FreeType 矢量字 meow_ft_*(需 freetype vendor,公开仓以位图 meow_font
  自包含);不含 mipsel 二进制 / .o / .a / 固件 / 密钥 / devdocs

examples/hello/:
- 新增 ui/demo/sdk2/sdk2.c;build_hello.sh 纳入该文件(保持自包含)

docs / README / .gitignore:
- docs/MEOW_APP_SDK.md 补 §12.5(默认 MD3 容器 + 底部上滑回桌面 + 两个新 API)
- README 能力清单补「默认 MD3 容器」与「底部上滑回桌面」
- .gitignore 补新增宿主测试二进制

验证:sdk/meow_ui.a 与 examples/hello/hello 交叉编译均 0 warning;工作区无生成物。
This commit is contained in:
AskaEth committed 2026-09-04 18:05:36 +08:00
1 parent a1687486bc
commit c0396e40ce
45 files changed
+4665 -175

No files matched your search

+122
View File
@@ -0,0 +1,122 @@
/* test_meow_ui_theme_export.c — M7.0a 主题收口前置(缺口#6 SDK 半)宿主验证:
* §8.1.5 色板导出/注入——meow_theme_export 拷当前权威主题;meow_theme_inject 覆写当前生效主题。
*
* 覆盖:
* T1 导出一致性:export 后关键字段 == meow_theme_get()(当前 style×mode 权威板);
* T2 注入:inject 一份自定义板 → meow_theme_get()/export 都返回注入板(单一权威反映);
* 注入恢复内建:inject(NULL) 后回到目标 style×mode 的内建板;
* T3 launcher 薄壳映射契约:导出板能映射出 meow_ui_theme_t 的 9 个角色字段(surface/
* surface_variant/surface_container/primary/on_surface/on_surface_variant/outline/error/
* surface_tint),值与 SDK meow_theme 对应字段一致。
*
* 编译(宿主 gcc,链真实 gfx/sys/theme/vol/log/widget/input/activity/dialog/ime + 打桩 font/global):
* gcc -Wall -Wextra -o test_meow_ui_theme_export test_meow_ui_theme_export.c test_host_stub.c \
* meow_ui_gfx.c meow_ui_sys.c meow_ui_theme.c meow_ui_vol.c meow_ui_log.c \
* meow_ui_widget.c meow_ui_input.c meow_ui_activity.c meow_ui_dialog.c meow_ui_ime.c meow_ui_str.c \
* meow_pinyin.c meow_ui_draw.c meow_ui_view.c meow_ui_box.c meow_ui_anim.c meow_ui_scroll.c \
* meow_ui_img.c meow_ui_media.c meow_notify_ipc.c stb_image.c \
* -I. -I../meow_launcherd -DMEOW_UI_HOST_TEST -pthread -lm
* 运行:./test_meow_ui_theme_export
*/
#include "meow_ui.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
static int g_fail = 0;
#define CHECK(cond, name) do { \
if (cond) printf(" PASS %s\n", name); \
else { printf(" FAIL %s\n", name); g_fail++; } } while (0)
/* launcher meow_ui_theme_t 的 9 字段形状(测试内复刻字段名,不依赖 launcher 内部头)。 */
typedef struct {
uint32_t surface, surface_variant, surface_container;
uint32_t primary, on_surface, on_surface_variant;
uint32_t outline, error, surface_tint;
} shell_theme;
static shell_theme export_shell(const meow_theme *t)
{
shell_theme s;
s.surface = t->surface;
s.surface_variant = t->surfaceVariant;
s.surface_container = t->surfaceContainer;
s.primary = t->primary;
s.on_surface = t->onSurface;
s.on_surface_variant= t->onSurfaceVariant;
s.outline = t->outline;
s.error = t->error;
s.surface_tint = t->surfaceTint;
return s;
}
int main(void)
{
setenv("MEOW_UI_DUMP", "/tmp/theme_export.ppm", 1);
meow_ui_opts o = { 480, 720 };
assert(meow_ui_init(&o) == 0);
/* ---- T1 导出一致性(MD3 dark) ---- */
printf("T1 export consistency\n");
meow_theme_set_mode(MEOW_THEME_DARK);
meow_ui_set_style(MEOW_STYLE_MD3);
const meow_theme *t0 = meow_theme_get();
meow_theme e0; meow_theme_export(&e0);
CHECK(e0.surface == t0->surface, "export.surface == get.surface");
CHECK(e0.primary == t0->primary, "export.primary == get.primary");
CHECK(e0.surfaceVariant== t0->surfaceVariant,"export.surfaceVariant == get.surfaceVariant");
CHECK(e0.onSurface == t0->onSurface, "export.onSurface == get.onSurface");
CHECK(e0.radius == t0->radius, "export.radius == get.radius");
CHECK(e0.bg == t0->bg, "export.bg == get.bg (background override applied)");
/* MIUIx light:确认导出随 style×mode 切换(不是固定板) */
meow_ui_set_style(MEOW_STYLE_MIUIX);
meow_theme_set_mode(MEOW_THEME_LIGHT);
const meow_theme *t1 = meow_theme_get();
meow_theme e1; meow_theme_export(&e1);
CHECK(e1.primary == 0xF57200 && t1->primary == 0xF57200, "MIUIx light primary exported");
CHECK(e1.bg == t1->bg && e1.surface == t1->surface, "MIUIx light bg/surface exported");
CHECK(e1.surface == (uint32_t)0xF7F3EE, "MIUIx light surface == warm default");
/* ---- T2 注入覆写 + 恢复内建 ---- */
printf("T2 inject override + restore\n");
meow_theme custom; memset(&custom, 0, sizeof custom);
custom.surface = 0x112233; custom.primary = 0xABCDEF; custom.onSurface = 0x0F0F0F;
custom.radius = 99; custom.radius_card = 100;
meow_theme_inject(&custom);
const meow_theme *ti = meow_theme_get();
meow_theme ei; meow_theme_export(&ei);
CHECK(ti->primary == 0xABCDEF && ti->surface == 0x112233 && ti->radius == 99,
"inject -> get() reads injected palette");
CHECK(ei.primary == 0xABCDEF && ei.surface == 0x112233, "inject -> export reads injected palette");
/* meow_theme_export == meow_theme_get even when injected(单一权威) */
CHECK(ei.onSurface == ti->onSurface && ei.radius_card == ti->radius_card,
"export == get while injected");
/* 注入恢复内建 */
meow_theme_inject(NULL);
const meow_theme *tr = meow_theme_get();
CHECK(tr->primary == 0xF57200 && tr->surface == 0xF7F3EE,
"inject(NULL) restores builtin (MIUIx light)");
/* ---- T3 launcher 薄壳映射契约(9 角色字段) ---- */
printf("T3 shell mapping contract\n");
meow_theme_export(&e1);
shell_theme sh = export_shell(&e1);
CHECK(sh.surface == e1.surface, "shell.surface == surface");
CHECK(sh.surface_variant == e1.surfaceVariant, "shell.surface_variant == surfaceVariant");
CHECK(sh.surface_container == e1.surfaceContainer, "shell.surface_container == surfaceContainer");
CHECK(sh.primary == e1.primary, "shell.primary == primary");
CHECK(sh.on_surface == e1.onSurface, "shell.on_surface == onSurface");
CHECK(sh.on_surface_variant == e1.onSurfaceVariant, "shell.on_surface_variant == onSurfaceVariant");
CHECK(sh.outline == e1.outline, "shell.outline == outline");
CHECK(sh.error == e1.error, "shell.error == error");
CHECK(sh.surface_tint == e1.surfaceTint, "shell.surface_tint == surfaceTint");
/* 关键角色字段值与 MIUIx light 内建一致(证明读的是 SDK 单一权威,而非 launcher 自持 4 套) */
CHECK(sh.surface == 0xF7F3EE && sh.primary == 0xF57200 && sh.error == 0xB3261E,
"shell roles match SDK builtin (single authority)");
meow_ui_shutdown();
printf(g_fail ? "\nRESULT: %d FAIL(S)\n" : "\nRESULT: ALL PASS\n", g_fail);
return g_fail;
}