Don't remove main profile app if an app with the same package name has been uninstalled from work profile
This commit is contained in:
parent
8e4a4d8fb4
commit
68382d2746
@ -35,7 +35,7 @@ internal class AppRepositoryImpl(
|
|||||||
private val launcherApps =
|
private val launcherApps =
|
||||||
context.getSystemService(Context.LAUNCHER_APPS_SERVICE) as LauncherApps
|
context.getSystemService(Context.LAUNCHER_APPS_SERVICE) as LauncherApps
|
||||||
|
|
||||||
private val installedApps = MutableStateFlow<List<Application>>(emptyList())
|
private val installedApps = MutableStateFlow<List<LauncherApp>>(emptyList())
|
||||||
private val installations = MutableStateFlow<MutableList<AppInstallation>>(mutableListOf())
|
private val installations = MutableStateFlow<MutableList<AppInstallation>>(mutableListOf())
|
||||||
private val hiddenItems = hiddenItemsRepository.hiddenItemsKeys
|
private val hiddenItems = hiddenItemsRepository.hiddenItemsKeys
|
||||||
private val suspendedPackages = MutableStateFlow<List<String>>(emptyList())
|
private val suspendedPackages = MutableStateFlow<List<String>>(emptyList())
|
||||||
@ -85,7 +85,7 @@ internal class AppRepositoryImpl(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onPackageRemoved(packageName: String, user: UserHandle) {
|
override fun onPackageRemoved(packageName: String, user: UserHandle) {
|
||||||
installedApps.value = installedApps.value.filter { packageName != (it.`package`) }
|
installedApps.value = installedApps.value.filter { packageName != (it.`package`) || it.getUser() != user }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onShortcutsChanged(
|
override fun onShortcutsChanged(
|
||||||
@ -167,7 +167,7 @@ internal class AppRepositoryImpl(
|
|||||||
return suspendedPackages
|
return suspendedPackages
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getApplications(packageName: String): List<Application> {
|
private fun getApplications(packageName: String): List<LauncherApp> {
|
||||||
if (packageName == context.packageName) return emptyList()
|
if (packageName == context.packageName) return emptyList()
|
||||||
|
|
||||||
return profiles.map { p ->
|
return profiles.map { p ->
|
||||||
@ -179,7 +179,7 @@ internal class AppRepositoryImpl(
|
|||||||
private fun getApplication(
|
private fun getApplication(
|
||||||
launcherActivityInfo: LauncherActivityInfo,
|
launcherActivityInfo: LauncherActivityInfo,
|
||||||
profile: UserHandle
|
profile: UserHandle
|
||||||
): Application? {
|
): LauncherApp? {
|
||||||
if (launcherActivityInfo.applicationInfo.packageName == context.packageName && !context.packageName.endsWith(
|
if (launcherActivityInfo.applicationInfo.packageName == context.packageName && !context.packageName.endsWith(
|
||||||
".debug"
|
".debug"
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user