Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aa73f66a authored by Romain Hunault's avatar Romain Hunault 🚴🏻
Browse files

Merge branch 'fix-shortcut-crash-nougat' into 'master'

Fix crash when shortcut is deleted if it is having null package name

See merge request e/apps/BlissLauncher!54
parents ee47058f c207221c
Loading
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -1984,11 +1984,18 @@ public class LauncherActivity extends AppCompatActivity implements
                        .setMessage(R.string.uninstall_shortcut_dialog)
                        .setPositiveButton(R.string.ok, (dialog1, which) -> {
                            ShortcutItem shortcut = (ShortcutItem) launcherItem;
                            if (shortcut.packageName != null) {
                                DeepShortcutManager.getInstance(this).unpinShortcut(ShortcutKey.fromItem(shortcut));
                                if (DeepShortcutManager.getInstance(this).wasLastCallSuccess()) {
                                    deleteShortcutFromProvider(shortcut.id);
                                    removeShortcutView(shortcut, blissFrameLayout);
                                }
                            } else {
                                // Null package name generally comes for nougat shortcuts so don't unpin here, just directly delete it.
                                deleteShortcutFromProvider(shortcut.id);
                                removeShortcutView(shortcut, blissFrameLayout);
                            }

                        })
                        .setNegativeButton(R.string.cancel, null)
                        .setIcon(launcherItem.icon)