Program: 191776
Project: 191776
Buggy source:
public void testGetShortcuts(){
  setCaller(CALLING_PACKAGE_1);
  final ShortcutInfo s1_1=makeShortcutWithTimestamp("String_Node_Str",5000);
  final ShortcutInfo s1_2=makeShortcutWithTimestamp("String_Node_Str",1000);
  assertTrue(mManager.setDynamicShortcuts(list(s1_1,s1_2)));
  setCaller(CALLING_PACKAGE_2);
  final ShortcutInfo s2_2=makeShortcutWithTimestamp("String_Node_Str",1500);
  final ShortcutInfo s2_3=makeShortcutWithTimestamp("String_Node_Str",3000);
  final ShortcutInfo s2_4=makeShortcutWithTimestamp("String_Node_Str",500);
  assertTrue(mManager.setDynamicShortcuts(list(s2_2,s2_3,s2_4)));
  setCaller(CALLING_PACKAGE_3);
  final ShortcutInfo s3_2=makeShortcutWithTimestamp("String_Node_Str",START_TIME + 5000);
  assertTrue(mManager.setDynamicShortcuts(list(s3_2)));
  setCaller(LAUNCHER_1);
  assertAllDynamic(assertAllHaveTitle(assertAllNotHaveIntents(assertShortcutIds(assertAllNotKeyFieldsOnly(mLauncherApps.getShortcuts(buildQuery(0,CALLING_PACKAGE_1,null,ShortcutQuery.FLAG_GET_DYNAMIC),getCallingUser())),"String_Node_Str","String_Node_Str"))));
  assertShortcutIds(mLauncherApps.getShortcuts(buildQuery(0,CALLING_PACKAGE_1,null,ShortcutQuery.FLAG_GET_PINNED),getCallingUser()));
  assertAllDynamic(assertAllHaveTitle(assertAllNotHaveIntents(assertShortcutIds(assertAllNotKeyFieldsOnly(mLauncherApps.getShortcuts(buildQuery(1000,CALLING_PACKAGE_2,null,ShortcutQuery.FLAG_GET_PINNED | ShortcutQuery.FLAG_GET_DYNAMIC),getCallingUser())),"String_Node_Str","String_Node_Str"))));
  assertAllDynamic(assertAllNotHaveTitle(assertAllNotHaveIntents(assertShortcutIds(assertAllKeyFieldsOnly(mLauncherApps.getShortcuts(buildQuery(1000,CALLING_PACKAGE_2,null,ShortcutQuery.FLAG_GET_DYNAMIC | ShortcutQuery.FLAG_GET_KEY_FIELDS_ONLY),getCallingUser())),"String_Node_Str","String_Node_Str"))));
  assertAllDynamic(assertAllNotHaveTitle(assertAllNotHaveIntents(assertShortcutIds(assertAllKeyFieldsOnly(mLauncherApps.getShortcuts(buildQuery(1000,CALLING_PACKAGE_2,list("String_Node_Str"),null,ShortcutQuery.FLAG_GET_DYNAMIC | ShortcutQuery.FLAG_GET_KEY_FIELDS_ONLY),getCallingUser())),"String_Node_Str"))));
  assertAllDynamic(assertAllNotHaveTitle(assertAllNotHaveIntents(assertShortcutIds(assertAllKeyFieldsOnly(mLauncherApps.getShortcuts(buildQuery(1000,CALLING_PACKAGE_2,list("String_Node_Str","String_Node_Str","String_Node_Str"),null,ShortcutQuery.FLAG_GET_DYNAMIC | ShortcutQuery.FLAG_GET_KEY_FIELDS_ONLY),getCallingUser())),"String_Node_Str","String_Node_Str"))));
  assertAllDynamic(assertAllNotHaveTitle(assertAllNotHaveIntents(assertShortcutIds(assertAllKeyFieldsOnly(mLauncherApps.getShortcuts(buildQuery(1000,CALLING_PACKAGE_2,list("String_Node_Str","String_Node_Str"),null,ShortcutQuery.FLAG_GET_DYNAMIC | ShortcutQuery.FLAG_GET_KEY_FIELDS_ONLY),getCallingUser()))))));
  assertAllDynamic(assertAllNotHaveTitle(assertAllNotHaveIntents(assertShortcutIds(assertAllKeyFieldsOnly(mLauncherApps.getShortcuts(buildQuery(1000,CALLING_PACKAGE_2,list(),null,ShortcutQuery.FLAG_GET_DYNAMIC | ShortcutQuery.FLAG_GET_KEY_FIELDS_ONLY),getCallingUser()))))));
  mLauncherApps.pinShortcuts(CALLING_PACKAGE_2,list("String_Node_Str","String_Node_Str"),getCallingUser());
  assertAllPinned(assertAllHaveTitle(assertAllNotHaveIntents(assertShortcutIds(assertAllNotKeyFieldsOnly(mLauncherApps.getShortcuts(buildQuery(1000,CALLING_PACKAGE_2,null,ShortcutQuery.FLAG_GET_PINNED),getCallingUser())),"String_Node_Str"))));
  assertShortcutIds(assertAllNotKeyFieldsOnly(mLauncherApps.getShortcuts(buildQuery(5000,null,null,ShortcutQuery.FLAG_GET_DYNAMIC | ShortcutQuery.FLAG_GET_PINNED),getCallingUser())),"String_Node_Str","String_Node_Str");
  assertExpectException(IllegalArgumentException.class,"String_Node_Str",() -> {
    mLauncherApps.getShortcuts(buildQuery(0,null,list("String_Node_Str"),null,0),getCallingUser());
  }
);
}

Fixed version (ground truth):
public void testGetShortcuts(){
  setCaller(CALLING_PACKAGE_1);
  final ShortcutInfo s1_1=makeShortcutWithTimestamp("String_Node_Str",5000);
  final ShortcutInfo s1_2=makeShortcutWithTimestamp("String_Node_Str",1000);
  assertTrue(mManager.setDynamicShortcuts(list(s1_1,s1_2)));
  setCaller(CALLING_PACKAGE_2);
  final ShortcutInfo s2_2=makeShortcutWithTimestamp("String_Node_Str",1500);
  final ShortcutInfo s2_3=makeShortcutWithTimestampWithActivity("String_Node_Str",3000,makeComponent(ShortcutActivity2.class));
  final ShortcutInfo s2_4=makeShortcutWithTimestampWithActivity("String_Node_Str",500,makeComponent(ShortcutActivity.class));
  assertTrue(mManager.setDynamicShortcuts(list(s2_2,s2_3,s2_4)));
  setCaller(CALLING_PACKAGE_3);
  final ShortcutInfo s3_2=makeShortcutWithTimestamp("String_Node_Str",START_TIME + 5000);
  assertTrue(mManager.setDynamicShortcuts(list(s3_2)));
  setCaller(LAUNCHER_1);
  assertAllDynamic(assertAllHaveTitle(assertAllNotHaveIntents(assertShortcutIds(assertAllNotKeyFieldsOnly(mLauncherApps.getShortcuts(buildQuery(0,CALLING_PACKAGE_1,null,ShortcutQuery.FLAG_GET_DYNAMIC),getCallingUser())),"String_Node_Str","String_Node_Str"))));
  assertShortcutIds(mLauncherApps.getShortcuts(buildQuery(0,CALLING_PACKAGE_1,null,ShortcutQuery.FLAG_GET_PINNED),getCallingUser()));
  assertAllDynamic(assertAllHaveTitle(assertAllNotHaveIntents(assertShortcutIds(assertAllNotKeyFieldsOnly(mLauncherApps.getShortcuts(buildQuery(1000,CALLING_PACKAGE_2,null,ShortcutQuery.FLAG_GET_PINNED | ShortcutQuery.FLAG_GET_DYNAMIC),getCallingUser())),"String_Node_Str","String_Node_Str"))));
  assertAllDynamic(assertAllNotHaveTitle(assertAllNotHaveIntents(assertShortcutIds(assertAllKeyFieldsOnly(mLauncherApps.getShortcuts(buildQuery(1000,CALLING_PACKAGE_2,null,ShortcutQuery.FLAG_GET_DYNAMIC | ShortcutQuery.FLAG_GET_KEY_FIELDS_ONLY),getCallingUser())),"String_Node_Str","String_Node_Str"))));
  assertAllDynamic(assertAllHaveTitle(assertAllNotHaveIntents(assertShortcutIds(assertAllNotKeyFieldsOnly(mLauncherApps.getShortcuts(buildQuery(0,CALLING_PACKAGE_2,new ComponentName(CALLING_PACKAGE_2,ShortcutActivity.class.getName()),ShortcutQuery.FLAG_GET_PINNED | ShortcutQuery.FLAG_GET_DYNAMIC),getCallingUser())),"String_Node_Str","String_Node_Str"))));
  assertAllDynamic(assertAllNotHaveTitle(assertAllNotHaveIntents(assertShortcutIds(assertAllKeyFieldsOnly(mLauncherApps.getShortcuts(buildQuery(1000,CALLING_PACKAGE_2,list("String_Node_Str"),null,ShortcutQuery.FLAG_GET_DYNAMIC | ShortcutQuery.FLAG_GET_KEY_FIELDS_ONLY),getCallingUser())),"String_Node_Str"))));
  assertAllDynamic(assertAllNotHaveTitle(assertAllNotHaveIntents(assertShortcutIds(assertAllKeyFieldsOnly(mLauncherApps.getShortcuts(buildQuery(1000,CALLING_PACKAGE_2,list("String_Node_Str","String_Node_Str","String_Node_Str"),null,ShortcutQuery.FLAG_GET_DYNAMIC | ShortcutQuery.FLAG_GET_KEY_FIELDS_ONLY),getCallingUser())),"String_Node_Str","String_Node_Str"))));
  assertAllDynamic(assertAllNotHaveTitle(assertAllNotHaveIntents(assertShortcutIds(assertAllKeyFieldsOnly(mLauncherApps.getShortcuts(buildQuery(1000,CALLING_PACKAGE_2,list("String_Node_Str","String_Node_Str"),null,ShortcutQuery.FLAG_GET_DYNAMIC | ShortcutQuery.FLAG_GET_KEY_FIELDS_ONLY),getCallingUser()))))));
  assertAllDynamic(assertAllNotHaveTitle(assertAllNotHaveIntents(assertShortcutIds(assertAllKeyFieldsOnly(mLauncherApps.getShortcuts(buildQuery(1000,CALLING_PACKAGE_2,list(),null,ShortcutQuery.FLAG_GET_DYNAMIC | ShortcutQuery.FLAG_GET_KEY_FIELDS_ONLY),getCallingUser()))))));
  mLauncherApps.pinShortcuts(CALLING_PACKAGE_2,list("String_Node_Str","String_Node_Str"),getCallingUser());
  assertAllPinned(assertAllHaveTitle(assertAllNotHaveIntents(assertShortcutIds(assertAllNotKeyFieldsOnly(mLauncherApps.getShortcuts(buildQuery(1000,CALLING_PACKAGE_2,null,ShortcutQuery.FLAG_GET_PINNED),getCallingUser())),"String_Node_Str"))));
  assertShortcutIds(assertAllNotKeyFieldsOnly(mLauncherApps.getShortcuts(buildQuery(5000,null,null,ShortcutQuery.FLAG_GET_DYNAMIC | ShortcutQuery.FLAG_GET_PINNED),getCallingUser())),"String_Node_Str","String_Node_Str");
  assertExpectException(IllegalArgumentException.class,"String_Node_Str",() -> {
    mLauncherApps.getShortcuts(buildQuery(0,null,list("String_Node_Str"),null,0),getCallingUser());
  }
);
}