feat(bt): 批①后台常驻框架实施 — meow_media_app_resident按app会话判活跃+should_keep三参(keepalive||bg_audio&&resident)+background_keepalive声明解析透传+amsd EV BG/FG上报;宿主test_media39/test_bgplay/test_bg_keep19全过,0warning;落盘APP_BACKGROUND_KEEPALIVE_P1;降配(nice)待真机未做
This commit is contained in:
1 parent
7e68313981
commit
f3ae06d7cd
10 files changed
+330
-30
No files matched your search
@@ -46,6 +46,8 @@ typedef struct meow_bg_entry {
|
||||
int out_fd;
|
||||
int on_card; /* 二进制在 TF 卡上(卡拔需 SIGTERM 防 SIGBUS) */
|
||||
uint64_t term_at_ms; /* 卡拔 SIGTERM 发出时刻(0=未发;SIGKILL 兜底计时) */
|
||||
uint64_t bg_since_ms; /* 批①:转后台时刻(monotonic ms,批③管理页/闲置回收用) */
|
||||
char keepalive; /* 批①:1=background_keepalive 类(无媒体会话也保活);0=background_audio 类 */
|
||||
} meow_bg_entry_t;
|
||||
|
||||
/* 无头后台服务运行时槽(静态声明在 meow_acct.svcs,此处为运行态)。 */
|
||||
@@ -91,12 +93,17 @@ typedef struct meow_bgplay_ops {
|
||||
void meow_bgplay_init(const meow_bgplay_ops *ops);
|
||||
|
||||
/* ---- 后台播放保活判定(纯函数,无副作用)---- */
|
||||
/* 退出时是否转后台保活:声明 background_audio 且该 App 媒体会话正在播放。 */
|
||||
int meow_bg_should_keep(int bg_audio_declared, int media_playing);
|
||||
/* 退出时是否转后台保活(批①三参化):
|
||||
* keepalive_declared=1(声明 background_keepalive)→ 恒保活(通用常驻,不依赖媒体会话);
|
||||
* 否则 bg_audio_declared(声明 background_audio)且 media_resident(该 App 媒体会话活跃
|
||||
* =PLAYING/PAUSED/BUFFER,见 meow_media_app_resident)→ 保活。
|
||||
* 未声明/无活跃会话 → 0(走原真退序列)。 */
|
||||
int meow_bg_should_keep(int bg_audio_declared, int media_resident, int keepalive_declared);
|
||||
|
||||
/* ---- 后台保活 App 表 ---- */
|
||||
/* 转后台:登记 app_id/pid/out_fd。返回 0=成功;MEOW_ERR_EXISTS=已在后台;MEOW_ERR_NOMEM=满。 */
|
||||
int meow_bg_add(const char *app_id, pid_t pid, int out_fd, int on_card);
|
||||
/* 转后台:登记 app_id/pid/out_fd,keepalive 标记常驻类型(1=background_keepalive 类)。
|
||||
* 返回 0=成功;MEOW_ERR_EXISTS=已在后台;MEOW_ERR_NOMEM=满。 */
|
||||
int meow_bg_add(const char *app_id, pid_t pid, int out_fd, int on_card, int keepalive);
|
||||
/* 回前台:按 app_id 摘除槽(进程归还前台会话)。成功返回 0 且 *out_fd(可 NULL)带回
|
||||
* 管道读端;未在后台返回 -1。 */
|
||||
int meow_bg_take(const char *app_id, int *out_fd, pid_t *pid);
|
||||
|
||||
Reference in new issue
Block a user