parent
8ace6562cb
commit
28384972d5
@ -113,7 +113,11 @@ internal class AppRepositoryImpl(
|
||||
|
||||
}, Handler(Looper.getMainLooper()))
|
||||
val apps = profiles.map { p ->
|
||||
launcherApps.getActivityList(null, p).mapNotNull { getApplication(it, p) }
|
||||
try {
|
||||
launcherApps.getActivityList(null, p).mapNotNull { getApplication(it, p) }
|
||||
} catch (e: SecurityException) {
|
||||
emptyList()
|
||||
}
|
||||
}.flatten()
|
||||
installedApps.value = apps
|
||||
}
|
||||
@ -127,7 +131,11 @@ internal class AppRepositoryImpl(
|
||||
if (packageName == context.packageName) return emptyList()
|
||||
|
||||
return profiles.map { p ->
|
||||
launcherApps.getActivityList(packageName, p).mapNotNull { getApplication(it, p) }
|
||||
try {
|
||||
launcherApps.getActivityList(packageName, p).mapNotNull { getApplication(it, p) }
|
||||
} catch (e: SecurityException) {
|
||||
emptyList()
|
||||
}
|
||||
}.flatten()
|
||||
}
|
||||
|
||||
|
||||
@ -36,8 +36,12 @@ class LauncherAppDeserializer(val context: Context) : SearchableDeserializer {
|
||||
val intent = Intent().also {
|
||||
it.component = ComponentName(pkg, json.getString("activity"))
|
||||
}
|
||||
val launcherActivityInfo = launcherApps.resolveActivity(intent, user) ?: return null
|
||||
return LauncherApp(context, launcherActivityInfo)
|
||||
try {
|
||||
val launcherActivityInfo = launcherApps.resolveActivity(intent, user) ?: return null
|
||||
return LauncherApp(context, launcherActivityInfo)
|
||||
} catch (e: SecurityException) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user