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

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

Include error logging for investigation on pushDynamicShortcut

Include additional logs for further investigation on reported issue
where calling pushDynamicShortcut in a loop resulted in having more
shortcuts that occupies system memory then allowed by
ShortcutManager#getMaxShortcutCountPerActivity.

Bug: 218259921, 218545269
Test: manual
Change-Id: I268831784ed31f60f3b793c99434178c6e39861b
parent 8184414d
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -442,6 +442,16 @@ class ShortcutPackage extends ShortcutPackageItem {
                    sortShortcutsToActivities();
            final ArrayList<ShortcutInfo> activityShortcuts = all.get(newShortcut.getActivity());

            if (activityShortcuts != null && activityShortcuts.size() > maxShortcuts) {
                Slog.e(TAG, "Error pushing shortcut. There are already "
                        + activityShortcuts.size() + " shortcuts, exceeding the " + maxShortcuts
                        + " shortcuts limit when pushing the new shortcut " + newShortcut
                        + ". Id of shortcuts currently available in system memory are "
                        + activityShortcuts.stream().map(ShortcutInfo::getId)
                        .collect(Collectors.joining(",", "[", "]")));
                // TODO: This should not have happened. If it does, identify the root cause where
                //  possible, otherwise bail-out early to prevent memory issue.
            }
            if (activityShortcuts != null && activityShortcuts.size() == maxShortcuts) {
                // Max has reached. Delete the shortcut with lowest rank.