diff options
author | Guillaume Jacquart <guillaume.jacquart@hoodbrains.com> | 2023-07-25 11:31:54 +0000 |
---|---|---|
committer | Guillaume Jacquart <guillaume.jacquart@hoodbrains.com> | 2023-07-25 11:31:54 +0000 |
commit | 25741b44b574edb2cee6ef5299f562bb87a94c26 (patch) | |
tree | 43ce1f4205326414e5611190b026c8905e746487 /app/src/main/java | |
parent | c588ee2ea1f025732b1d5da506e1b5952ba24f3f (diff) |
7127: fix new installed app doesn't show up in AdvancedPrivacy until reboot
Diffstat (limited to 'app/src/main/java')
-rw-r--r-- | app/src/main/java/foundation/e/advancedprivacy/data/repositories/AppListsRepository.kt | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/app/src/main/java/foundation/e/advancedprivacy/data/repositories/AppListsRepository.kt b/app/src/main/java/foundation/e/advancedprivacy/data/repositories/AppListsRepository.kt index 0b951a8..2d7651d 100644 --- a/app/src/main/java/foundation/e/advancedprivacy/data/repositories/AppListsRepository.kt +++ b/app/src/main/java/foundation/e/advancedprivacy/data/repositories/AppListsRepository.kt @@ -138,16 +138,16 @@ class AppListsRepository( private var lastFetchApps = 0 private var refreshAppJob: Job? = null private fun refreshAppDescriptions(fetchMissingIcons: Boolean = true, force: Boolean = false): Job? { - if (refreshAppJob == null) { + if (refreshAppJob == null || refreshAppJob?.isCompleted == true) { refreshAppJob = coroutineScope.launch(Dispatchers.IO) { - if (force || context.packageManager.getChangedPackages(lastFetchApps) != null) { + if (appsByUid.isEmpty() || appsByAPId.isEmpty() || + force || context.packageManager.getChangedPackages(lastFetchApps) != null + ) { fetchAppDescriptions(fetchMissingIcons = fetchMissingIcons) if (fetchMissingIcons) { lastFetchApps = context.packageManager.getChangedPackages(lastFetchApps) ?.sequenceNumber ?: lastFetchApps } - - refreshAppJob = null } } } |