mirror of
https://github.com/gkd-kit/gkd.git
synced 2024-11-16 11:42:22 +08:00
This commit is contained in:
parent
1825b000c0
commit
5a2455a20e
|
@ -36,6 +36,12 @@ class A11yContext(
|
||||||
var rootCache: AccessibilityNodeInfo? = null
|
var rootCache: AccessibilityNodeInfo? = null
|
||||||
|
|
||||||
private fun clearNodeCache() {
|
private fun clearNodeCache() {
|
||||||
|
if (META.debuggable) {
|
||||||
|
val sizeList = listOf(childCache.size(), parentCache.size(), indexCache.size())
|
||||||
|
if (sizeList.any { it > 0 }) {
|
||||||
|
Log.d("cache", "clear cache -> $sizeList")
|
||||||
|
}
|
||||||
|
}
|
||||||
rootCache = null
|
rootCache = null
|
||||||
try {
|
try {
|
||||||
childCache.evictAll()
|
childCache.evictAll()
|
||||||
|
@ -51,16 +57,17 @@ class A11yContext(
|
||||||
}
|
}
|
||||||
|
|
||||||
private var lastClearTime = 0L
|
private var lastClearTime = 0L
|
||||||
|
private var lastAppChangeTime = appChangeTime
|
||||||
private fun clearNodeCacheIfTimeout() {
|
private fun clearNodeCacheIfTimeout() {
|
||||||
val currentTime = System.currentTimeMillis()
|
if (appChangeTime != lastAppChangeTime) {
|
||||||
if (currentTime - lastClearTime > 5000L) {
|
lastAppChangeTime = appChangeTime
|
||||||
lastClearTime = currentTime
|
lastClearTime = System.currentTimeMillis()
|
||||||
if (META.debuggable) {
|
clearNodeCache()
|
||||||
val sizeList = listOf(childCache.size(), parentCache.size(), indexCache.size())
|
return
|
||||||
if (sizeList.any { it > 0 }) {
|
}
|
||||||
Log.d("cache", "clear cache -> $sizeList")
|
val t = System.currentTimeMillis()
|
||||||
}
|
if (t - lastClearTime > 30_000L) {
|
||||||
}
|
lastClearTime = t
|
||||||
clearNodeCache()
|
clearNodeCache()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,10 +81,10 @@ class A11yContext(
|
||||||
private fun guardInterrupt() {
|
private fun guardInterrupt() {
|
||||||
if (disableInterrupt) return
|
if (disableInterrupt) return
|
||||||
if (interruptInnerKey == interruptKey) return
|
if (interruptInnerKey == interruptKey) return
|
||||||
if (!activityRuleFlow.value.activePriority) return
|
|
||||||
val rule = currentRule ?: return
|
|
||||||
if (rule.isPriority()) return
|
|
||||||
interruptInnerKey = interruptKey
|
interruptInnerKey = interruptKey
|
||||||
|
val rule = currentRule ?: return
|
||||||
|
if (!activityRuleFlow.value.currentRules.contains(rule)) return
|
||||||
|
if (rule.isPriority()) return
|
||||||
if (META.debuggable) {
|
if (META.debuggable) {
|
||||||
Log.d("guardInterrupt", "中断 rule=${rule.statusText()}")
|
Log.d("guardInterrupt", "中断 rule=${rule.statusText()}")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user