mirror of
https://github.com/KitsunePie/AppErrorsTracking.git
synced 2025-09-04 02:05:16 +08:00
Modify change the judgment logic when fetched installed packages list is empty in FrameworkHooker
This commit is contained in:
@@ -244,22 +244,24 @@ object FrameworkHooker : YukiBaseHooker() {
|
|||||||
.filter { it.packageName.let { e -> e != "android" && e != BuildConfig.APPLICATION_ID } }
|
.filter { it.packageName.let { e -> e != "android" && e != BuildConfig.APPLICATION_ID } }
|
||||||
.let { info ->
|
.let { info ->
|
||||||
arrayListOf<AppInfoBean>().apply {
|
arrayListOf<AppInfoBean>().apply {
|
||||||
(if (filters.name.isNotBlank()) info.filter {
|
if (info.isNotEmpty())
|
||||||
it.packageName.contains(filters.name) || context.appNameOf(it.packageName).contains(filters.name)
|
(if (filters.name.isNotBlank()) info.filter {
|
||||||
} else info).let { result ->
|
it.packageName.contains(filters.name) || context.appNameOf(it.packageName).contains(filters.name)
|
||||||
/**
|
} else info).let { result ->
|
||||||
* 是否为系统应用
|
/**
|
||||||
* @return [Boolean]
|
* 是否为系统应用
|
||||||
*/
|
* @return [Boolean]
|
||||||
fun PackageInfo.isSystemApp() = (applicationInfo.flags and ApplicationInfo.FLAG_SYSTEM) != 0
|
*/
|
||||||
when (filters.type) {
|
fun PackageInfo.isSystemApp() = (applicationInfo.flags and ApplicationInfo.FLAG_SYSTEM) != 0
|
||||||
AppFiltersType.USER -> result.filter { it.isSystemApp().not() }
|
when (filters.type) {
|
||||||
AppFiltersType.SYSTEM -> result.filter { it.isSystemApp() }
|
AppFiltersType.USER -> result.filter { it.isSystemApp().not() }
|
||||||
AppFiltersType.ALL -> result
|
AppFiltersType.SYSTEM -> result.filter { it.isSystemApp() }
|
||||||
}
|
AppFiltersType.ALL -> result
|
||||||
}.sortedByDescending { it.lastUpdateTime }
|
}
|
||||||
.forEach { add(AppInfoBean(name = context.appNameOf(it.packageName), packageName = it.packageName)) }
|
}.sortedByDescending { it.lastUpdateTime }
|
||||||
}.apply { if (size <= 0) loggerW(msg = "Fetched installed packages but got empty list") }
|
.forEach { add(AppInfoBean(name = context.appNameOf(it.packageName), packageName = it.packageName)) }
|
||||||
|
else loggerW(msg = "Fetched installed packages but got empty list")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} ?: arrayListOf()
|
} ?: arrayListOf()
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user