mirror of
https://github.com/gkd-kit/gkd.git
synced 2024-11-16 11:42:22 +08:00
fix: 通知栏快照丢失 activityId
This commit is contained in:
parent
bfd7f590ab
commit
473f386d37
|
@ -5,8 +5,8 @@ import com.blankj.utilcode.util.ScreenUtils
|
|||
import kotlinx.serialization.Serializable
|
||||
import li.songe.gkd.BuildConfig
|
||||
import li.songe.gkd.service.GkdAbService
|
||||
import li.songe.gkd.service.getCurrentRules
|
||||
import li.songe.gkd.service.safeActiveWindow
|
||||
import li.songe.gkd.service.topActivityFlow
|
||||
|
||||
@Serializable
|
||||
data class ComplexSnapshot(
|
||||
|
@ -33,7 +33,7 @@ data class ComplexSnapshot(
|
|||
fun createComplexSnapshot(): ComplexSnapshot {
|
||||
val currentAbNode = GkdAbService.service?.safeActiveWindow
|
||||
val appId = currentAbNode?.packageName?.toString()
|
||||
val currentActivityId = topActivityFlow.value?.activityId
|
||||
val currentActivityId = getCurrentRules().topActivity?.activityId
|
||||
val appInfo = if (appId == null) null else AppUtils.getAppInfo(appId)
|
||||
|
||||
return ComplexSnapshot(
|
||||
|
|
|
@ -3,6 +3,7 @@ package li.songe.gkd.debug
|
|||
import android.accessibilityservice.AccessibilityService
|
||||
import android.service.quicksettings.TileService
|
||||
import com.blankj.utilcode.util.ToastUtils
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.delay
|
||||
import li.songe.gkd.appScope
|
||||
import li.songe.gkd.debug.SnapshotExt.captureSnapshot
|
||||
|
@ -18,9 +19,9 @@ class SnapshotTileService : TileService() {
|
|||
ToastUtils.showShort("无障碍没有开启")
|
||||
return
|
||||
}
|
||||
appScope.launchTry(Dispatchers.IO) {
|
||||
val oldAppId = service.safeActiveWindow?.packageName
|
||||
?: return ToastUtils.showShort("获取界面信息根节点失败")
|
||||
appScope.launchTry {
|
||||
?: return@launchTry ToastUtils.showShort("获取界面信息根节点失败")
|
||||
val interval = 500L
|
||||
val waitTime = 3000L
|
||||
var i = 0
|
||||
|
|
Loading…
Reference in New Issue
Block a user