Skip to content

Commit ebc82ec

Browse files
committed
perf: a11y onDestroyed updateTopActivity
1 parent bc9be7d commit ebc82ec

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

app/src/main/kotlin/li/songe/gkd/a11y/A11yFeat.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import li.songe.gkd.appScope
2020
import li.songe.gkd.permission.shizukuOkState
2121
import li.songe.gkd.service.A11yService
2222
import li.songe.gkd.service.StatusService
23+
import li.songe.gkd.shizuku.safeGetTopCpn
2324
import li.songe.gkd.store.storeFlow
2425
import li.songe.gkd.util.SnapshotExt
2526
import li.songe.gkd.util.UpdateTimeOption
@@ -36,6 +37,14 @@ fun onA11yFeatInit() = service.run {
3637
useRuleChangedLog()
3738
onA11yEvent { onA11yFeatEvent(it) }
3839
onCreated { StatusService.autoStart() }
40+
onDestroyed {
41+
safeGetTopCpn()?.let {
42+
// com.android.systemui
43+
if (!topActivityFlow.value.sameAs(it.packageName, it.className)) {
44+
updateTopActivity(it.packageName, it.className)
45+
}
46+
}
47+
}
3948
}
4049

4150
private fun A11yService.useAttachState() {

0 commit comments

Comments
 (0)