feat(launcher): M3导航栈+M5通知点击跳转 (agent-202) — nav_stack(≤16深)+MSG_NAV REPORT/EXIT+launch_activity链路注入(MEOW_ACTIVITY/MEOW_CHAIN)+栈根退出回主屏; 通知点击按route_status(0拉起/1 NO ROUTE/2 SOURCE NOT FOUND/-1 NONE关面板不动作); picker协议位预留(0x0070/0x0071); 裸App兼容

launcher 4fe4103a→a42171a1; qemu实测 declare/query/nav report/exit/notify+querynotif 全过
发现: §10.5 App前台通知中心叠加会话(MSG_NOTIF_OPEN)实际未实现,文档超前,待补
This commit is contained in:
MeowOS committed 2026-08-31 06:27:10 +08:00
1 parent 955dbe1228
commit 85b4aea24f
9 files changed
+321 -39

No files matched your search

+44 -3
View File
@@ -221,9 +221,38 @@ static int cmd_back(void)
return 1;
}
/* M3:上报导航 → MSG_NAV,期望 MSG_ACK。
* nav report <app_id> <depth> <top> 上报栈深/顶层(MEOW_NAV_REPORT)
* nav exit <app_id> 请求退出(MEOW_NAV_EXIT) */
static int cmd_nav(const char *app_id, int exit_req, uint32_t depth, const char *top)
{
int fd = connect_path(g_sock);
if (fd < 0) return 1;
m_nav_t n;
memset(&n, 0, sizeof n);
strncpy(n.app_id, app_id, MEOW_APP_ID_MAX - 1);
n.nav_type = exit_req ? MEOW_NAV_EXIT : MEOW_NAV_REPORT;
n.depth = depth;
if (top) strncpy(n.current, top, MEOW_ACT_MAX - 1);
uint8_t rbuf[256];
int rt = xchg(fd, MSG_NAV, 10, &n, sizeof n, rbuf, sizeof rbuf);
close(fd);
if (rt == MSG_ACK) {
m_ack_t a;
memcpy(&a, rbuf, sizeof a);
printf("NAV ok: app=%s type=%u depth=%u top=\"%s\" code=%d\n",
app_id, n.nav_type, depth, n.current, a.code);
return a.code == MEOW_OK ? 0 : 1;
}
if (rt == MSG_ERR) { print_err((const m_err_t *)rbuf); return 1; }
fprintf(stderr, "NAV: unexpected resp type 0x%04x\n", rt);
return 1;
}
/* M2a:推送通知 → MSG_NOTIFY,期望 MSG_NOTIFY_ACK。 */
static int cmd_notify(const char *app_id, const char *category, const char *summary,
const char *body, uint32_t replaces_id, int ongoing, int media, int progress)
const char *body, uint32_t replaces_id, int ongoing, int media, int progress,
const char *target_activity)
{
int fd = connect_path(g_sock);
if (fd < 0) return 1;
@@ -233,6 +262,7 @@ static int cmd_notify(const char *app_id, const char *category, const char *summ
strncpy(n.category, category, sizeof n.category - 1);
strncpy(n.summary, summary, sizeof n.summary - 1);
if (body) strncpy(n.body, body, sizeof n.body - 1);
if (target_activity) strncpy(n.target_activity, target_activity, MEOW_ACT_MAX - 1);
n.replaces_id = replaces_id;
n.ongoing = ongoing ? 1 : 0;
n.media = media ? 1 : 0;
@@ -356,14 +386,16 @@ int main(int argc, char **argv)
return cmd_back();
}
if (!strcmp(cmd, "notify")) {
/* notify <app_id> <category> <summary> [body] [replaces_id] [ongoing] [media] [progress] */
/* notify <app_id> <category> <summary> [body] [replaces_id] [ongoing] [media] [progress] [target_activity] */
if (i + 2 >= argc) { fprintf(stderr, "notify needs <app_id> <category> <summary>\n"); return 1; }
const char *body = (i + 4 < argc) ? argv[i + 4] : "";
uint32_t rid = (i + 5 < argc) ? (uint32_t)strtoul(argv[i + 5], NULL, 0) : 0;
int ongoing = (i + 6 < argc) ? atoi(argv[i + 6]) : 0;
int media = (i + 7 < argc) ? atoi(argv[i + 7]) : 0;
int progress = (i + 8 < argc) ? atoi(argv[i + 8]) : -1;
return cmd_notify(argv[i + 1], argv[i + 2], argv[i + 3], body, rid, ongoing, media, progress);
const char *tgt = (i + 9 < argc) ? argv[i + 9] : "";
return cmd_notify(argv[i + 1], argv[i + 2], argv[i + 3], body, rid, ongoing, media, progress,
tgt);
}
if (!strcmp(cmd, "dismiss")) {
if (i + 1 >= argc) { fprintf(stderr, "dismiss needs <id>\n"); return 1; }
@@ -376,6 +408,15 @@ int main(int argc, char **argv)
if (!strcmp(cmd, "dismissall")) {
return cmd_dismissall();
}
if (!strcmp(cmd, "nav")) {
/* nav report <app_id> <depth> <top> | nav exit <app_id> */
if (i + 1 >= argc) { fprintf(stderr, "nav needs <app_id> and report|exit\n"); return 1; }
int exit_req = (!strcmp(argv[i + 1], "exit") || !strcmp(argv[i + 1], "EXIT"));
if (i + 2 >= argc) { fprintf(stderr, "nav needs <app_id>\n"); return 1; }
uint32_t depth = (i + 3 < argc) ? (uint32_t)strtoul(argv[i + 3], NULL, 0) : 0;
const char *top = (i + 4 < argc) ? argv[i + 4] : "";
return cmd_nav(argv[i + 2], exit_req, depth, top);
}
fprintf(stderr, "unknown cmd %s; try --help\n", cmd);
return 1;
}