test(设备闸): 收一份**真实**的 aa dump -l 作为样本(来源与时间写在下面)
为什么要收它:`DeviceProbe.parseForeground` 原先是按**猜的**格式写的(`bundleName: xxx`), 而真机上的形状是 `bundle name [xxx]`,且**多个 mission 并存**、前台由各 mission 的 `state #FOREGROUND` 决定。两种错法都能发生: - 按 `bundleName:` 解析 ⇒ 全部匹配不到 ⇒ 闸永远返回 `unverified`(方向安全,但等于没法用); - 只取**第一个** `bundle name` ⇒ 取到的是**别的 app**(这份样本里 `#31 com.example.homeagent` 就排在我们 `#32 com.jianf.agentmail` 前面)⇒ **假绿**。 样本内容(采集于 2026-09-15,`hdc -t 127.0.0.1:5555 shell "aa dump -l"`)恰好是**争用发生后的那一刻**: 我们的 mission 在,但**前台是别的 app** —— 正是这道闸要挡的输入,而且是真实形状而非构造的。 采集背景(同一分钟内):`aa start` 报 success,随即 dump 显示我们 FOREGROUND(84231), 约一分钟后再次 dump(本样本)**前台已被对方拿回**(`#31` FOREGROUND)—— 所以"争用"不是理论风险,它在一分钟内就发生了。
This commit is contained in:
25
client/electron/test/fixtures/aa-dump-l-real.txt
vendored
Normal file
25
client/electron/test/fixtures/aa-dump-l-real.txt
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
User ID #100
|
||||
current mission lists:{
|
||||
Mission ID #31 mission name #[#com.example.homeagent:entry:EntryAbility] lockedState #0 mission affinity #[]
|
||||
AbilityRecord ID #31
|
||||
app name [com.example.homeagent]
|
||||
main name [EntryAbility]
|
||||
bundle name [com.example.homeagent]
|
||||
ability type [PAGE]
|
||||
state #FOREGROUND start time [82256]
|
||||
app state #FOREGROUND
|
||||
ready #1 window attached #0 launcher #0
|
||||
callee connections:
|
||||
isKeepAlive: false
|
||||
Mission ID #32 mission name #[#com.jianf.agentmail:entry:EntryAbility] lockedState #0 mission affinity #[]
|
||||
AbilityRecord ID #34
|
||||
app name [com.jianf.agentmail]
|
||||
main name [EntryAbility]
|
||||
bundle name [com.jianf.agentmail]
|
||||
ability type [PAGE]
|
||||
state #BACKGROUND start time [84231]
|
||||
app state #BACKGROUND
|
||||
ready #1 window attached #0 launcher #0
|
||||
callee connections:
|
||||
isKeepAlive: false
|
||||
}
|
||||
Reference in New Issue
Block a user