shadows/framework/src/main/java/org/robolectric/shadows/ShadowLauncherApps.java
@Implementation(minSdk = N_MR1)
  @Nullable
  protected List<ShortcutInfo> getShortcuts(
      @NonNull ShortcutQuery query, @NonNull UserHandle user) {
    if (reflector(ReflectorShortcutQuery.class, query).getChangedSince() != 0) {
      throw new UnsupportedOperationException(
          "Robolectric does not currently support ShortcutQueries that filter on time since"
              + " change.");
    }
    int flags = reflector(ReflectorShortcutQuery.class, query).getQueryFlags();
    if ((flags & ShortcutQuery.FLAG_MATCH_PINNED) == 0
        || (flags & ShortcutQuery.FLAG_MATCH_DYNAMIC) == 0) {
      throw new UnsupportedOperationException(
          "Robolectric does not currently support ShortcutQueries that match non-dynamic"
              + " Shortcuts.");
    }
    Iterable<ShortcutInfo> shortcutsItr = shortcuts;

    List<String> ids = reflector(ReflectorShortcutQuery.class, query).getShortcutIds();
    if (ids != null) {
      shortcutsItr = Iterables.filter(shortcutsItr, shortcut -> ids.contains(shortcut.getId()));
    }
    ComponentName activity = reflector(ReflectorShortcutQuery.class, query).getActivity();
    if (activity != null) {
      shortcutsItr =
          Iterables.filter(shortcutsItr, shortcut -> shortcut.getActivity().equals(activity));
    }
    String packageName = reflector(ReflectorShortcutQuery.class, query).getPackage();
    if (packageName != null && !packageName.isEmpty()) {
      shortcutsItr =
          Iterables.filter(shortcutsItr, shortcut -> shortcut.getPackage().equals(packageName));
    }
    return Lists.newArrayList(shortcutsItr);
  }
@Implementation(minSdk = N_MR1)
  @Nullable
  protected List<ShortcutInfo> getShortcuts(
      @NonNull ShortcutQuery query, @NonNull UserHandle user) {
    if (reflector(ReflectorShortcutQuery.class, query).getChangedSince() != 0) {
      throw new UnsupportedOperationException(
          "Robolectric does not currently support ShortcutQueries that filter on time since"
              + " change.");
    }
    int flags = reflector(ReflectorShortcutQuery.class, query).getQueryFlags();
    if ((flags & ShortcutQuery.FLAG_MATCH_PINNED) == 0
        || (flags & ShortcutQuery.FLAG_MATCH_DYNAMIC) == 0) {
      throw new UnsupportedOperationException(
          "Robolectric does not currently support ShortcutQueries that match non-dynamic"
              + " Shortcuts.");
    }
    Iterable<ShortcutInfo> shortcutsItr = shortcuts;

    List<String> ids = reflector(ReflectorShortcutQuery.class, query).getShortcutIds();
    if (ids != null) {
      shortcutsItr = Iterables.filter(shortcutsItr, shortcut -> ids.contains(shortcut.getId()));
    }
    ComponentName activity = reflector(ReflectorShortcutQuery.class, query).getActivity();
    if (activity != null) {
      shortcutsItr =
          Iterables.filter(shortcutsItr, shortcut -> shortcut.getActivity().equals(activity));
    }
    String packageName = reflector(ReflectorShortcutQuery.class, query).getPackage();
    if (packageName != null && !packageName.isEmpty()) {
      shortcutsItr =
          Iterables.filter(shortcutsItr, shortcut -> shortcut.getPackage().equals(packageName));
    }
    return Lists.newArrayList(shortcutsItr);
  }
@ Implementation ( minSdk = N_MR1 ) @ Nullable protected List < ShortcutInfo > getShortcuts ( @ NonNull ShortcutQuery query , @ NonNull UserHandle user ) { if ( reflector ( ReflectorShortcutQuery . class , query ) . getChangedSince ( ) != 0 ) { throw new UnsupportedOperationException ( "Robolectric does not currently support ShortcutQueries that filter on time since" + " change." ) ; } int flags = reflector ( ReflectorShortcutQuery . class , query ) . getQueryFlags ( ) ; if ( ( flags & ShortcutQuery . FLAG_MATCH_PINNED ) == 0 || ( flags & ShortcutQuery . FLAG_MATCH_DYNAMIC ) == 0 ) { throw new UnsupportedOperationException ( "Robolectric does not currently support ShortcutQueries that match non-dynamic" + " Shortcuts." ) ; } Iterable < ShortcutInfo > shortcutsItr = shortcuts ; List < String > ids = reflector ( ReflectorShortcutQuery . class , query ) . getShortcutIds ( ) ; if ( ids != null ) { shortcutsItr = Iterables . filter ( shortcutsItr , shortcut -> ids . contains ( shortcut . getId ( ) ) ) ; } ComponentName activity = reflector ( ReflectorShortcutQuery . class , query ) . getActivity ( ) ; if ( activity != null ) { shortcutsItr = Iterables . filter ( shortcutsItr , shortcut -> shortcut . getActivity ( ) . equals ( activity ) ) ; } String packageName = reflector ( ReflectorShortcutQuery . class , query ) . getPackage ( ) ; if ( packageName != null && ! packageName . isEmpty ( ) ) { shortcutsItr = Iterables . filter ( shortcutsItr , shortcut -> shortcut . getPackage ( ) . equals ( packageName ) ) ; } return Lists . newArrayList ( shortcutsItr ) ; }
This method is an incomplete implementation of this API that only supports querying for pinned
dynamic shortcuts. It also doesn't not support {@link ShortcutQuery#setChangedSince(long)}.
This method is an incomplete implementation of this API that only supports querying for pinned dynamic shortcuts . It also doesn t not support {