File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
app/src/main/kotlin/com/simplemobiletools/launcher/activities Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -233,12 +233,14 @@ class MainActivity : SimpleActivity(), FlingListener {
233233 REQUEST_CREATE_SHORTCUT -> {
234234 if (resultCode == Activity .RESULT_OK && resultData != null ) {
235235 val launcherApps = applicationContext.getSystemService(Context .LAUNCHER_APPS_SERVICE ) as LauncherApps
236- val item = launcherApps.getPinItemRequest(resultData)
237- if (item.accept()) {
238- val shortcutId = item.shortcutInfo?.id!!
239- val label = item.shortcutInfo.getLabel()
240- val icon = launcherApps.getShortcutBadgedIconDrawable(item.shortcutInfo!! , resources.displayMetrics.densityDpi)
241- mActionOnAddShortcut?.invoke(shortcutId, label, icon)
236+ if (launcherApps.hasShortcutHostPermission()) {
237+ val item = launcherApps.getPinItemRequest(resultData)
238+ if (item.accept()) {
239+ val shortcutId = item.shortcutInfo?.id!!
240+ val label = item.shortcutInfo.getLabel()
241+ val icon = launcherApps.getShortcutBadgedIconDrawable(item.shortcutInfo!! , resources.displayMetrics.densityDpi)
242+ mActionOnAddShortcut?.invoke(shortcutId, label, icon)
243+ }
242244 }
243245 }
244246 }
You can’t perform that action at this time.
0 commit comments