mirror of
https://github.com/jrpie/Launcher.git
synced 2025-04-11 23:04:32 +02:00
fix #116
This commit is contained in:
parent
8df9aae029
commit
3664159782
1 changed files with 11 additions and 6 deletions
|
@ -93,12 +93,17 @@ fun getUserFromId(userId: Int?, context: Context): UserHandle {
|
||||||
fun removeUnusedShortcuts(context: Context) {
|
fun removeUnusedShortcuts(context: Context) {
|
||||||
val launcherApps = context.getSystemService(Service.LAUNCHER_APPS_SERVICE) as LauncherApps
|
val launcherApps = context.getSystemService(Service.LAUNCHER_APPS_SERVICE) as LauncherApps
|
||||||
fun getShortcuts(profile: UserHandle): List<ShortcutInfo>? {
|
fun getShortcuts(profile: UserHandle): List<ShortcutInfo>? {
|
||||||
return launcherApps.getShortcuts(
|
return try {
|
||||||
ShortcutQuery().apply {
|
launcherApps.getShortcuts(
|
||||||
setQueryFlags(ShortcutQuery.FLAG_MATCH_PINNED)
|
ShortcutQuery().apply {
|
||||||
},
|
setQueryFlags(ShortcutQuery.FLAG_MATCH_PINNED)
|
||||||
profile
|
},
|
||||||
)
|
profile
|
||||||
|
)
|
||||||
|
} catch (e: IllegalStateException) {
|
||||||
|
// https://github.com/jrpie/launcher/issues/116
|
||||||
|
return null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val userManager = context.getSystemService(Service.USER_SERVICE) as UserManager
|
val userManager = context.getSystemService(Service.USER_SERVICE) as UserManager
|
||||||
|
|
Loading…
Add table
Reference in a new issue