mirror of
https://github.com/MatsuriDayo/NekoBoxForAndroid.git
synced 2025-12-18 22:20:06 +08:00
Reload package cache when entering the app list
This commit is contained in:
parent
ec76238dd1
commit
731064cf88
@ -100,6 +100,7 @@ class AppListActivity : ThemedActivity() {
|
||||
var filteredApps = apps
|
||||
|
||||
suspend fun reload() {
|
||||
PackageCache.reload()
|
||||
apps = cachedApps.mapNotNull { (packageName, packageInfo) ->
|
||||
coroutineContext[Job]!!.ensureActive()
|
||||
packageInfo.applicationInfo?.let { ProxiedApp(packageManager, it, packageName) }
|
||||
|
||||
@ -106,6 +106,7 @@ class AppManagerActivity : ThemedActivity() {
|
||||
var filteredApps = apps
|
||||
|
||||
suspend fun reload() {
|
||||
PackageCache.reload()
|
||||
apps = cachedApps.mapNotNull { (packageName, packageInfo) ->
|
||||
coroutineContext[Job]!!.ensureActive()
|
||||
packageInfo.applicationInfo?.let { ProxiedApp(packageManager, it, packageName) }
|
||||
|
||||
@ -67,15 +67,6 @@ object PackageCache {
|
||||
operator fun get(uid: Int) = uidMap[uid]
|
||||
operator fun get(packageName: String) = packageMap[packageName]
|
||||
|
||||
suspend fun awaitLoad() {
|
||||
if (::packageMap.isInitialized) {
|
||||
return
|
||||
}
|
||||
loaded.withLock {
|
||||
// just await
|
||||
}
|
||||
}
|
||||
|
||||
fun awaitLoadSync() {
|
||||
if (::packageMap.isInitialized) {
|
||||
return
|
||||
|
||||
Loading…
Reference in New Issue
Block a user