Merge "Remove unnecessary invokation on AppSearch" into sc-dev

This commit is contained in:
Pinyao Ting
2021-03-30 17:33:28 +00:00
committed by Android (Google) Code Review

View File

@@ -2187,6 +2187,10 @@ class ShortcutPackage extends ShortcutPackageItem {
private void saveShortcut(@NonNull final Collection<ShortcutInfo> shortcuts) {
Objects.requireNonNull(shortcuts);
if (shortcuts.isEmpty()) {
// No need to invoke AppSearch when there's nothing to save.
return;
}
ConcurrentUtils.waitForFutureNoInterrupt(
runInAppSearch(session -> {
final AndroidFuture<Boolean> future = new AndroidFuture<>();