通知模型补全(agent-107: SDK icon+update_progress / IPC urgency+MSG_NOTIFY_PROGRESS / 存储 urgency+icon回退+progress / CSV加3列) + 全屏收合视觉+滑条(agent-108)

This commit is contained in:
MeowOS Dev committed 2026-08-30 13:02:17 +08:00
1 parent b3e57d4b55
commit e8fa373a2f
18 files changed
+410 -56

No files matched your search

+28 -1
View File
@@ -35,7 +35,10 @@
/* ---- 内部活动表尺寸(配额见 meow_ui.h) ---- */
#define MEOW_NOTIFY_MAX_ACTIVE (MEOW_NOTIFY_MAX_TYPES * MEOW_NOTIFY_MAX_PER_TYPE)
/* 活动通知槽(内部;标题/正文等复制副本,不持 app 外部指针,避免栈字符串悬垂) */
/* 活动槽内 icon 缓冲上限(与 IPC app_icon[48] 一致;SDK 复制副本,不持 app 外部指针) */
#define MEOW_SLOT_ICON_MAX 48
/* 活动通知槽(内部;标题/正文/图标等复制副本,不持 app 外部指针,避免栈字符串悬垂) */
typedef struct {
uint32_t id; /* 本地唯一 id(app 侧句柄);0=空闲槽 */
uint32_t ipc_id; /* launcher 中央存储分配的通知 id(nid);0=未同步/降级 */
@@ -47,6 +50,7 @@ typedef struct {
char title[64];
char body[128];
char target_activity[32];
char icon[MEOW_SLOT_ICON_MAX]; /* 图标 name/path;空=用 app 默认图标(launcher 回退) */
int progress; /* 0-100;-1=无进度条 */
} notify_slot_t;
@@ -111,6 +115,7 @@ static void notify_fill(notify_slot_t *s, const meow_notify *n, uint32_t id, uin
snprintf(s->body, sizeof s->body, "%s", n->body ? n->body : "");
snprintf(s->target_activity, sizeof s->target_activity, "%s",
n->target_activity ? n->target_activity : "");
snprintf(s->icon, sizeof s->icon, "%s", n->icon ? n->icon : "");
s->progress = (n->progress < -1) ? -1 : (n->progress > 100 ? 100 : n->progress);
}
@@ -253,6 +258,28 @@ int meow_notify_cancel(uint32_t id)
return rc;
}
int meow_notify_update_progress(uint32_t local_id, int progress)
{
int p, i, found = 0;
uint32_t ipc_id = 0;
if (local_id == 0) return 0;
p = (progress < -1) ? -1 : (progress > 100 ? 100 : progress); /* 钳位 [-1,100] */
pthread_mutex_lock(&g_mu);
notify_purge_expired();
for (i = 0; i < MEOW_NOTIFY_MAX_ACTIVE; i++) {
if (g_slots[i].active && g_slots[i].id == local_id) {
g_slots[i].progress = p; /* 实时:仅改内存活动槽,不落盘 */
ipc_id = g_slots[i].ipc_id; /* launcher 侧 nid;0=未同步/降级 */
found = 1;
break;
}
}
pthread_mutex_unlock(&g_mu);
/* 落点(best-effort):经 IPC 通知 launcher 改其内存活跃槽;无 launcher/未同步则静默。 */
if (found && ipc_id) meow_notify_ipc_update_progress(ipc_id, p);
return found;
}
int meow_notify_active_count(void)
{
int i, n = 0;