fix(launcher/amsd): amsd MSG_AMS_START 拉起缺口——pending-start 抽 meow_ams_start 模块复用启动链 + 负错误码符修复
根因(真机日志实证,M2.92 遗留):meow_ams_pending_start_set 误返回正错误码 (-MEOW_ERR_BUSY=+8/-MEOW_ERR_INVAL=+1),ipc_dispatch 的 rc<0?-rc:MEOW_OK 把「有前台 App 拒绝/空包名非法」误判为 OK(0) → amsd 报 OK 但 pending 未置位 → App 永不拉起(am start 报 OK 但界面没出现/进程未起)。 launcher: - 新增自包含模块 meow_ams_start.c/.h(ops 注入 launch=launch_app/launch_activity、 resolve=resolve_chain、log=logmsg):pending 状态 + 拉起决策 + picker 上下文。 - set 统一返回负 MEOW_ERR_*(根因修复);consume 复用既有启动链路真正拉起目标 App, 列表未就绪(state!=0)保留 pending 待 2s 重扫重试,不再静默丢弃。 - main_menu run_menu 改经 meow_ams_start_consume 消费(保留 launch_fail_toast/菜单收尾); app_launcher 移除旧 g_ams_start/g_ams_pick_* 迁入模块;util meow_ipc_process 顶部同步 busy、 meow_ipc_init 末尾 meow_ams_launcher_init()。 - build_launcher.sh 编入 meow_ams_start.c;meow_launcher_internal.h 更新挂点声明。 amsd(协议层归属说明):cmd_start 的 busy 判定对照 launcher ACK 正幅度(busy=8), 原 (uint32_t)MEOW_ERR_BUSY=0xFFFFFFF8 永不匹配 → busy 落入 launcher offline,改 (uint32_t)(-MEOW_ERR_BUSY)。 验证:宿主 test_ams_start.c 33 断言全 PASS(合法->拉起链、activity chain 透传、空包名/非法/busy 不拉起不崩、列表未就绪保留 pending、无路由 NO ROUTE、启动失败 idx 回报、picker 取回); launcher 目录全量回归 test_media/bgplay/depends/notif_panel/notif_tf/settings_brightness/ vol_ramp_jack/host_icon + test_font_tier/weight 全 PASS;mipsel -Wall -Wextra 0 warning。 新 md5:meow_launcherd a8200ae1b0aa68d7262749db87377d49、meow_amsd 7ddc677ce7938bc9b95c83c17bc78295。(M2.98 待打包,未刷机)
This commit is contained in:
1 parent
7e7e45ae26
commit
980d161972
13 files changed
+446
-101
No files matched your search
@@ -1,6 +1,7 @@
|
||||
/* app_launcher.c — MeowOS launcher 拆分模块(LAUNCHER_SPLIT_PLAN 拆分)。*/
|
||||
/* 本文件由拆分工具从 meow_launcherd.c 按职责搬移;逻辑与原文 0-diff(仅 static 可见性按跨模块需求调整)。*/
|
||||
#include "meow_launcher_internal.h"
|
||||
#include "meow_ams_start.h" /* MSG_AMS_START pending/拉起决策(meow_ams_start.c) */
|
||||
|
||||
|
||||
static struct meow_acct g_accts[MEOW_MAX_ACTS]; /* 主循环单写者 */
|
||||
@@ -201,30 +202,9 @@ static int reap_wait(pid_t pid, int *status)
|
||||
}
|
||||
}
|
||||
|
||||
/* ---- amsd start/kill 挂点(主循环单写者)---- */
|
||||
static struct { char pkg[MEOW_APP_ID_MAX]; char act[MEOW_ACT_MAX]; int pending; } g_ams_start;
|
||||
/* ---- amsd kill 挂点(主循环单写者;start 侧见 meow_ams_start.c)---- */
|
||||
static struct { char pkg[MEOW_APP_ID_MAX]; int pending; } g_ams_kill;
|
||||
|
||||
int meow_ams_pending_start_set(const char *pkg, const char *act)
|
||||
{
|
||||
if (!pkg || !pkg[0]) return -MEOW_ERR_INVAL;
|
||||
if (g_app_session_active) return -MEOW_ERR_BUSY;
|
||||
snprintf(g_ams_start.pkg, sizeof g_ams_start.pkg, "%s", pkg);
|
||||
g_ams_start.act[0] = 0;
|
||||
if (act && act[0]) snprintf(g_ams_start.act, sizeof g_ams_start.act, "%s", act);
|
||||
g_ams_start.pending = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int meow_ams_take_start(char *pkg, int pn, char *act, int an)
|
||||
{
|
||||
if (!g_ams_start.pending) return 0;
|
||||
g_ams_start.pending = 0;
|
||||
if (pkg && pn > 0) snprintf(pkg, pn, "%s", g_ams_start.pkg);
|
||||
if (act && an > 0) snprintf(act, an, "%s", g_ams_start.act);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void meow_ams_pending_kill_set(const char *pkg)
|
||||
{
|
||||
if (!pkg || !pkg[0]) return;
|
||||
@@ -241,34 +221,38 @@ int meow_ams_kill_pending(const char *pkg)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* ---- AMSD_DESIGN §6.2 二期:picker 上下文(随 pending-start 置位,launch_app_chain 消费后清)----
|
||||
* amsd `am picker` → MSG_AMS_START 扩载荷(picker=1)→ ipc_dispatch 经 set_ex 置位 + 武装
|
||||
* g_ams_pick_armed;main_menu 消费 pending-start(照旧 launch_app/launch_activity)时,
|
||||
* launch_app_chain 读到武装位 → 注入 MEOW_PICKER_ACTION/REQ_ID/CALLER 到子进程 → 解除武装。
|
||||
* 单一写者(ipc_dispatch / launch_app_chain),且同一时刻仅一个 pending-start 在飞(v1 单前台 App),
|
||||
* 故武装位不会错配到非 picker 启动。 */
|
||||
static char g_ams_pick_action[24];
|
||||
static char g_ams_pick_caller[MEOW_APP_ID_MAX];
|
||||
static uint32_t g_ams_pick_req;
|
||||
static int g_ams_pick_armed;
|
||||
/* ---- amsd-start ops 组装(launch_app/launch_activity + resolve_chain + logmsg)----
|
||||
* meow_ams_start_consume 经 ops.launch 复用既有启动链路真正拉起 App(chain 空=裸启动、
|
||||
* 非空=activity 链)。ops.launch 的 idx→struct app 映射经 g_ams_ctx 完成(run_menu 每次
|
||||
* 消费前 meow_ams_ctx_set(apps, napps))。 */
|
||||
static struct app *g_ams_ctx_apps;
|
||||
static int g_ams_ctx_napps;
|
||||
|
||||
int meow_ams_pending_start_set_ex(const char *pkg, const char *act,
|
||||
const char *pick_action, uint32_t pick_req,
|
||||
const char *pick_caller)
|
||||
void meow_ams_ctx_set(struct app *apps, int napps)
|
||||
{
|
||||
int rc = meow_ams_pending_start_set(pkg, act);
|
||||
if (rc != 0) return rc; /* 拒绝(有前台 App / 参数非法) */
|
||||
g_ams_pick_action[0] = 0;
|
||||
g_ams_pick_caller[0] = 0;
|
||||
g_ams_pick_req = 0;
|
||||
g_ams_pick_armed = 0;
|
||||
if (pick_action && pick_action[0]) {
|
||||
snprintf(g_ams_pick_action, sizeof g_ams_pick_action, "%s", pick_action);
|
||||
if (pick_caller) snprintf(g_ams_pick_caller, sizeof g_ams_pick_caller, "%s", pick_caller);
|
||||
g_ams_pick_req = pick_req;
|
||||
g_ams_pick_armed = 1;
|
||||
}
|
||||
return 0;
|
||||
g_ams_ctx_apps = apps;
|
||||
g_ams_ctx_napps = napps;
|
||||
}
|
||||
|
||||
static int ams_launch_cb(int idx, const char *chain)
|
||||
{
|
||||
if (!g_ams_ctx_apps || idx < 0 || idx >= g_ams_ctx_napps) return -MEOW_ERR_NOENT;
|
||||
if (chain && chain[0]) return launch_activity(&g_ams_ctx_apps[idx], chain);
|
||||
return launch_app(&g_ams_ctx_apps[idx]);
|
||||
}
|
||||
|
||||
static int ams_resolve_cb(const char *app_id, const char *activity, char *chain, int *depth)
|
||||
{
|
||||
return resolve_chain(app_id, activity, chain, depth);
|
||||
}
|
||||
|
||||
void meow_ams_launcher_init(void)
|
||||
{
|
||||
static struct meow_ams_ops ops;
|
||||
ops.launch = ams_launch_cb;
|
||||
ops.resolve = ams_resolve_cb;
|
||||
ops.log = logmsg;
|
||||
meow_ams_ops_init(&ops);
|
||||
}
|
||||
|
||||
/* 子进程 exec 前注入 picker env(action/req/caller 已由 launch_app_chain 入口捕获并解除全局武装,
|
||||
@@ -1452,17 +1436,13 @@ static int run_app_notif_overlay(struct app *a, pid_t pid)
|
||||
static int launch_app_chain(struct app *a, const char *chain)
|
||||
{
|
||||
logmsg("launch: %s (%s) chain=\"%s\"", a->name, a->exec, chain ? chain : "");
|
||||
/* §6.2 二期:入口即捕获 picker 上下文并解除全局武装——即便后续 exec 失败(!a->ok)返回,
|
||||
* 武装位也已清,不会错配到下一次普通启动(单飞不泄漏)。 */
|
||||
/* §6.2 二期:入口即捕获 picker 上下文并解除武装(meow_ams_take_picker)——即便后续
|
||||
* exec 失败(!a->ok)返回,武装位也已清,不会错配到下一次普通启动(单飞不泄漏)。 */
|
||||
char pick_action[24] = "";
|
||||
char pick_caller[MEOW_APP_ID_MAX] = "";
|
||||
uint32_t pick_req = 0;
|
||||
if (g_ams_pick_armed) {
|
||||
snprintf(pick_action, sizeof pick_action, "%s", g_ams_pick_action);
|
||||
snprintf(pick_caller, sizeof pick_caller, "%s", g_ams_pick_caller);
|
||||
pick_req = g_ams_pick_req;
|
||||
g_ams_pick_armed = 0;
|
||||
}
|
||||
meow_ams_take_picker(pick_action, sizeof pick_action,
|
||||
pick_caller, sizeof pick_caller, &pick_req);
|
||||
if (!a->ok) { logmsg("launch blocked: exec not ok"); return -1; }
|
||||
meow_dep_clear_reason(); /* 每次 launch 入口清 stale 依赖阻断原因(防上一 app 残留) */
|
||||
|
||||
|
||||
Reference in new issue
Block a user