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

Commit 2d93aabd authored by Pinyao Ting's avatar Pinyao Ting
Browse files

Restrict number of shortcuts can be added through addDynamicShortcuts

This CL fixes the issue where, when an app have multiple main
activities, the total number of shortcuts can grow indefinitely if they
were published through addDynamicShortcuts.

Bug: 281061287
Test: manual
Change-Id: Ib3eecefee34517b670c59dd5b8526fe9eb24f463
Merged-In: Ib3eecefee34517b670c59dd5b8526fe9eb24f463
parent d198f516
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -305,6 +305,7 @@ class ShortcutPackage extends ShortcutPackageItem {
        // Extract Icon and update the icon res ID and the bitmap path.
        s.saveIconAndFixUpShortcutLocked(newShortcut);
        s.fixUpShortcutResourceNamesAndValues(newShortcut);
        ensureShortcutCountBeforePush();
        mShortcuts.put(newShortcut.getId(), newShortcut);
    }

@@ -351,7 +352,6 @@ class ShortcutPackage extends ShortcutPackageItem {
            @NonNull List<ShortcutInfo> changedShortcuts) {
        Preconditions.checkArgument(newShortcut.isEnabled(),
                "pushDynamicShortcuts() cannot publish disabled shortcuts");
        ensureShortcutCountBeforePush();

        newShortcut.addFlags(ShortcutInfo.FLAG_DYNAMIC);