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
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user