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

Commit d869d274 authored by Pinyao Ting's avatar Pinyao Ting
Browse files

Fix the issue pinned shortcuts went missing after reboot

A performance improvement was made in a previous CL which refrains from
saving all shortcuts from all packages whenever a change was made,
rather, we will now only persists all shortcuts from specific package
that were changed by the event.

However that CL failed to address the event when shortcuts are pinned by
a launcher. When a shortcut is pinned, both the package that owns the
shortcut and the launcher that is pinning the shortcut needs to be
persisted to disk. This CL completes the second half of the story by
persisting the pinned state after pinned state is updated.

Bug: 232775206
Test: manual
Change-Id: Ib673f96c5e1233284c3660ddb4ac0a0d91356924
parent 92538a9d
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -706,7 +706,7 @@ class ShortcutPackage extends ShortcutPackageItem {
            }
            pinnedShortcuts.addAll(pinned);
        });
        // Then, update the pinned state if necessary.
        // Secondly, update the pinned state if necessary.
        final List<ShortcutInfo> pinned = findAll(pinnedShortcuts);
        if (pinned != null) {
            pinned.forEach(si -> {
@@ -720,6 +720,8 @@ class ShortcutPackage extends ShortcutPackageItem {
                si.clearFlags(ShortcutInfo.FLAG_PINNED);
            }
        });
        // Then, schedule a background job to persist the pinned states.
        mShortcutUser.forAllLaunchers(ShortcutPackageItem::scheduleSave);

        // Lastly, remove the ones that are no longer pinned, cached nor dynamic.
        removeOrphans();