通知模型补全(agent-107: SDK icon+update_progress / IPC urgency+MSG_NOTIFY_PROGRESS / 存储 urgency+icon回退+progress / CSV加3列) + 全屏收合视觉+滑条(agent-108)
This commit is contained in:
1 parent
b3e57d4b55
commit
e8fa373a2f
18 files changed
+410
-56
No files matched your search
@@ -30,6 +30,7 @@
|
||||
typedef struct {
|
||||
uint32_t type; /* 收到的帧类型 */
|
||||
m_notify_t n; /* MSG_NOTIFY 负载 */
|
||||
m_notify_progress_t prog; /* MSG_NOTIFY_PROGRESS 负载 */
|
||||
uint32_t dismiss_id; /* MSG_NOTIFY_DISMISS 负载 */
|
||||
uint32_t req_id;
|
||||
uint32_t nid_to_return; /* ACK 中回填的 status */
|
||||
@@ -47,6 +48,7 @@ static void cap_store(uint32_t type, uint32_t req_id, const uint8_t *pay, uint32
|
||||
g_cap.req_id = req_id;
|
||||
g_cap.nid_to_return = nid_to_return;
|
||||
if (type == MSG_NOTIFY && len >= sizeof(m_notify_t)) memcpy(&g_cap.n, pay, sizeof(m_notify_t));
|
||||
if (type == MSG_NOTIFY_PROGRESS && len >= sizeof(m_notify_progress_t)) memcpy(&g_cap.prog, pay, sizeof(m_notify_progress_t));
|
||||
if (type == MSG_NOTIFY_DISMISS && len >= 4) memcpy(&g_cap.dismiss_id, pay, 4);
|
||||
g_cap.got = 1;
|
||||
pthread_mutex_unlock(&g_cap_mu);
|
||||
@@ -87,7 +89,7 @@ static void *server_thread(void *arg)
|
||||
|
||||
/* MSG_NOTIFY → 回 m_ack_t(code=OK, status=nid_to_return);
|
||||
* MSG_NOTIFY_DISMISS → 回 m_ack_t(code=OK, status=0,同 launcher 行为)。 */
|
||||
if (type == MSG_NOTIFY || type == MSG_NOTIFY_DISMISS) {
|
||||
if (type == MSG_NOTIFY || type == MSG_NOTIFY_DISMISS || type == MSG_NOTIFY_PROGRESS) {
|
||||
m_ack_t a;
|
||||
memset(&a, 0, sizeof a);
|
||||
a.code = MEOW_OK;
|
||||
@@ -152,9 +154,10 @@ int main(void)
|
||||
meow_notify nt;
|
||||
memset(&nt, 0, sizeof nt);
|
||||
nt.cat = MEOW_NOTIFY_CAT_PROGRESS;
|
||||
nt.urgency = MEOW_NOTIFY_URG_NORMAL;
|
||||
nt.urgency = MEOW_NOTIFY_URG_HIGH;
|
||||
nt.title = "下载中";
|
||||
nt.body = "70%";
|
||||
nt.icon = "os.meow.hello/icon.png";
|
||||
nt.timeout_ms = 5000; /* >0 → expire=5000, ongoing=0 */
|
||||
nt.progress = 150; /* 钳位 → 100 */
|
||||
uint32_t nid = meow_notify_ipc_send(&nt, 0);
|
||||
@@ -175,6 +178,8 @@ int main(void)
|
||||
check("T2 replaces_id 透传=0", cn->replaces_id == 0);
|
||||
check("T1 app_id=testapp", !strcmp(cn->app_id, "testapp"));
|
||||
check("T1 summary=下载中", !strcmp(cn->summary, "下载中"));
|
||||
check("T1 urgency(HIGH)→wire urgency=2", cn->urgency == MEOW_NOTIFY_URG_HIGH);
|
||||
check("T1 icon→app_icon", !strcmp(cn->app_icon, "os.meow.hello/icon.png"));
|
||||
}
|
||||
|
||||
/* ---------- T1/T2:媒体类型 + ONGOING(-1) ---------- */
|
||||
@@ -275,6 +280,21 @@ int main(void)
|
||||
check("T5 dismiss 负载=nid=0xABCD", g_cap.dismiss_id == 0xABCDu);
|
||||
}
|
||||
|
||||
/* ---------- T6:update_progress 发 MSG_NOTIFY_PROGRESS(nid + progress 钳位)---------- */
|
||||
{
|
||||
char sock[108];
|
||||
g_listen_fd = arb_listen(sock, sizeof sock);
|
||||
setenv("MEOW_IPC_SOCK", sock, 1);
|
||||
pthread_t th;
|
||||
pthread_create(&th, NULL, server_thread, NULL);
|
||||
meow_notify_ipc_update_progress(0x1234, 250); /* 钳位 250→100 */
|
||||
pthread_join(th, NULL);
|
||||
close(g_listen_fd);
|
||||
check("T6 stub 收到 MSG_NOTIFY_PROGRESS 帧", g_cap.got && g_cap.type == MSG_NOTIFY_PROGRESS);
|
||||
check("T6 progress 负载 nid=0x1234", g_cap.prog.nid == 0x1234);
|
||||
check("T6 progress 钳位 250→100", g_cap.prog.progress == 100);
|
||||
}
|
||||
|
||||
printf("\n%s (%d failure%s)\n", failures ? "RESULT: FAIL" : "RESULT: PASS",
|
||||
failures, failures == 1 ? "" : "s");
|
||||
return failures ? 1 : 0;
|
||||
|
||||
Reference in new issue
Block a user