feat(sdk+launcher): SDK nav/media封装 + §10.5 App前台唤起通知中心 (agent-206) — meow_ui_nav.c(env栈初始化+report/request_exit) + meow_ui_media.c(懒连断线重连, meta上报+playctl接收) + MSG_NOTIF_OPEN=0x28/CLOSE=0x29(0x25/26已被占); SDK顶部下滑手势→IPC; launcher App前台会话叠加通知中心(SIGSTOP→读帧→接管输入→恢复SIGCONT, 面板内App崩溃即关); hello接线验证
meow_ui.a→9a8eb7ef; hello→fc299577; launcher→b33da20a; 宿主5套件+新test_notif_open+qemu分发 全过 出入: SDK符号用meow_ui_前缀防与launcher内同名冲突; 叠加会话真机待验; §10.5文档旧号段已过时
This commit is contained in:
1 parent
21519ce2e4
commit
9b4195724c
37 files changed
+1042
-21
No files matched your search
@@ -0,0 +1,74 @@
|
||||
/* meow_ui_nav.c — App 侧 M3 导航上报封装(SDK 公共件;见 meow_ui_nav.h)。
|
||||
*
|
||||
* 只做「组装 m_nav_t + 经 meow_notify_ipc 一次性发送 MSG_NAV」,不维护连接/订阅循环;
|
||||
* launcher 主循环单写者消费(回复 ACK)。全部失败路径优雅降级(无 socket/写失败/超时
|
||||
* → 静默返回,不崩)。状态(栈深/顶层/app_id)仅进程内缓存,无并发写(App 页面线程调用)。
|
||||
*/
|
||||
#include "meow_ui_nav.h"
|
||||
#include "meow_ipc.h"
|
||||
#include "meow_notify_ipc.h" /* meow_notify_ipc_send_raw(复用其一次性帧传输层) */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static char g_app_id[MEOW_APP_ID_MAX] = "";
|
||||
static int g_depth = 0;
|
||||
static char g_top[MEOW_ACT_MAX] = "";
|
||||
static int g_inited = 0;
|
||||
|
||||
/* app_id:env MEOW_LOG_APP(与 meow_ui_log/meow_notify_ipc 取值口径一致),缺省 "app"。 */
|
||||
static const char *nav_app_id(void)
|
||||
{
|
||||
if (!g_app_id[0]) {
|
||||
const char *s = getenv("MEOW_LOG_APP");
|
||||
snprintf(g_app_id, sizeof g_app_id, "%s", (s && s[0]) ? s : "app");
|
||||
}
|
||||
return g_app_id;
|
||||
}
|
||||
|
||||
int meow_ui_nav_init(void)
|
||||
{
|
||||
if (g_inited) return g_depth;
|
||||
g_inited = 1;
|
||||
nav_app_id();
|
||||
const char *chain = getenv("MEOW_CHAIN");
|
||||
if (chain && chain[0]) {
|
||||
g_depth = 1;
|
||||
for (const char *p = chain; *p; p++) if (*p == ';') g_depth++;
|
||||
}
|
||||
const char *act = getenv("MEOW_ACTIVITY");
|
||||
if (act && act[0]) snprintf(g_top, sizeof g_top, "%s", act);
|
||||
return g_depth;
|
||||
}
|
||||
|
||||
int meow_ui_nav_depth(void) { meow_ui_nav_init(); return g_depth; }
|
||||
const char *meow_ui_nav_top(void) { meow_ui_nav_init(); return g_top; }
|
||||
|
||||
void meow_ui_nav_report(uint32_t depth, const char *top)
|
||||
{
|
||||
meow_ui_nav_init();
|
||||
m_nav_t n;
|
||||
memset(&n, 0, sizeof n);
|
||||
snprintf(n.app_id, sizeof n.app_id, "%s", nav_app_id());
|
||||
n.nav_type = MEOW_NAV_REPORT;
|
||||
n.depth = depth;
|
||||
if (top) snprintf(n.current, sizeof n.current, "%s", top);
|
||||
(void)meow_notify_ipc_send_raw(MSG_NAV, &n, (uint32_t)sizeof n, 1);
|
||||
/* 进程内镜像:App 侧也维持当前栈深/顶层(跨 TU 只读用) */
|
||||
g_depth = (int)depth;
|
||||
if (top) snprintf(g_top, sizeof g_top, "%s", top);
|
||||
}
|
||||
|
||||
void meow_ui_nav_request_exit(void)
|
||||
{
|
||||
meow_ui_nav_init();
|
||||
m_nav_t n;
|
||||
memset(&n, 0, sizeof n);
|
||||
snprintf(n.app_id, sizeof n.app_id, "%s", nav_app_id());
|
||||
n.nav_type = MEOW_NAV_EXIT;
|
||||
n.depth = 0;
|
||||
(void)meow_notify_ipc_send_raw(MSG_NAV, &n, (uint32_t)sizeof n, 1);
|
||||
g_depth = 0;
|
||||
g_top[0] = 0;
|
||||
}
|
||||
Reference in new issue
Block a user