通知模型补全(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

+31 -1
View File
@@ -32,9 +32,13 @@
* app_id="system" 同走配额);TTL 10s 转储钩子(§8,TF 落盘 M2c 后置,预留 notif_dump_cb);
* 满丢该类型最旧条(ring 语义);ONGOING 常驻(转储后仍保留,服务死随清)。
* - meow_settings 默认表新增 notify.categories/category_quota/media_quota(B2a 后端)。
* - IPC:ipc_dispatch 新增 MSG_NOTIFY→MSG_NOTIFY_ACK、MSG_NOTIFY_DISMISS→MSG_ACK;
* - IPC:ipc_dispatch 新增 MSG_NOTIFY→MSG_NOTIFY_ACK、MSG_NOTIFY_DISMISS→MSG_ACK、
* MSG_NOTIFY_PROGRESS→MSG_ACK(实时进度仅改内存活跃槽,不落盘);
* MSG_NOTIFY_LIST 为守护→App 下行(M5 接入)。meow_ipc 测试钩子新增 notify/dismiss 子命令。
* - meow_notif_before_poweroff() 挂入 sys_do_reboot():正常电源事件前先转储未上卡通知再清板载。
* - 通知模型补全(2026-08-30,用户定案):SDK→IPC→存储→dump 全链路补 urgency(0-3)/
* icon(空→按 app_id 回退该 app 默认图标);progress 实时仅改内存(MSG_NOTIFY_PROGRESS),
* TF 快照只在创建/结束(100% 或 dismiss)(meow_notif_dump_tf 写当时值)。
*
* B2a 统一系统设置后端(2026-08-29):
* - 新增 meow_settings.h/.c(SYSTEM_SETTINGS.md §3/MEOWOS_API §2):全部系统设置
@@ -2460,6 +2464,17 @@ static void notif_dump_tf_placeholder(const meow_notif_t *n)
meow_notif_dump_tf(n);
}
/* ---- 通知图标回退回调(用户定案:icon 为空 → 用该 app 默认图标)----
* post 的 app_icon 为空时调用(meow_notif.c 的 notif_resolve_icon),按 app_id 在 app
* 注册表(scan_apps 静态 app.json 的 icon)里找该 app 的图标(name/path 或空)。 */
static int notif_app_icon_fallback(const char *app_id, char *out, size_t outsz)
{
if (!app_id || !app_id[0] || !out || outsz == 0) return 0;
struct meow_acct *a = meow_acct_find(app_id);
if (a && a->icon[0]) { snprintf(out, outsz, "%s", a->icon); return 1; }
return 0; /* 无注册/无图标 → 保持空(通知中心 UI 再回退) */
}
/* 启动加载(M2.11/M2.24):统一由 meow_settings 后端读 settings.conf;
* 此处仅注册监听(一次性)+ 把 backend 当前值同步到缓存全局。重载(应用期
* watchdog 可能改音量)等价于 meow_settings_init() + 手动同步。 */
@@ -2469,6 +2484,7 @@ static void settings_load(void)
meow_settings_init(); /* 幂等:注册默认 + 读 settings.conf */
meow_notif_init(); /* M2a:通知存储初始化(幂等,读 notify.* 配额) */
meow_notif_set_dump_cb(notif_dump_tf_placeholder); /* 通知#6:挂 dump 回调 = TF 转储(meow_notif_dump_tf:一行 CSV 追加 + 10MB 滚动截断) */
meow_notif_set_icon_cb(notif_app_icon_fallback); /* icon 空 → 按 app_id 回退该 app 默认图标(app.json icon) */
if (!settings_cache_registered) {
meow_settings_add_listener(settings_sync_cache_listener);
settings_cache_registered = 1;
@@ -6951,6 +6967,7 @@ static void ipc_dispatch(struct meow_ipc_msg *m)
snprintf(n.target_activity, sizeof n.target_activity, "%s", mn.target_activity);
n.expire_timeout = mn.expire_timeout;
n.progress = mn.progress;
n.urgency = mn.urgency; /* 0-3(低/普通/高/紧急);旧调用=0 → LOW(静默),新调用缺省 NORMAL */
n.ongoing = mn.ongoing;
n.media = mn.media;
uint32_t nid = 0;
@@ -6973,6 +6990,19 @@ static void ipc_dispatch(struct meow_ipc_msg *m)
logmsg("ipc: NOTIFY_DISMISS id=%u rc=%d -> ACK", id, rc);
break;
}
case MSG_NOTIFY_PROGRESS: {
m_notify_progress_t p;
memset(&p, 0, sizeof p);
memcpy(&p, m->payload, m->plen < (uint16_t)sizeof p ? m->plen : (uint16_t)sizeof p);
/* 实时进度:仅改 launcher 内存活跃槽(不落盘);progress>=100 视为结束 → 里程碑落盘 */
int rc = meow_notif_update_progress(p.nid, p.progress);
m_ack_t a;
a.code = (rc == NOTIF_OK) ? MEOW_OK : (uint32_t)rc;
a.status = 0;
ipc_send(m->fd, MSG_ACK, m->req_id, &a, sizeof a);
logmsg("ipc: NOTIFY_PROGRESS nid=%u p=%d rc=%d -> ACK", p.nid, p.progress, rc);
break;
}
case MSG_NOTIFY_LIST:
/* ↓ 守护→App 下发通知清单(重同步)。本帧不来自客户端(无请求类型),故不在此应答;
* 需用时由守护主动经 meow_notif_serialize_list() + ipc_send 下发(M5 通知中心接入)。 */